/**
 * ============================================
 * TRANSPARENCIA CSS - Portal Público
 * Gestión Patrimonio - Entersolo
 * ============================================
 *
 * Basado en Manual IC y UI v2.1
 * Diseño: Clean Minimalist + Glassmorphism
 */

/* ============================================
   1. VARIABLES Y TOKENS
   ============================================ */
:root {
    /* Colores Corporativos */
    --brand-blue: #1C3052;
    --brand-red: #E73C1E;

    /* UI Digital */
    --ui-interaction: #3B82F6;
    --ui-success: #10B981;
    --ui-warning: #F59E0B;
    --ui-error: #EF4444;

    /* Fondos Light */
    --bg-app: #F5F7FA;
    --bg-elevated: #FFFFFF;
    --card-bg: #FFFFFF;
    --card-border: rgba(28, 48, 82, 0.1);
    --card-shadow: 0 1px 3px rgba(28, 48, 82, 0.06), 0 4px 16px rgba(28, 48, 82, 0.06);
    --card-shadow-hover: 0 8px 24px rgba(28, 48, 82, 0.12), 0 16px 48px rgba(28, 48, 82, 0.08);

    /* Textos */
    --text-primary: #1C3052;
    --text-secondary: #64748B;
    --text-tertiary: #94A3B8;

    /* Tipografía */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Espaciado */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Header */
    --header-height: 72px;

    /* Grid */
    --container-max: 1400px;
}

/* ============================================
   2. DARK MODE
   ============================================ */
[data-theme="dark"] {
    --bg-app: #0B0F19;
    --bg-elevated: rgba(28, 48, 82, 0.4);
    --card-bg: rgba(28, 48, 82, 0.45);
    --card-border: rgba(59, 130, 246, 0.2);
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 1px rgba(255, 255, 255, 0.05) inset;
    --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 30px rgba(59, 130, 246, 0.1);

    --text-primary: #FFFFFF;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
}

/* ============================================
   3. RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-main);
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   4. HEADER
   ============================================ */
.tp-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-elevated);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    z-index: 1000;
    transition: all var(--transition-smooth);
}

[data-theme="dark"] .tp-header {
    background: rgba(11, 15, 25, 0.85);
    border-bottom-color: rgba(59, 130, 246, 0.15);
}

.tp-header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
}

.tp-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-decoration: none;
}

.tp-logo-mark {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tp-logo-mark .e { color: var(--brand-blue); }
[data-theme="dark"] .tp-logo-mark .e { color: #FFFFFF; }
.tp-logo-mark .dot { color: var(--brand-red); }

.tp-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.tp-logo-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tp-logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.tp-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.tp-theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: 1px solid var(--card-border);
    background: var(--bg-elevated);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.tp-theme-toggle:hover {
    border-color: var(--ui-interaction);
    transform: scale(1.05);
}

.tp-theme-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

.tp-theme-toggle .icon-moon { display: block; }
.tp-theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .tp-theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .tp-theme-toggle .icon-sun { display: block; }

/* ============================================
   5. HERO SECTION
   ============================================ */
.tp-hero {
    position: relative;
    min-height: 45vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: var(--header-height);
    padding: var(--space-3xl) var(--space-xl);
    overflow: hidden;
    background: linear-gradient(135deg, var(--brand-blue) 0%, #2a4a7a 50%, #1C3052 100%);
    margin-bottom: -73px;
}

.tp-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(231, 60, 30, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.2) 0%, transparent 50%);
    pointer-events: none;
}

.tp-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, var(--bg-app) 0%, transparent 100%);
    pointer-events: none;
}

.tp-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
}

.tp-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-lg);
    animation: fadeInUp 0.6s ease-out;
}

.tp-hero-badge svg {
    width: 16px;
    height: 16px;
}

.tp-hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.1;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.tp-hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255, 255, 255, 0.8);
    max-width: 600px;
    margin: 0 auto var(--space-lg) auto;
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

.tp-hero-org {
    margin-top: var(--space-md);
    margin-bottom: 0;
    padding: var(--space-md) var(--space-xl);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    animation: fadeInUp 0.6s ease-out 0.3s backwards;
}

.tp-hero-org-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #FFFFFF;
    letter-spacing: 0.02em;
}

/* ============================================
   6. STATS SECTION - CARRUSEL
   ============================================ */
.tp-stats {
    position: relative;
    z-index: 10;
    margin-top: -60px;
    padding: 0 var(--space-xl);
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
}

.tp-stats-carousel {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.tp-stats-track {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 24px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 0;
    width: max-content;
}

/* Card base styles for carousel */
.tp-stats-track .tp-stat-card {
    flex: 0 0 280px !important;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    transition: all var(--transition-smooth);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tp-stats-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
}

.tp-stats-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #1C3052;
    background: #FFFFFF;
    color: #1C3052;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tp-stats-btn:hover:not(:disabled) {
    background: #1C3052;
    color: #FFFFFF;
    transform: scale(1.05);
}

.tp-stats-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #ccc;
}

.tp-stats-btn svg {
    width: 24px;
    height: 24px;
}

.tp-stats-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tp-stats-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #CBD5E1;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.tp-stats-dot.active {
    background: #E73C1E;
    width: 32px;
    border-radius: 6px;
}

.tp-stats-dot:hover:not(.active) {
    background: #94A3B8;
    transform: scale(1.1);
}

/* Dark mode overrides for nav */
[data-theme="dark"] .tp-stats-btn {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    color: #FFFFFF;
}

[data-theme="dark"] .tp-stats-btn:hover:not(:disabled) {
    background: #3B82F6;
    border-color: #3B82F6;
}

[data-theme="dark"] .tp-stats-dot {
    background: rgba(255,255,255,0.3);
}

[data-theme="dark"] .tp-stats-dot.active {
    background: #E73C1E;
}

/* Fallback grid for no-JS */
.tp-stats-grid {
    max-width: var(--container-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
}

/* ============================================
   STATS ROW - 9 Epígrafes en fila única
   ============================================ */
.tp-stats-row {
    position: relative;
    z-index: 10;
    margin-top: -40px;
    padding: 0 var(--space-xl);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.tp-stats-flex {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
}

.tp-stat-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: default;
    min-width: 90px;
    position: relative;
}

.tp-stat-mini::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--stat-color);
    border-radius: 3px;
    transition: width var(--transition-base);
}

.tp-stat-mini:hover {
    background: rgba(59, 130, 246, 0.05);
}

.tp-stat-mini:hover::after {
    width: 60%;
}

[data-theme="dark"] .tp-stat-mini:hover {
    background: rgba(59, 130, 246, 0.1);
}

.tp-stat-mini-icon {
    margin-bottom: 6px;
}

.tp-stat-mini-icon svg {
    width: 24px;
    height: 24px;
}

.tp-stat-mini-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 2px;
}

.tp-stat-mini-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Animaciones escalonadas */
.tp-stat-mini:nth-child(1) { animation: fadeInUp 0.3s ease-out 0.05s backwards; }
.tp-stat-mini:nth-child(2) { animation: fadeInUp 0.3s ease-out 0.08s backwards; }
.tp-stat-mini:nth-child(3) { animation: fadeInUp 0.3s ease-out 0.11s backwards; }
.tp-stat-mini:nth-child(4) { animation: fadeInUp 0.3s ease-out 0.14s backwards; }
.tp-stat-mini:nth-child(5) { animation: fadeInUp 0.3s ease-out 0.17s backwards; }
.tp-stat-mini:nth-child(6) { animation: fadeInUp 0.3s ease-out 0.20s backwards; }
.tp-stat-mini:nth-child(7) { animation: fadeInUp 0.3s ease-out 0.23s backwards; }
.tp-stat-mini:nth-child(8) { animation: fadeInUp 0.3s ease-out 0.26s backwards; }
.tp-stat-mini:nth-child(9) { animation: fadeInUp 0.3s ease-out 0.29s backwards; }

/* Responsive */
@media (max-width: 1200px) {
    .tp-stats-flex {
        gap: 4px;
        padding: 12px 16px;
    }

    .tp-stat-mini {
        padding: 8px 10px;
        min-width: 70px;
    }

    .tp-stat-mini-icon svg {
        width: 20px;
        height: 20px;
    }

    .tp-stat-mini-value {
        font-size: 1.25rem;
    }

    .tp-stat-mini-label {
        font-size: 0.55rem;
    }
}

@media (max-width: 900px) {
    .tp-stats-flex {
        flex-wrap: wrap;
        justify-content: center;
    }

    .tp-stat-mini {
        min-width: 80px;
        flex: 0 0 auto;
    }
}

@media (max-width: 600px) {
    .tp-stats-row {
        padding: 0 var(--space-md);
    }

    .tp-stats-flex {
        gap: 2px;
        padding: 10px 12px;
    }

    .tp-stat-mini {
        padding: 6px 8px;
        min-width: 60px;
    }

    .tp-stat-mini-icon svg {
        width: 18px;
        height: 18px;
    }

    .tp-stat-mini-value {
        font-size: 1rem;
    }

    .tp-stat-mini-label {
        font-size: 0.5rem;
    }
}

@media (max-width: 1024px) {
    .tp-stats-track .tp-stat-card {
        flex: 0 0 260px !important;
        width: 260px !important;
        min-width: 260px !important;
        max-width: 260px !important;
    }

    .tp-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tp-stats-track .tp-stat-card {
        flex: 0 0 240px !important;
        width: 240px !important;
        min-width: 240px !important;
        max-width: 240px !important;
    }

    .tp-stats-grid {
        grid-template-columns: 1fr;
    }
}

.tp-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--stat-color, var(--brand-blue)), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.tp-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.tp-stat-card:hover::before {
    opacity: 1;
}

.tp-stat-card--inmuebles { --stat-color: #3B82F6; }
.tp-stat-card--muebles { --stat-color: #F59E0B; }
.tp-stat-card--vehiculos { --stat-color: #10B981; }
.tp-stat-card--historicos { --stat-color: #E73C1E; }

.tp-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    background: linear-gradient(135deg, rgba(var(--stat-color-rgb, 59, 130, 246), 0.15), rgba(var(--stat-color-rgb, 59, 130, 246), 0.05));
}

.tp-stat-card--inmuebles .tp-stat-icon { background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05)); }
.tp-stat-card--muebles .tp-stat-icon { background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05)); }
.tp-stat-card--vehiculos .tp-stat-icon { background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05)); }
.tp-stat-card--historicos .tp-stat-icon { background: linear-gradient(135deg, rgba(231, 60, 30, 0.15), rgba(231, 60, 30, 0.05)); }

.tp-stat-icon svg {
    width: 28px;
    height: 28px;
}

.tp-stat-card--inmuebles .tp-stat-icon svg { color: #3B82F6; }
.tp-stat-card--muebles .tp-stat-icon svg { color: #F59E0B; }
.tp-stat-card--vehiculos .tp-stat-icon svg { color: #10B981; }
.tp-stat-card--historicos .tp-stat-icon svg { color: #E73C1E; }

.tp-stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.tp-stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   7. MAIN CONTENT
   ============================================ */
.tp-main {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-xl) var(--space-xl) var(--space-3xl);
}

/* ============================================
   8. NAVIGATION TABS
   ============================================ */
.tp-nav {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 6px;
    margin-bottom: var(--space-lg);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tp-nav-item {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
}

.tp-nav-item:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
}

.tp-nav-item.active {
    background: var(--brand-blue);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(28, 48, 82, 0.25);
}

[data-theme="dark"] .tp-nav-item.active {
    background: var(--ui-interaction);
}

.tp-nav-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.tp-nav-item-count {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: #e73c1e;
    color: white;
    margin-left: var(--space-xs);
}

/* Ocultar badges con valor 0 */
.tp-nav-item-count:empty,
.tp-nav-item-count[data-count="0"] {
    display: none;
}

.tp-nav-item.active .tp-nav-item-count {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--brand-red) !important;
}

/* ============================================
   9. TABLE PANEL
   ============================================ */
.tp-panel {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tp-panel.active {
    display: block;
}

.tp-panel-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.tp-panel-title {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.tp-panel-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tp-panel-title-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
}

.tp-panel-title-icon svg {
    width: 20px;
    height: 20px;
    color: var(--ui-interaction);
}

.tp-panel-actions {
    display: flex;
    gap: var(--space-sm);
}

.tp-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid transparent;
}

.tp-btn-primary {
    background: var(--brand-blue);
    color: #FFFFFF;
}

.tp-btn-primary:hover {
    background: #2a4a7a;
    transform: translateY(-1px);
}

.tp-btn-secondary {
    background: transparent;
    border-color: var(--card-border);
    color: var(--text-primary);
}

.tp-btn-secondary:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--ui-interaction);
}

.tp-btn svg {
    width: 16px;
    height: 16px;
}

.tp-panel-body {
    padding: var(--space-xl);
}

/* ============================================
   10. DATATABLES STYLING
   ============================================ */
.tp-table-wrapper {
    overflow-x: auto;
    margin: 0 calc(var(--space-xl) * -1);
    padding: 0 var(--space-xl);
}

table.dataTable {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

table.dataTable thead th {
    background: var(--bg-app);
    color: var(--text-primary);
    font-weight: 600;
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    border-bottom: 2px solid var(--card-border);
    white-space: nowrap;
    position: relative;
}

[data-theme="dark"] table.dataTable thead th {
    background: rgba(28, 48, 82, 0.5);
    border-bottom-color: rgba(59, 130, 246, 0.2);
}

table.dataTable thead th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

table.dataTable thead th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

table.dataTable tbody tr {
    transition: background var(--transition-fast);
}

table.dataTable tbody tr:hover {
    background: rgba(59, 130, 246, 0.05) !important;
}

[data-theme="dark"] table.dataTable tbody tr:hover {
    background: rgba(59, 130, 246, 0.12) !important;
}

table.dataTable tbody td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
    vertical-align: middle;
}

[data-theme="dark"] table.dataTable tbody td {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

table.dataTable tbody tr:last-child td {
    border-bottom: none;
}

/* Formato de valores monetarios */
table.dataTable tbody td.valor-cell {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    color: var(--ui-success);
}

/* Footer con búsqueda */
table.dataTable tfoot th {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-app);
    border-top: 1px solid var(--card-border);
}

[data-theme="dark"] table.dataTable tfoot th {
    background: rgba(28, 48, 82, 0.3);
}

table.dataTable tfoot input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    transition: all var(--transition-base);
}

table.dataTable tfoot input:focus {
    outline: none;
    border-color: var(--ui-interaction);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

table.dataTable tfoot input::placeholder {
    color: var(--text-tertiary);
}

[data-theme="dark"] table.dataTable tfoot input {
    background: rgba(28, 48, 82, 0.5);
    border-color: rgba(59, 130, 246, 0.2);
}

/* DataTables controls */
.dataTables_wrapper {
    color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin: var(--space-md) 0;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    margin-left: var(--space-sm);
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    outline: none;
    border-color: var(--ui-interaction);
}

[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background: rgba(28, 48, 82, 0.5);
    border-color: rgba(59, 130, 246, 0.2);
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: var(--space-sm) var(--space-md) !important;
    margin: 0 2px !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--card-bg) !important;
    color: var(--text-secondary) !important;
    transition: all var(--transition-base) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--ui-interaction) !important;
    color: var(--ui-interaction) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--brand-blue) !important;
    border-color: var(--brand-blue) !important;
    color: #FFFFFF !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--ui-interaction) !important;
    border-color: var(--ui-interaction) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* DataTables buttons */
.dt-buttons {
    margin-bottom: var(--space-md);
}

.dt-buttons .dt-button {
    padding: var(--space-sm) var(--space-md) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    font-weight: 500 !important;
    transition: all var(--transition-base) !important;
    margin-right: var(--space-sm) !important;
}

.dt-buttons .dt-button:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--ui-interaction) !important;
}

[data-theme="dark"] .dt-buttons .dt-button {
    background: rgba(28, 48, 82, 0.5) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
}

/* ============================================
   11. FOOTER
   ============================================ */
.tp-footer {
    background: var(--brand-blue);
    color: rgba(255, 255, 255, 0.9);
    padding: var(--space-2xl) var(--space-xl);
    margin-top: var(--space-3xl);
}

.tp-footer-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
}

.tp-footer-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.tp-footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.tp-footer-logo .e { color: #FFFFFF; }
.tp-footer-logo .dot { color: var(--brand-red); }

.tp-footer-copy {
    font-size: 0.875rem;
    opacity: 0.8;
}

.tp-footer-links {
    display: flex;
    gap: var(--space-lg);
}

.tp-footer-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-base);
}

.tp-footer-link:hover {
    color: #FFFFFF;
}

.tp-footer-legal {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.tp-footer-legal a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color var(--transition-base);
}

.tp-footer-legal a:hover {
    color: #FFFFFF;
}

/* ============================================
   12. EMPTY STATE
   ============================================ */
.tp-empty {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.tp-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-empty-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-tertiary);
}

.tp-empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.tp-empty-text {
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================
   13. LOADING STATES
   ============================================ */
.tp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
}

.tp-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--card-border);
    border-top-color: var(--ui-interaction);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   14. ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

/* Staggered animations for cards */
.tp-stat-card:nth-child(1) { animation: fadeInUp 0.5s ease-out 0.1s backwards; }
.tp-stat-card:nth-child(2) { animation: fadeInUp 0.5s ease-out 0.2s backwards; }
.tp-stat-card:nth-child(3) { animation: fadeInUp 0.5s ease-out 0.3s backwards; }
.tp-stat-card:nth-child(4) { animation: fadeInUp 0.5s ease-out 0.4s backwards; }

/* ============================================
   15. RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    :root {
        --space-xl: 24px;
        --space-2xl: 32px;
        --space-3xl: 48px;
    }

    .tp-header-inner {
        padding: 0 var(--space-md);
    }

    .tp-logo-text {
        display: none;
    }

    .tp-hero {
        min-height: 35vh;
        padding: var(--space-2xl) var(--space-md);
    }

    .tp-hero-title {
        font-size: 1.75rem;
    }

    .tp-stats {
        padding: 0 var(--space-md);
    }

    .tp-main {
        padding: var(--space-2xl) var(--space-md);
    }

    .tp-nav {
        flex-direction: column;
        padding: 4px;
    }

    .tp-nav-item {
        justify-content: flex-start;
        padding: 10px 12px;
    }

    .tp-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tp-panel-body {
        padding: var(--space-md);
    }

    .tp-table-wrapper {
        margin: 0 calc(var(--space-md) * -1);
        padding: 0 var(--space-md);
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.8125rem;
    }

    .tp-footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .tp-footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================
   16. PRINT STYLES
   ============================================ */
@media print {
    .tp-header,
    .tp-theme-toggle,
    .tp-nav,
    .tp-footer,
    .dt-buttons,
    .dataTables_filter,
    .dataTables_length,
    .dataTables_paginate {
        display: none !important;
    }

    .tp-hero {
        min-height: auto;
        padding: var(--space-lg);
        background: var(--brand-blue) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tp-panel {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: var(--space-lg);
    }

    table.dataTable {
        font-size: 10pt;
    }
}

/* ============================================
   17. ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible */
.tp-nav-item:focus-visible,
.tp-btn:focus-visible,
.tp-theme-toggle:focus-visible {
    outline: 2px solid var(--ui-interaction);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --card-border: currentColor;
    }

    .tp-nav-item.active {
        outline: 2px solid currentColor;
    }
}

/* ============================================
   18. SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}
