/* ============================================================================
 * Transvial EP - Diseño Institucional Moderno sobre AdminLTE 3
 * ========================================================================== */

:root {
    --tv-green: #006837;
    --tv-green-dark: #004223;
    --tv-green-mid: #047842;
    --tv-green-light: #109457;
    --tv-green-soft: #e9f6ef;
    --tv-navy: #14365d;
    --tv-surface: #f3f6f9;
    --tv-border: #e5ebf1;
    --tv-shadow: 0 4px 20px rgba(15, 23, 42, 0.055);
    --tv-shadow-hover: 0 10px 28px rgba(0, 104, 55, 0.14);
}

body {
    font-family: 'Plus Jakarta Sans', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--tv-surface);
    color: #1e293b;
}

.content-wrapper {
    background-color: var(--tv-surface);
}

.text-transvial { color: var(--tv-green) !important; }
.bg-transvial { background-color: var(--tv-green) !important; color: #fff !important; }
.bg-transvial-dark { background-color: var(--tv-green-dark) !important; color: #fff !important; }

/* Botones y controles */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.18s ease;
}

.btn-transvial {
    background: linear-gradient(135deg, var(--tv-green-mid), var(--tv-green-dark));
    border: none;
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 104, 55, 0.24);
}

.btn-transvial:hover,
.btn-transvial:focus {
    background: linear-gradient(135deg, var(--tv-green-light), var(--tv-green));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 104, 55, 0.3);
}

.btn-outline-transvial {
    color: var(--tv-green);
    border: 1.5px solid var(--tv-green);
    background: #fff;
}

.btn-outline-transvial:hover {
    background-color: var(--tv-green);
    color: #fff;
}

.form-control,
.select2-container--bootstrap4 .select2-selection {
    border-radius: 0.5rem !important;
    border-color: #d5dee7;
}

.form-control:focus {
    border-color: var(--tv-green-light);
    box-shadow: 0 0 0 3px rgba(0, 104, 55, 0.14);
}

/* Navbar superior ejecutiva + Reloj GYE */
.main-header.navbar.tv-navbar {
    min-height: 57px;
    max-height: 57px;
    padding: 0 1rem;
    border-bottom: 1px solid var(--tv-border) !important;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.045);
    background: #ffffff;
}

.tv-nav-toggle-btn {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    border-radius: 9px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: #334155 !important;
    background: #f1f5f9;
    transition: all 0.15s ease;
}

.tv-nav-toggle-btn:hover {
    background: var(--tv-green-soft);
    color: var(--tv-green) !important;
}

.tv-nav-brand-ctx {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.tv-nav-kicker {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    color: var(--tv-green);
}

.tv-nav-title {
    font-size: 0.94rem;
    font-weight: 700;
    color: #0f172a;
}

/* Reloj oficial Guayaquil, Ecuador */
.tv-gye-clock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3faf6;
    border: 1px solid #c6e5d3;
    border-radius: 999px;
    padding: 0.28rem 0.72rem;
    font-size: 0.78rem;
    color: #0f172a;
}

.tv-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
    animation: tvPulseDot 2s infinite;
}

@keyframes tvPulseDot {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.tv-gye-time {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #004d29;
    letter-spacing: 0.02em;
}

.tv-gye-sep { color: #94a3b8; }

.tv-gye-date {
    font-weight: 600;
    color: #475569;
    text-transform: capitalize;
}

.tv-gye-zone {
    background: #006837;
    color: #fff;
    font-size: 0.64rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 999px;
    letter-spacing: 0.04em;
}

.btn-tour-pill {
    background: var(--tv-green-soft);
    color: var(--tv-green-dark);
    border: 1px solid #bfe3cd;
    border-radius: 999px;
    padding: 0.3rem 0.78rem;
    font-size: 0.78rem;
    font-weight: 700;
    height: 33px;
    display: inline-flex;
    align-items: center;
}

.btn-tour-pill:hover {
    background: var(--tv-green);
    color: #fff;
    border-color: var(--tv-green);
}

/* Pill unificado de usuario + rol */
.tv-nav-user-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 3px 5px !important;
    height: 36px !important;
    border-radius: 999px;
    border: 1px solid #dbe4ec;
    background: #f8fafc;
    color: #0f172a !important;
    transition: all 0.15s ease;
}

.tv-nav-user-pill:hover {
    border-color: var(--tv-green);
    background: #f2faf6;
}

.tv-nav-avatar {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: linear-gradient(135deg, #047842, #004223);
    color: #fff;
    font-weight: 800;
    font-size: 0.76rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tv-nav-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.08;
    text-align: left;
}

.tv-nav-user-name {
    font-size: 0.76rem;
    font-weight: 700;
    color: #0f172a;
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-nav-user-role {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.tv-nav-user-role.is-admin { color: #dc2626; }
.tv-nav-user-role.is-tthh { color: #006837; }

.tv-user-dropdown {
    border-radius: 0.75rem;
    border: 1px solid var(--tv-border);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    min-width: 245px;
}

/* Sidebar oscuro institucional mejorado */
.sidebar-dark-transvial {
    background: linear-gradient(180deg, #064427 0%, #032b19 55%, #011c10 100%) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.16);
}

.main-sidebar .sidebar,
.main-sidebar .os-viewport {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.main-sidebar .sidebar::-webkit-scrollbar,
.main-sidebar .os-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.sidebar-dark-transvial .brand-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.65rem 0.9rem;
    min-height: 58px;
    color: #fff;
    background: rgba(0, 0, 0, 0.12);
}

.tv-sidebar-user-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
    padding: 0.45rem 0.6rem;
    margin-left: 0.1rem;
    margin-right: 0.1rem;
    transition: all 0.2s ease;
}

.tv-role-chip {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #b7f5d2;
    letter-spacing: 0.02em;
}

.sidebar-dark-transvial .nav-sidebar > .nav-item > .nav-link,
.sidebar-dark-transvial .nav-sidebar #tour-menu-admin > .nav-item > .nav-link {
    position: relative;
    border-radius: 0.6rem;
    margin-bottom: 2px;
    padding: 0.4rem 0.65rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.84);
    transition: all 0.16s ease;
    display: flex;
    align-items: center;
}

.sidebar-dark-transvial .nav-sidebar .nav-link .nav-icon {
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    margin-right: 0.6rem !important;
    font-size: 0.86rem;
    flex-shrink: 0;
    transition: all 0.16s ease;
}

.sidebar-dark-transvial .nav-sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(16, 148, 87, 0.95), rgba(10, 122, 71, 0.92)) !important;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 5px 14px rgba(16, 148, 87, 0.35);
}

.sidebar-dark-transvial .nav-sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 20%;
    height: 60%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: #6ee7b7;
}

.sidebar-dark-transvial .nav-sidebar .nav-link.active .nav-icon {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.sidebar-dark-transvial .nav-sidebar .nav-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.11);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-dark-transvial .nav-header {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.5rem 0.7rem 0.22rem;
}

/* Cuando el sidebar está colapsado en escritorio: SOLO icono, nunca expandirse ni mostrar texto interno */
@media (min-width: 992px) {
    .sidebar-mini.sidebar-collapse .main-sidebar,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover,
    .sidebar-mini.sidebar-collapse .main-sidebar.sidebar-focused {
        width: 4.6rem !important;
        max-width: 4.6rem !important;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar .brand-link,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .brand-link,
    .sidebar-mini.sidebar-collapse .main-sidebar.sidebar-focused .brand-link {
        width: 4.6rem !important;
        padding: 0.65rem 0.35rem !important;
        justify-content: center !important;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar .brand-link .logo-transvial,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .brand-link .logo-transvial {
        height: 20px !important;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar .tv-sidebar-user-card,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .tv-sidebar-user-card {
        justify-content: center !important;
        padding: 0.35rem 0.2rem !important;
        background: transparent;
        border-color: transparent;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar .tv-sidebar-user-card .info,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .tv-sidebar-user-card .info,
    .sidebar-mini.sidebar-collapse .main-sidebar .nav-sidebar .nav-link p,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .nav-sidebar .nav-link p,
    .sidebar-mini.sidebar-collapse .main-sidebar .nav-header,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .nav-header {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar .nav-sidebar .nav-link,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .nav-sidebar .nav-link {
        width: auto !important;
        justify-content: center !important;
        padding: 0.36rem !important;
        transform: none !important;
    }

    .sidebar-mini.sidebar-collapse .main-sidebar .nav-sidebar .nav-link .nav-icon,
    .sidebar-mini.sidebar-collapse .main-sidebar:hover .nav-sidebar .nav-link .nav-icon {
        margin-right: 0 !important;
        width: 34px;
        height: 34px;
        line-height: 34px;
        font-size: 0.98rem;
    }
}

/* Pestaña flotante al pasar el cursor en modo colapsado */
.tv-sidebar-flyout {
    position: fixed;
    z-index: 1058;
    min-width: 215px;
    max-width: 270px;
    background: #064427;
    color: #fff;
    border: 1px solid rgba(110, 231, 183, 0.35);
    border-left: 4px solid #34d399;
    border-radius: 0.65rem;
    padding: 0.55rem 0.9rem;
    box-shadow: 0 14px 32px rgba(2, 26, 15, 0.38);
    pointer-events: none;
    animation: tvFlyoutIn 0.14s ease-out;
}

.tv-sidebar-flyout::before {
    content: "";
    position: absolute;
    left: -9px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-style: solid;
    border-color: transparent #34d399 transparent transparent;
}

.tv-sidebar-flyout-title {
    font-weight: 700;
    font-size: 0.88rem;
    line-height: 1.2;
}

.tv-sidebar-flyout-desc {
    font-size: 0.73rem;
    color: #bbf7d0;
    margin-top: 2px;
}

@keyframes tvFlyoutIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #16a34a, #059669);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Tarjetas modernas */
.card {
    border: 1px solid var(--tv-border);
    border-radius: 0.85rem;
    box-shadow: var(--tv-shadow);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--tv-border);
    border-top-left-radius: 0.85rem !important;
    border-top-right-radius: 0.85rem !important;
    padding: 0.9rem 1.15rem;
}

.card-outline-transvial {
    border-top: 3px solid var(--tv-green);
}

.modal-content {
    border: none;
    border-radius: 0.9rem;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

/* Dashboard Hero Banner */
.tv-hero-banner {
    background: linear-gradient(125deg, #004223 0%, #006837 55%, #0c8a4f 100%);
    border-radius: 1rem;
    padding: 1.5rem 1.75rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 104, 55, 0.22);
    margin-bottom: 1.25rem;
}

.tv-hero-banner::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

/* Tarjetas KPI modernas */
.tv-stat-card {
    background: #fff;
    border: 1px solid var(--tv-border);
    border-radius: 0.85rem;
    padding: 1.15rem 1.25rem;
    box-shadow: var(--tv-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.tv-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--tv-shadow-hover);
}

.tv-stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
}

.tv-stat-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.tv-stat-link {
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.35rem;
}

.tv-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.tv-icon-green { background: #e8f6ee; color: #006837; }
.tv-icon-blue { background: #e6f4fa; color: #0284c7; }
.tv-icon-indigo { background: #eef2ff; color: #4f46e5; }
.tv-icon-amber { background: #fef3c7; color: #d97706; }

/* Tarjetas de Acceso Rápido a los 3 Formularios */
.tv-quick-card {
    display: flex;
    align-items: center;
    gap: 0.95rem;
    background: #fff;
    border: 1px solid var(--tv-border);
    border-radius: 0.85rem;
    padding: 1rem 1.15rem;
    color: #1e293b;
    text-decoration: none !important;
    box-shadow: var(--tv-shadow);
    transition: all 0.2s ease;
    height: 100%;
}

.tv-quick-card:hover {
    border-color: var(--tv-green);
    transform: translateY(-3px);
    box-shadow: var(--tv-shadow-hover);
    color: #0f172a;
}

.tv-quick-badge {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Tarjeta resumen de saldo en modales */
.balance-preview-card {
    background: var(--tv-green-soft);
    border: 1px solid #b7dfc9;
    border-left: 4px solid var(--tv-green);
    border-radius: 0.6rem;
    padding: 0.85rem 1rem;
}

/* Zona de carga PDF obligatoria */
.pdf-dropzone {
    border: 2px dashed #006837;
    background-color: #f6fbf8;
    border-radius: 0.65rem;
    padding: 1rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pdf-dropzone.has-file {
    background-color: #e8f5ee;
    border-style: solid;
}

/* Login Split-Screen Moderno */
.login-page-transvial {
    background: radial-gradient(circle at top left, #0a874d 0%, #00582e 45%, #022b17 100%);
    min-height: 100vh;
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-split-wrapper {
    width: 920px;
    max-width: 96vw;
    background: #fff;
    border-radius: 1.15rem;
    overflow: hidden;
    box-shadow: 0 28px 65px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-wrap: wrap;
}

.login-hero-pane {
    flex: 1 1 46%;
    background: linear-gradient(155deg, #004223 0%, #006837 60%, #0d8d51 100%);
    color: #fff;
    padding: 2.6rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.login-form-pane {
    flex: 1 1 54%;
    background: #fff;
    padding: 2.6rem 2.4rem;
}

.login-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.92);
}

.login-feature-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.demo-pill-btn {
    border: 1px solid #d5e5dc;
    background: #f6fbf8;
    border-radius: 0.55rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    flex: 1;
}

.demo-pill-btn:hover {
    border-color: var(--tv-green);
    background: var(--tv-green-soft);
}

@media (max-width: 767.98px) {
    .login-hero-pane { display: none; }
    .login-form-pane { padding: 2rem 1.5rem; }
}

/* Badges y tablas sin scroll horizontal en escritorio */
.badge-regime { font-size: 0.78rem; padding: 0.3em 0.6em; border-radius: 6px; }
.table td, .table th { vertical-align: middle !important; }

.tv-table-wrap {
    width: 100%;
    overflow-x: visible;
}

@media (max-width: 991.98px) {
    .tv-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

table.tv-table-fit {
    width: 100% !important;
    font-size: 0.83rem;
    table-layout: auto;
}

table.tv-table-fit th {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: normal !important;
    padding: 0.52rem 0.5rem !important;
}

table.tv-table-fit td {
    white-space: normal !important;
    word-break: break-word;
    padding: 0.48rem 0.5rem !important;
    line-height: 1.32;
}

.dataTables_wrapper .row {
    margin-left: 0;
    margin-right: 0;
}

/* Logo oficial Transvial EP: blanco automático sobre fondos verdes */
.logo-transvial {
    height: auto;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.logo-transvial-white,
.sidebar-dark-transvial .logo-transvial,
.bg-transvial .logo-transvial,
.bg-transvial-dark .logo-transvial,
.bg-success .logo-transvial,
.tv-hero-banner .logo-transvial,
.login-hero-pane .logo-transvial {
    filter: brightness(0) invert(1);
}

body.sidebar-collapse .main-sidebar:not(:hover) .brand-link {
    justify-content: center;
    padding: 0.65rem 0.35rem;
}

body.sidebar-collapse .main-sidebar:not(:hover) .brand-link .logo-transvial {
    height: 22px !important;
}

/* ============================================================================
 * Tutorial Interactivo (Spotlight Tour)
 * ========================================================================== */
.tv-tour-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1060;
    transition: opacity 0.2s ease;
}

.tv-tour-highlight {
    position: relative !important;
    z-index: 1065 !important;
    box-shadow: 0 0 0 4px #ffffff, 0 0 0 8px #109457, 0 18px 40px rgba(0, 0, 0, 0.35) !important;
    border-radius: 0.85rem;
    transition: box-shadow 0.25s ease;
}

.tv-tour-popover {
    position: fixed;
    z-index: 1070;
    width: 370px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border-radius: 0.9rem;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.35);
    border-top: 4px solid var(--tv-green);
    padding: 1.15rem 1.25rem;
    animation: tvTourPop 0.2s ease-out;
}

@keyframes tvTourPop {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tv-tour-progress {
    height: 5px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin: 0.55rem 0 0.85rem;
}

.tv-tour-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--tv-green), #16a34a);
    transition: width 0.25s ease;
}

/* Página dedicada Nueva Solicitud */
.tv-type-card {
    border: 2px solid var(--tv-border);
    border-radius: 0.9rem;
    background: #fff;
    padding: 1rem 1.15rem;
    cursor: pointer;
    transition: all 0.18s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.tv-type-card:hover {
    border-color: #9dd4b5;
    transform: translateY(-2px);
    box-shadow: var(--tv-shadow);
}

.tv-type-card.active {
    border-color: var(--tv-green);
    background: linear-gradient(135deg, #ffffff 0%, #eefaf3 100%);
    box-shadow: 0 8px 24px rgba(0, 104, 55, 0.16);
}

.tv-sticky-summary {
    position: sticky;
    top: 72px;
}

.pdf-dropzone.drag-over {
    background-color: #dcfce7;
    border-color: #059669;
}

/* ============================================================================
 * Calendario de Permisos y Vacaciones (FullCalendar v6)
 * ========================================================================== */
.tv-cal-filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px !important;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.22rem 0.65rem;
    border: 1px solid var(--tv-border);
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tv-cal-filter:hover {
    border-color: var(--tv-green);
    color: var(--tv-green);
}

.tv-cal-filter.active {
    background: var(--tv-green);
    border-color: var(--tv-green);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 104, 55, 0.22);
}

.tv-cal-count {
    background: rgba(15, 23, 42, 0.08);
    color: inherit;
    border-radius: 999px;
    padding: 0 6px;
    font-size: 0.68rem;
    font-weight: 700;
}

.tv-cal-filter.active .tv-cal-count {
    background: rgba(255, 255, 255, 0.22);
}

.tv-cal-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tv-cal-search {
    width: 210px;
    max-width: 100%;
    position: relative;
}

.tv-cal-search input {
    height: 29px;
    border-radius: 999px !important;
    padding-left: 28px;
    font-size: 0.76rem;
    background: #f8fafc;
}

.tv-cal-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    color: #94a3b8;
    pointer-events: none;
}

#tvPermisosCalendar {
    --fc-border-color: #e6ecf2;
    --fc-button-bg-color: #006837;
    --fc-button-border-color: #006837;
    --fc-button-hover-bg-color: #004223;
    --fc-button-hover-border-color: #004223;
    --fc-button-active-bg-color: #004223;
    --fc-button-active-border-color: #004223;
    --fc-today-bg-color: #f1faf5;
    font-size: 0.84rem;
}

#tvPermisosCalendar .fc-toolbar-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    text-transform: capitalize;
    letter-spacing: -0.01em;
}

#tvPermisosCalendar .fc-button {
    border-radius: 0.45rem;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.3rem 0.68rem;
    text-transform: capitalize;
    box-shadow: none !important;
}

#tvPermisosCalendar .fc-col-header-cell {
    background: #f8fafc;
}

#tvPermisosCalendar .fc-col-header-cell-cushion {
    color: #475569;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 7px 4px;
}

#tvPermisosCalendar .fc-day-sat,
#tvPermisosCalendar .fc-day-sun {
    background-color: #fafbfc;
}

#tvPermisosCalendar .fc-daygrid-day {
    transition: background-color 0.14s ease;
}

#tvPermisosCalendar .fc-daygrid-day:hover {
    background-color: #eef9f3;
    cursor: pointer;
}

#tvPermisosCalendar .fc-daygrid-day-number {
    font-weight: 600;
    font-size: 0.78rem;
    color: #334155;
    padding: 4px 7px;
    margin: 2px;
}

#tvPermisosCalendar .fc-day-today .fc-daygrid-day-number {
    background: #006837;
    color: #fff;
    border-radius: 999px;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 104, 55, 0.35);
}

#tvPermisosCalendar .fc-event {
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    border: none !important;
    border-left-width: 3.5px !important;
    border-left-style: solid !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#tvPermisosCalendar .fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
}

/* Pastillas suaves con barra lateral de categoría */
#tvPermisosCalendar .fc-event.tv-ev-vacaciones {
    background: #e6f6ee !important;
    color: #004d29 !important;
    border-left-color: #006837 !important;
}

#tvPermisosCalendar .fc-event.tv-ev-permiso {
    background: #e6f4fe !important;
    color: #075985 !important;
    border-left-color: #0284c7 !important;
}

#tvPermisosCalendar .fc-event.tv-ev-particular {
    background: #fef3c7 !important;
    color: #92400e !important;
    border-left-color: #d97706 !important;
}

#tvPermisosCalendar .fc-event.tv-ev-oficial {
    background: #eef2f6 !important;
    color: #334155 !important;
    border-left-color: #475569 !important;
}

.tv-ev-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    width: 100%;
}

.tv-ev-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
}

.tv-ev-dur {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.72);
    flex-shrink: 0;
}

#tvPermisosCalendar .fc-daygrid-more-link {
    font-size: 0.72rem;
    font-weight: 700;
    color: #006837;
    padding: 1px 5px;
    border-radius: 4px;
}

#tvPermisosCalendar .fc-popover {
    border-radius: 0.7rem;
    border: 1px solid var(--tv-border);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
}

#tvPermisosCalendar .fc-list-event:hover td {
    background-color: #f1faf5 !important;
}

/* Tooltip flotante al pasar por un evento del calendario */
.tv-cal-tooltip {
    position: fixed;
    z-index: 1080;
    width: 270px;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 0.65rem;
    padding: 0.65rem 0.8rem;
    font-size: 0.75rem;
    line-height: 1.45;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.32);
    border-left: 4px solid #10b981;
    pointer-events: none;
}

.tv-cal-tooltip-head {
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    margin-bottom: 3px;
}

.tv-cal-tooltip-meta {
    color: #cbd5e1;
}

/* ============================================================================
 * Dashboard sin scroll en escritorio: todo reescala al alto de pantalla
 * ========================================================================== */
@media (max-width: 991.98px) {
    #tvPermisosCalendar {
        min-height: 460px;
    }
}

@media (min-width: 992px) {
    body.tv-page-dashboard {
        height: 100vh !important;
        overflow: hidden !important;
    }

    body.tv-page-dashboard .wrapper {
        height: 100vh !important;
        overflow: hidden !important;
    }

    body.tv-page-dashboard .main-footer {
        height: 38px !important;
        padding: 0.45rem 1rem !important;
        font-size: 0.78rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    body.tv-page-dashboard .content-wrapper {
        height: calc(100vh - 57px - 38px) !important;
        min-height: 0 !important;
        max-height: calc(100vh - 57px - 38px) !important;
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
    }

    body.tv-page-dashboard section.content,
    body.tv-page-dashboard section.content > .container-fluid {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding-top: 0.55rem !important;
        padding-bottom: 0.55rem !important;
    }

    body.tv-page-dashboard .tv-hero-banner {
        padding: 0.85rem 1.3rem;
        margin-bottom: 0.55rem;
        flex-shrink: 0;
    }

    body.tv-page-dashboard .tv-hero-banner h2 {
        font-size: 1.35rem;
        margin-bottom: 0.15rem !important;
    }

    body.tv-page-dashboard .tv-hero-banner p {
        font-size: 0.84rem;
        line-height: 1.3;
    }

    body.tv-page-dashboard #tour-quick-actions {
        margin-bottom: 0.55rem !important;
        flex-shrink: 0;
    }

    body.tv-page-dashboard .tv-quick-card {
        padding: 0.58rem 0.85rem;
        gap: 0.7rem;
    }

    body.tv-page-dashboard .tv-quick-badge {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    body.tv-page-dashboard #tour-calendario-row {
        flex: 1 1 auto;
        min-height: 0;
        margin-bottom: 0 !important;
    }

    body.tv-page-dashboard #tour-calendario-row > .col-12,
    body.tv-page-dashboard #tour-calendario {
        height: 100%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        margin-bottom: 0 !important;
    }

    body.tv-page-dashboard #tour-calendario .card-header {
        padding: 0.55rem 1rem;
        flex-shrink: 0;
    }

    body.tv-page-dashboard #tour-calendario .card-body {
        flex: 1 1 auto;
        min-height: 0;
        padding: 0.65rem 0.9rem;
        display: flex;
        flex-direction: column;
    }

    body.tv-page-dashboard #tvPermisosCalendar {
        flex: 1 1 auto;
        min-height: 0;
        height: 100% !important;
    }

    body.tv-page-dashboard #tvPermisosCalendar .fc-header-toolbar {
        margin-bottom: 0.5rem !important;
    }

    body.tv-page-dashboard #tvPermisosCalendar .fc-daygrid-day-frame {
        min-height: 0 !important;
    }
}

/* ============================================================================
 * Componentes Ejecutivos Reutilizables (Cargar Saldos & Kardex Individual)
 * ========================================================================== */
.tv-module-hero {
    background: linear-gradient(135deg, #004223 0%, #006837 55%, #0d7a47 100%);
    color: #fff;
    border-radius: 1rem;
    padding: 1.15rem 1.4rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 26px rgba(0, 66, 35, 0.16);
    position: relative;
    overflow: visible;
}

.tv-module-hero h1,
.tv-module-hero h2 {
    color: #fff;
    letter-spacing: -0.02em;
}

.tv-hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    padding: 0.24rem 0.72rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.tv-hero-pill-light {
    background: #fff;
    color: #004d29;
    border-color: #fff;
}

.tv-hero-actions .btn {
    border-radius: 0.55rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.tv-btn-glass {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.34);
    color: #fff !important;
}

.tv-btn-glass:hover {
    background: rgba(255, 255, 255, 0.24);
    color: #fff !important;
}

/* Tarjetas KPI ejecutivas */
.tv-stat-card {
    background: #fff;
    border: 1px solid #e6edf3;
    border-radius: 0.9rem;
    padding: 0.9rem 1.05rem;
    height: 100%;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tv-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.tv-stat-card.emerald-highlight {
    background: linear-gradient(135deg, #ffffff 0%, #effaf3 100%);
    border-color: #b7e4c7;
}

.tv-stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.tv-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.tv-stat-value {
    font-size: 1.48rem;
    font-weight: 800;
    line-height: 1.15;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.tv-stat-sub {
    font-size: 0.74rem;
    color: #64748b;
    margin-top: 0.35rem;
}

.tv-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.tv-stat-icon.green { background: #e6f6ee; color: #006837; }
.tv-stat-icon.blue { background: #e0f2fe; color: #0369a1; }
.tv-stat-icon.amber { background: #fef3c7; color: #b45309; }
.tv-stat-icon.slate { background: #eef2f6; color: #475569; }

/* Barras de progreso */
.tv-progress-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.tv-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #006837, #16a34a);
    transition: width 0.35s ease;
}

.tv-progress-fill.warn {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

.tv-progress-fill.danger {
    background: linear-gradient(90deg, #b91c1c, #ef4444);
}

/* Avatares con iniciales */
.tv-avatar-circle {
    border-radius: 50%;
    background: linear-gradient(135deg, #004223, #0d824b);
    color: #fff;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
    box-shadow: 0 3px 8px rgba(0, 104, 55, 0.22);
}

.tv-avatar-sm {
    width: 34px;
    height: 34px;
    font-size: 0.74rem;
}

.tv-avatar-lg {
    width: 58px;
    height: 58px;
    font-size: 1.2rem;
}

/* Badges suaves institucionales */
.tv-soft-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.tv-badge-losep { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.tv-badge-ct { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.tv-badge-loep { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.tv-badge-loaded { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.tv-badge-pending { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }

/* Pestañas tipo píldora para filtros rápidos */
.tv-pill-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 999px;
    gap: 3px;
}

.tv-pill-tab {
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.28rem 0.78rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tv-pill-tab:hover {
    color: #006837;
}

.tv-pill-tab.active {
    background: #006837;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 104, 55, 0.25);
}

/* Inputs compactos de días/horas en tabla Saldos */
.tv-saldo-unit-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.45rem;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tv-saldo-unit-group:focus-within {
    border-color: #006837;
    box-shadow: 0 0 0 2px rgba(0, 104, 55, 0.14);
}

.tv-saldo-unit-group input {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent;
    width: 100%;
    min-width: 0;
    padding: 0.22rem 0.28rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}

.tv-saldo-unit-suffix {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    padding: 0.24rem 0.36rem;
    user-select: none;
}

.tv-fecha-input {
    min-width: 0;
    width: 100%;
    padding: 0.2rem 0.3rem;
    font-size: 0.78rem;
    border-radius: 0.45rem;
    border-color: #cbd5e1;
}

tr.tv-row-dirty {
    background-color: #ecfdf5 !important;
}

/* Barra flotante inferior de guardado en lote */
.tv-floating-savebar {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 1045;
    background: #0f172a;
    color: #fff;
    padding: 0.68rem 1.15rem;
    border-radius: 999px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.tv-floating-savebar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Grid de ficha en Kardex */
.tv-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 991.98px) {
    .tv-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .tv-meta-grid {
        grid-template-columns: 1fr;
    }
}

.tv-meta-item {
    background: #f8fafc;
    border: 1px solid #e8eef4;
    border-radius: 0.65rem;
    padding: 0.55rem 0.78rem;
}

.tv-meta-label {
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 0.15rem;
}

.tv-meta-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
}

.tv-formula-bar {
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 0.55rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 1rem;
}

.tv-formula-eq {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.tv-formula-chip {
    background: #f1f5f9;
    padding: 0.18rem 0.55rem;
    border-radius: 0.45rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tv-formula-chip.result {
    background: #dcfce7;
    color: #004d29;
}

.tv-empty-state {
    padding: 1.75rem 1rem;
    text-align: center;
    color: #64748b;
}

.tv-empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.55rem;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Selector Select2 dentro del Hero */
.tv-module-hero .select2-container--bootstrap4 .select2-selection {
    border: 0 !important;
    border-radius: 0.55rem !important;
    min-height: 38px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Impresión */
@media print {
    .main-header, .main-sidebar, .main-footer, .no-print,
    .dt-buttons, .dataTables_filter, .dataTables_length, .dataTables_paginate {
        display: none !important;
    }
    .content-wrapper { margin-left: 0 !important; padding: 0 !important; }
}
