/* ============================================================
   GITRIM - Design System
   ============================================================ */

/* === Variables === */
:root {
    --color-primario: #0e459a;
    --color-primario-oscuro: #0a3470;
    --color-primario-claro: #e8f0fe;
    --color-secundario: #f8f9fa;
    --color-exito: #28a745;
    --color-exito-bg: #d4edda;
    --color-advertencia: #ffc107;
    --color-advertencia-bg: #fff3cd;
    --color-error: #dc3545;
    --color-error-bg: #f8d7da;
    --color-info: #17a2b8;
    --color-info-bg: #d1ecf1;
    --color-texto: #333;
    --color-texto-claro: #6c757d;
    --color-borde: #dee2e6;
    --color-fondo: #f0f2f5;
    --sidebar-ancho: 250px;
    --sidebar-ancho-collapsed: 60px;
    --navbar-altura: 56px;
    --radius: 8px;
    --sombra: 0 1px 3px rgba(0,0,0,0.08);
    --sombra-lg: 0 4px 12px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

/* === Dark Mode === */
.dark-mode {
    --color-primario: #4a9eff;
    --color-primario-oscuro: #3a7fd4;
    --color-primario-claro: rgba(74, 158, 255, 0.15);
    --color-secundario: #1e2a3a;
    --color-exito: #34d399;
    --color-exito-bg: rgba(52, 211, 153, 0.15);
    --color-advertencia: #fbbf24;
    --color-advertencia-bg: rgba(251, 191, 36, 0.15);
    --color-error: #f87171;
    --color-error-bg: rgba(248, 113, 113, 0.15);
    --color-info: #38bdf8;
    --color-info-bg: rgba(56, 189, 248, 0.15);
    --color-texto: #e2e8f0;
    --color-texto-claro: #94a3b8;
    --color-borde: #2d3d50;
    --color-fondo: #0f1923;
    --sombra: 0 1px 3px rgba(0,0,0,0.3);
    --sombra-lg: 0 4px 12px rgba(0,0,0,0.4);
}
.dark-mode .navbar {
    background: #1a2332;
}
.dark-mode .sidebar {
    background: #152030;
}
.dark-mode .card,
.dark-mode .stat-card {
    background: #1a2a3c;
}
.dark-mode .table th {
    background: #1e2a3a;
}
.dark-mode .table-striped tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.03);
}
.dark-mode .form-control {
    background: #152030;
    color: var(--color-texto);
}
.dark-mode .form-control:focus {
    background: #1a2a3c;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}
.dark-mode .card-footer {
    background: #152030;
}
.dark-mode .menu-tooltip {
    background: #2d3d50;
}
.dark-mode .menu-tooltip::before {
    border-right-color: #2d3d50;
}
.dark-mode .badge-success { color: #34d399; }
.dark-mode .badge-warning { color: #fbbf24; }
.dark-mode .badge-danger { color: #f87171; }
.dark-mode .badge-info { color: #38bdf8; }
.dark-mode .badge-secondary { background: #2d3d50; color: #94a3b8; }
.dark-mode .alert-success { color: #34d399; border-color: rgba(52,211,153,0.3); }
.dark-mode .alert-danger { color: #f87171; border-color: rgba(248,113,113,0.3); }
.dark-mode .alert-warning { color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.dark-mode .alert-info { color: #38bdf8; border-color: rgba(56,189,248,0.3); }
.dark-mode .btn-outline {
    border-color: var(--color-borde);
    color: var(--color-texto);
}
.dark-mode .btn-outline:hover {
    background: rgba(255,255,255,0.05);
}
.dark-mode .pagination-link {
    color: var(--color-texto);
    border-color: var(--color-borde);
}

/* Dark mode toggle button */
.btn-darkmode {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
    transition: all 0.2s ease;
}
.btn-darkmode:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}
.btn-darkmode .icon-moon { display: none; }
.dark-mode .btn-darkmode .icon-sun { display: none; }
.dark-mode .btn-darkmode .icon-moon { display: block; }

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.5;
    min-height: 100vh;
}
a { color: var(--color-primario); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* === Navbar === */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--navbar-altura);
    background: var(--color-primario);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: box-shadow 0.3s ease;
}
.navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.navbar-left { display: flex; align-items: center; gap: 0.75rem; }
.navbar-right { display: flex; align-items: center; }
.navbar-brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand-icon {
    width: 32px; height: 32px; border-radius: 6px;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.1rem;
}
.brand-logo-wrap {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 2px rgba(255,255,255,0.25) inset;
    flex-shrink: 0;
    overflow: hidden;
}
.brand-logo {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
.sidebar-toggle {
    background: none; border: none; color: #fff; cursor: pointer;
    padding: 0.4rem; border-radius: 4px; display: flex; align-items: center;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.15); }
.navbar-user { display: flex; align-items: center; gap: 0.6rem; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.7rem; opacity: 0.8; }
.btn-logout {
    color: rgba(255,255,255,0.7); padding: 0.4rem; border-radius: 4px;
    display: flex; align-items: center; margin-left: 0.5rem;
}
.btn-logout:hover { color: #fff; background: rgba(255,255,255,0.15); text-decoration: none; }

/* === Hamburger Icon === */
.hamburger-icon {
    width: 20px;
    height: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}
body.sidebar-collapsed .hamburger-icon span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    width: 12px;
}
body.sidebar-collapsed .hamburger-icon span:nth-child(2) {
    transform: translateX(2px);
}
body.sidebar-collapsed .hamburger-icon span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    width: 12px;
}

/* === Sidebar === */
.sidebar {
    position: fixed; top: var(--navbar-altura); left: 0; bottom: 0;
    width: var(--sidebar-ancho);
    background: #fff;
    border-right: 1px solid var(--color-borde);
    display: flex; flex-direction: column;
    z-index: 900;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-menu { flex: 1; padding: 0.75rem 0; }
.menu-group-label {
    padding: 1rem 1.25rem 0.4rem;
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase;
    color: var(--color-texto-claro);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, padding 0.3s ease;
}
.menu-item {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.6rem 1.25rem;
    color: var(--color-texto);
    font-size: 0.9rem;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
.menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--color-primario-claro);
    transition: width 0.25s ease;
    z-index: -1;
}
.menu-item:hover::before { width: 100%; }
.menu-item:hover { color: var(--color-primario); text-decoration: none; }
.menu-item.active {
    background: var(--color-primario-claro);
    color: var(--color-primario);
    font-weight: 600;
    border-left-color: var(--color-primario);
    animation: activeIndicator 0.3s ease;
}
.menu-item svg, .menu-item i { flex-shrink: 0; }
.menu-item span { transition: opacity 0.2s ease; }

/* Sidebar tooltip (hidden by default) */
.menu-tooltip {
    display: none;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.78rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1001;
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.menu-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #333;
}

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--color-borde);
    color: var(--color-texto-claro);
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease;
}
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 899;
}

/* === Sidebar Collapsed State (desktop only) === */
.sidebar.collapsed {
    width: var(--sidebar-ancho-collapsed);
}
.sidebar.collapsed .menu-group-label {
    opacity: 0;
    padding: 0.5rem;
    height: 0;
    overflow: hidden;
}
.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 0.7rem 0;
    border-left-color: transparent;
    gap: 0;
}
.sidebar.collapsed .menu-item span:not(.menu-tooltip) {
    opacity: 0;
    width: 0;
    overflow: hidden;
}
.sidebar.collapsed .menu-item:hover .menu-tooltip {
    display: block;
}
.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    height: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

/* === Main Content === */
.main-content {
    margin-left: var(--sidebar-ancho);
    margin-top: var(--navbar-altura);
    padding: 1.5rem;
    min-height: calc(100vh - var(--navbar-altura));
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-ancho-collapsed);
}
.content-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.content-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--color-texto); }

/* === Cards === */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--sombra);
    border: 1px solid var(--color-borde);
    margin-bottom: 1rem;
}
.card-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--color-borde);
    font-weight: 600; font-size: 1rem;
    display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 1.25rem; }
.card-footer {
    padding: 0.9rem 1.25rem;
    border-top: 1px solid var(--color-borde);
    background: var(--color-secundario);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--color-primario); color: #fff; }
.btn-primary:hover { background: var(--color-primario-oscuro); color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-success { background: var(--color-exito); color: #fff; }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-warning { background: var(--color-advertencia); color: #333; }
.btn-info { background: var(--color-info); color: #fff; }
.btn-outline {
    background: transparent; border-color: var(--color-borde); color: var(--color-texto);
}
.btn-outline:hover { background: var(--color-secundario); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.btn-lg { padding: 0.7rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 0.4rem; }

/* === Tables === */
.table-responsive { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse;
    font-size: 0.85rem;
}
.table th, .table td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--color-borde);
}
.table th {
    background: var(--color-secundario);
    font-weight: 600;
    color: var(--color-texto-claro);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
}
.table-striped tbody tr:nth-child(even) { background: #fafbfc; }
.table tbody tr:hover { background: var(--color-primario-claro); }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.3rem; font-weight: 600; font-size: 0.85rem; color: var(--color-texto); }
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-borde);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--color-texto);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primario);
    box-shadow: 0 0 0 3px rgba(14,69,154,0.1);
}
.form-control::placeholder { color: #adb5bd; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text { font-size: 0.78rem; color: var(--color-texto-claro); margin-top: 0.2rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-col { min-width: 0; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.73rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-success { background: var(--color-exito-bg); color: #155724; }
.badge-warning { background: var(--color-advertencia-bg); color: #856404; }
.badge-danger { background: var(--color-error-bg); color: #721c24; }
.badge-info { background: var(--color-info-bg); color: #0c5460; }
.badge-secondary { background: #e9ecef; color: #495057; }
.badge-primary { background: var(--color-primario-claro); color: var(--color-primario); }

/* === Alerts === */
.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.88rem;
    border: 1px solid transparent;
    animation: fadeIn 0.3s ease;
}
.alert-success { background: var(--color-exito-bg); color: #155724; border-color: #c3e6cb; }
.alert-danger { background: var(--color-error-bg); color: #721c24; border-color: #f5c6cb; }
.alert-warning { background: var(--color-advertencia-bg); color: #856404; border-color: #ffeaa7; }
.alert-info { background: var(--color-info-bg); color: #0c5460; border-color: #bee5eb; }

/* === Stats Grid (Dashboard) === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--color-borde);
    box-shadow: var(--sombra);
    display: flex; flex-direction: column;
}
.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.stat-card-icon {
    width: 40px; height: 40px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.stat-card-icon.blue { background: var(--color-primario-claro); color: var(--color-primario); }
.stat-card-icon.green { background: var(--color-exito-bg); color: var(--color-exito); }
.stat-card-icon.yellow { background: var(--color-advertencia-bg); color: #b8860b; }
.stat-card-icon.red { background: var(--color-error-bg); color: var(--color-error); }
.stat-number { font-size: 1.8rem; font-weight: 700; color: var(--color-texto); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--color-texto-claro); margin-top: 0.3rem; }

/* === Pagination === */
.pagination { display: flex; gap: 0.3rem; margin-top: 1rem; justify-content: center; }
.pagination-link {
    padding: 0.4rem 0.75rem; border: 1px solid var(--color-borde);
    border-radius: 6px; font-size: 0.85rem; color: var(--color-texto);
    text-decoration: none;
}
.pagination-link:hover { background: var(--color-primario-claro); text-decoration: none; }
.pagination-link.active { background: var(--color-primario); color: #fff; border-color: var(--color-primario); }

/* === Empty State === */
.empty-state {
    text-align: center; padding: 3rem 1rem; color: var(--color-texto-claro);
}
.empty-state svg { margin-bottom: 1rem; opacity: 0.5; }
.empty-state p { font-size: 1rem; margin-bottom: 1rem; }

/* === Login Page === */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-45deg, #0e459a, #0a3470, #061f40, #1a5fc9);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
.login-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}
.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    position: relative;
    z-index: 1;
    animation: cardEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.login-card.login-shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.login-header { text-align: center; margin-bottom: 2.25rem; }
.login-logo {
    width: 64px; height: 64px; border-radius: 16px;
    background: linear-gradient(135deg, var(--color-primario) 0%, #1a5fc9 100%);
    color: #fff; font-size: 1.8rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
    animation: logoPulse 2.5s ease-in-out infinite;
    box-shadow: 0 8px 24px rgba(14, 69, 154, 0.35);
}
.login-header h1 {
    font-size: 1.6rem;
    color: var(--color-texto);
    margin-bottom: 0.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.login-header p {
    color: var(--color-texto-claro);
    font-size: 0.88rem;
    line-height: 1.4;
}
.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.75rem;
    color: var(--color-texto-claro);
}

/* Login floating labels */
.form-group-float {
    position: relative;
    margin-bottom: 1.25rem;
}
.form-group-float .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.form-group-float .input-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #b0b8c4;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 2;
    display: flex;
}
.form-group-float:focus-within .input-icon {
    color: var(--color-primario);
}
.form-control-float {
    width: 100%;
    padding: 1.05rem 0.9rem 0.55rem 2.75rem;
    border: 1.5px solid #e2e6ec;
    border-radius: 12px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--color-texto);
    background: #f8f9fb;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}
.form-control-float:hover {
    border-color: #c8cfd8;
    background: #f4f6f9;
}
.form-control-float:focus {
    border-color: var(--color-primario);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(14, 69, 154, 0.08);
}
.form-label-float {
    position: absolute;
    left: 2.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.88rem;
    color: #9ca3af;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    z-index: 2;
    line-height: 1;
}
.form-control-float:focus ~ .form-label-float,
.form-control-float.has-value ~ .form-label-float {
    top: 0.4rem;
    transform: translateY(0);
    font-size: 0.65rem;
    color: var(--color-primario);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.form-bar {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2.5px;
    background: linear-gradient(90deg, var(--color-primario), #1a5fc9);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 12px 12px;
}
.form-control-float:focus ~ .form-bar {
    width: calc(100% - 2px);
    left: 1px;
}

/* Login alert */
.login-card .alert {
    border-radius: 10px;
    font-size: 0.82rem;
    padding: 0.7rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Login button with shimmer */
.btn-login {
    background: linear-gradient(135deg, var(--color-primario), #1a5fc9);
    color: #fff;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.85rem 1.5rem;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 15px rgba(14, 69, 154, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-login::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-login:hover::after {
    left: 100%;
}
.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 69, 154, 0.4);
    color: #fff;
    opacity: 1;
}
.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(14, 69, 154, 0.3);
}

/* === Utilities === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-texto-claro); }
.text-success { color: var(--color-exito); }
.text-danger { color: var(--color-error); }
.text-primary { color: var(--color-primario); }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* === Page Transitions === */
.main-content.page-leaving {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.main-content.page-entering {
    animation: pageEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Top loading bar */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #6db3f2, #fff, #6db3f2);
    background-size: 200% 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 0 2px 2px 0;
}
.page-loader.active {
    opacity: 1;
    animation: loaderProgress 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards,
               loaderShimmer 1s linear infinite;
}
.page-loader.done {
    width: 100% !important;
    opacity: 0;
    transition: width 0.15s ease, opacity 0.3s ease 0.15s;
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-8px); }
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes loaderProgress {
    0% { width: 0; }
    30% { width: 45%; }
    60% { width: 70%; }
    100% { width: 90%; }
}
@keyframes loaderShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes cardEntrance {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-6px); }
    30%, 70% { transform: translateX(6px); }
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(14,69,154,0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(14,69,154,0.2); }
}
@keyframes activeIndicator {
    from { border-left-width: 0; }
    to { border-left-width: 3px; }
}

/* === Modal de progreso (OCR/IA) === */
.rdvc-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 25, 35, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.rdvc-modal.open {
    display: flex;
    animation: fadeIn 0.25s ease;
}
.rdvc-modal__box {
    width: min(420px, 90vw);
    background: var(--color-fondo, #fff);
    color: var(--color-texto);
    border: 1px solid var(--color-borde);
    border-radius: 14px;
    padding: 2rem 1.75rem 1.6rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: cardEntrance 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
/* Variante grande para contenido embebido (p. ej. vista previa de PDF) */
.rdvc-modal__box--lg {
    width: min(1000px, 96vw);
    height: 92vh;
    padding: 0;
    text-align: left;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.rep-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--color-borde);
    background: var(--color-primario-claro);
}
.rep-preview-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.rep-preview-body {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #525659; /* gris visor PDF */
}
.rep-preview-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
}
.rep-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
}
.rdvc-modal__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 0.25rem;
}
.rdvc-modal__sub {
    font-size: 0.8rem;
    color: var(--color-texto-claro);
    margin: 0 0 1.25rem;
    min-height: 1.1em;
}

/* Spinner circular elegante (anillo doble) */
.rdvc-spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    position: relative;
}
.rdvc-spinner::before,
.rdvc-spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
}
.rdvc-spinner::before {
    border-top-color: var(--color-primario);
    border-right-color: var(--color-primario);
    animation: rdvcSpin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}
.rdvc-spinner::after {
    inset: 10px;
    border-bottom-color: var(--color-primario-claro);
    border-left-color: var(--color-primario-claro);
    animation: rdvcSpin 1.4s linear infinite reverse;
}

/* Pasos del pipeline */
.rdvc-steps {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    text-align: left;
}
.rdvc-steps li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.82rem;
    padding: 0.32rem 0;
    color: var(--color-texto-claro);
    transition: color 0.3s ease;
}
.rdvc-steps li .rdvc-dot {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border-radius: 50%;
    border: 2px solid var(--color-borde);
    position: relative;
    transition: all 0.3s ease;
}
.rdvc-steps li.active {
    color: var(--color-texto);
    font-weight: 500;
}
.rdvc-steps li.active .rdvc-dot {
    border-color: var(--color-primario);
    box-shadow: 0 0 0 4px var(--color-primario-claro);
    animation: rdvcPulse 1.1s ease-in-out infinite;
}
.rdvc-steps li.done {
    color: var(--color-texto);
}
.rdvc-steps li.done .rdvc-dot {
    border-color: var(--color-primario);
    background: var(--color-primario);
}
.rdvc-steps li.done .rdvc-dot::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
@keyframes rdvcSpin {
    to { transform: rotate(360deg); }
}
@keyframes rdvcPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--color-primario-claro); }
    50% { box-shadow: 0 0 0 6px var(--color-primario-claro); }
}

/* === Editor del texto OCR === */
.ocr-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: wrap;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--color-borde);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: var(--color-primario-claro);
}
.ocr-tbtn {
    min-width: 28px;
    height: 26px;
    padding: 0 0.45rem;
    font-size: 0.78rem;
    line-height: 1;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--color-texto);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.ocr-tbtn:hover {
    background: #fff;
    border-color: var(--color-borde);
}
.ocr-tsep {
    width: 1px;
    height: 18px;
    margin: 0 0.25rem;
    background: var(--color-borde);
}
.ocr-editor {
    border-radius: 0 0 6px 6px !important;
    background: #fff;
    cursor: text;
}
.ocr-editor:focus {
    outline: none;
    border-color: var(--color-primario);
}
.ocr-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--color-texto-claro);
}
.ocr-editor h2, .ocr-editor h3, .ocr-editor h4 { margin: 0.4rem 0 0.2rem; }
.ocr-editor ul, .ocr-editor ol { margin: 0.2rem 0 0.2rem 1.2rem; }
.ocr-editor p { margin: 0 0 0.4rem; }

/* === Splash Screen === */
.splash-screen.splash-standalone {
    min-height: 100vh;
    background: linear-gradient(-45deg, #0e459a, #0a3470, #061f40, #1a5fc9);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}
.splash-content {
    text-align: center;
    animation: splashEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.splash-logo {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 3rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.75rem;
    animation: splashLogoPulse 2.5s ease-in-out infinite;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}
.splash-title {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    margin-bottom: 0.6rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.splash-desc {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}
.btn-splash-enter {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}
.btn-splash-enter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: splashBtnShimmer 3s ease-in-out infinite;
}
.btn-splash-enter:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}
.btn-splash-enter:active {
    transform: translateY(0);
}
.btn-splash-enter svg {
    transition: transform 0.3s ease;
}
.btn-splash-enter:hover svg {
    transform: translateX(4px);
}
.splash-version {
    display: block;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

@keyframes splashEntrance {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes splashLogoPulse {
    0%, 100% { box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(255,255,255,0.2); }
    50% { box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3), 0 0 30px 10px rgba(255,255,255,0.1); }
}
@keyframes splashBtnShimmer {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-ancho) !important;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar.collapsed {
        width: var(--sidebar-ancho) !important;
    }
    .sidebar.collapsed .menu-group-label {
        opacity: 1;
        padding: 1rem 1.25rem 0.4rem;
        height: auto;
    }
    .sidebar.collapsed .menu-item {
        justify-content: flex-start;
        padding: 0.6rem 1.25rem;
        gap: 0.7rem;
    }
    .sidebar.collapsed .menu-item span:not(.menu-tooltip) {
        opacity: 1;
        width: auto;
    }
    .sidebar.collapsed .sidebar-footer {
        opacity: 1;
        height: auto;
        padding: 0.75rem 1.25rem;
        border-top: 1px solid var(--color-borde);
    }
    .menu-tooltip { display: none !important; }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0 !important; }
    body.sidebar-collapsed .main-content { margin-left: 0; }
    .content-header { flex-direction: column; align-items: flex-start; }
    .user-info { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    /* Reset hamburger transform on mobile */
    body.sidebar-collapsed .hamburger-icon span:nth-child(1) { transform: none; width: 100%; }
    body.sidebar-collapsed .hamburger-icon span:nth-child(2) { transform: none; }
    body.sidebar-collapsed .hamburger-icon span:nth-child(3) { transform: none; width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    html { font-size: 13px; }
}

/* ============================================================
   Componente Selector de Contribuyente
   ============================================================ */
.comp-contribuyente {
    width: 100%;
}
.comp-contribuyente-display {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--color-borde);
    border-radius: var(--radius);
    padding: 10px 14px;
    background: var(--color-secundario);
    min-height: 56px;
    transition: border-color var(--transition);
}
.comp-contribuyente-display:hover {
    border-color: var(--color-primario);
}
.comp-contribuyente-icon {
    flex: 0 0 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primario-claro);
    color: var(--color-primario);
    border-radius: 50%;
}
.comp-contribuyente-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.comp-contribuyente-label {
    font-weight: 500;
    color: var(--color-texto);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comp-contribuyente-label:empty::after {
    content: 'Ningún contribuyente seleccionado';
    color: var(--color-texto-claro);
    font-weight: 400;
    font-style: italic;
}
.comp-contribuyente-sub {
    color: var(--color-texto-claro);
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comp-contribuyente-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
}
@media (max-width: 480px) {
    .comp-contribuyente-display {
        flex-wrap: wrap;
    }
    .comp-contribuyente-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
}
