:root {
    --ct-bg-main: #f0f4f8; /* Azul muy pálido, casi blanco ártico */
    --ct-bg-card: rgba(255, 255, 255, 0.7);
    --ct-bg-header: rgba(255, 255, 255, 0.8);
    --ct-primary: #57a5ff; /* Azul Swimming */
    --ct-accent: #2d3436; /* Gris Grafito */
    --ct-text: #1a1a1b;
    --ct-text-muted: #636e72;
    --ct-border: rgba(255, 255, 255, 0.3);
    --ct-table-hover: rgba(87, 165, 255, 0.05);
    --ct-success: #00b894;
    --ct-warning: #fdcb6e;
    --swimming-gradient: linear-gradient(135deg, #57a5ff 0%, #a29bfe 100%);
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

@keyframes waveBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(-45deg, #f0f4f8, #e6eff7, #ffffff, #d9e9f9);
    background-size: 400% 400%;
    animation: waveBG 20s ease infinite;
    color: var(--ct-text);
    margin: 0;
    padding: 0;
    letter-spacing: -0.01em;
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-thumb {
    background: var(--ct-primary);
    border-radius: 10px;
    border: 2px solid #f0f4f8;
}
::-webkit-scrollbar-thumb:hover {
    background: #4189e0;
}

.main-wrapper {
    padding: 25px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Glassmorphism Card Classes */
.glass-card {
    background: var(--ct-bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    box-shadow: var(--glass-shadow);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

.glass-card:hover::before {
    left: 100%;
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(87, 165, 255, 0.15);
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--ct-primary);
}

/* Breadcrumbs */
.breadcrumb-container {
    font-size: 0.9rem;
    color: var(--ct-text-muted);
    margin-bottom: 24px;
}

.breadcrumb-container a {
    color: var(--ct-primary);
    text-decoration: none;
    font-weight: 500;
}

h1.page-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--ct-accent);
    margin-bottom: 5px;
    letter-spacing: -0.02em;
}

/* Filter bar */
.filter-section {
    background: var(--ct-bg-card);
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--ct-border);
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
    min-width: 350px;
}

.search-input-wrapper input {
    padding-left: 50px;
    border-radius: 14px;
    border: 1px solid var(--ct-border);
    height: 54px;
    background-color: #f9fafb;
    color: var(--ct-text);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.search-input-wrapper input:focus {
    background-color: #fff;
    border-color: var(--ct-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.search-input-wrapper::before {
    content: "🔍";
    position: absolute;
    left: 18px;
    top: 15px;
    font-size: 1.2rem;
    opacity: 0.4;
}

.filter-select {
    border-radius: 14px;
    border: 1px solid var(--ct-border);
    padding: 0 20px;
    height: 54px;
    font-size: 0.95rem;
    background-color: #f9fafb;
    color: var(--ct-text);
    min-width: 180px;
    outline: none;
    cursor: pointer;
}

.btn-add-causa {
    background-color: var(--ct-primary);
    color: white;
    border-radius: 14px;
    font-weight: 700;
    padding: 0 30px;
    border: none;
    height: 54px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-causa:hover {
    background-color: #1e40af;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Table Styles */
.causas-table-container {
    background: var(--ct-bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--ct-border);
}

.causas-table thead th {
    background-color: #f9fafb;
    color: var(--ct-text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 20px 24px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--ct-border);
}

.causas-table tbody td {
    padding: 22px 24px;
    font-size: 1rem;
    border-bottom: 1px solid var(--ct-border);
    vertical-align: middle;
    color: var(--ct-text);
    transition: background 0.2s ease;
}

.causas-table tbody tr {
    border-left: 3px solid transparent;
    transition: border-left-color 0.2s ease, background-color 0.2s ease;
}

.causas-table tbody tr:last-child td {
    border-bottom: none;
}

.causas-table tbody tr:hover {
    background-color: rgba(87, 165, 255, 0.06);
    border-left-color: var(--ct-primary);
}

/* Empty state */
.causas-empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 4rem 2rem; gap: 0.75rem; text-align: center;
    color: var(--ct-text-muted);
}
.causas-empty-state svg { opacity: 0.25; margin-bottom: 0.5rem; }
.causas-empty-state p { font-size: 1rem; font-weight: 500; }

.btn-options {
    background: #f1f5f9;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ct-text);
    transition: all 0.2s;
}

.btn-options:hover {
    background: var(--ct-primary);
    color: white;
}

/* Detail View Section */
#detallesCausa {
    display: none;
    background-color: var(--ct-bg-main);
    min-height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1050;
}

.detail-header {
    background-color: white;
    padding: 24px 60px 20px 60px;
    border-bottom: 1px solid var(--ct-border);
}

.detail-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.case-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--ct-accent);
    letter-spacing: -0.03em;
    margin: 5px 0;
}

.case-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.case-meta .glass-card {
    background: #f9fafb;
    box-shadow: none;
    border: 1px solid var(--ct-border);
    padding: 12px 18px !important;
    border-radius: 18px;
}

.case-meta div strong {
    color: var(--ct-text-muted);
    display: block;
    margin-bottom: 2px;
    text-transform: uppercase;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.case-meta div span {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Tabs Styles */
.ct-tabs {
    background: white;
    border-bottom: 1px solid var(--ct-border);
    padding: 0 60px;
    display: flex;
    gap: 45px;
}

.ct-tab-item {
    padding: 24px 0;
    font-weight: 700;
    color: var(--ct-text-muted);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    font-size: 1rem;
    transition: color 0.2s;
}

.ct-tab-item:hover {
    color: var(--ct-text);
}

.ct-tab-item.active {
    color: var(--ct-primary);
}

.ct-tab-item.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--ct-primary);
    border-radius: 4px 4px 0 0;
}

/* TAB CONTENT VISIBILITY FIX */
.tab-pane-content {
    display: none;
    padding: 40px 60px;
}

.tab-pane-content.active {
    display: block;
}

/* Modals CT Styles */
.modal-content {
    border-radius: 24px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-ct-header {
    padding: 30px 30px 20px 30px;
    border: none;
}

.btn-ct-blue {
    background-color: var(--ct-primary);
    border: none;
    padding: 14px 40px;
    font-weight: 700;
    border-radius: 16px;
    color: white;
}

.btn-ct-cancel {
    background: #f1f5f9;
    border: none;
    color: var(--ct-text);
    padding: 14px 25px;
    border-radius: 16px;
    font-weight: 600;
}

.form-control,
.form-select {
    background-color: #f9fafb;
    border: 1px solid var(--ct-border);
    color: var(--ct-text);
    padding: 14px;
    border-radius: 14px;
}

.form-control:focus {
    background-color: #fff;
    border-color: var(--ct-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Utils */
.sync-badge {
    color: var(--ct-accent);
    background: #ecfdf5;
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
}

.ct-toast {
    position: fixed;
    bottom: 40px;
    right: 40px;
    background: white;
    border-left: 6px solid var(--ct-primary);
    padding: 20px 30px;
    border-radius: 18px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: none;
    z-index: 9999;
    font-weight: 600;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card .icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(87, 165, 255, 0.1);
    color: var(--ct-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.stat-card .stat-info {
    display: flex;
    flex-direction: column;
}

.stat-card .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ct-accent);
    line-height: 1.1;
    margin-bottom: 0;
}

.stat-card .label {
    font-size: 0.7rem;
    color: var(--ct-text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card::after {
    content: "";
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: var(--swimming-gradient);
    opacity: 0.03;
    border-radius: 50%;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}
