:root {
    --primary: #0051A2;
    --primary-dark: #003670;
    --primary-light: #e6f0fa;
    --primary-glow: rgba(0, 81, 162, 0.15);
    --primary-rgb: 0, 81, 162;
    --accent: #0088cc;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --sidebar-width: 270px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow: 0 4px 6px rgba(0,0,0,.04), 0 2px 4px rgba(0,0,0,.04);
    --shadow-md: 0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.04);
    --shadow-lg: 0 20px 50px rgba(0,0,0,.12);
    --shadow-xl: 0 25px 60px rgba(0,0,0,.16);
    --transition: all .2s cubic-bezier(.4,0,.2,1);
    --transition-slow: all .35s cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0051A2 url('../img/FLOR-CAYENA.png') no-repeat center center fixed;
    background-size: 50%;
    color: var(--gray-800);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: .925rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: -1;
}
body::after {
    display: none;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5, h6 { color: var(--gray-900); font-weight: 700; letter-spacing: -.01em; }
h4 { font-size: 1.2rem; }

/* Buttons */
.btn {
    font-weight: 600; font-size: .875rem; padding: 8px 18px; border-radius: var(--radius-sm);
    transition: var(--transition); letter-spacing: .01em; border: 1.5px solid transparent;
}
.btn-primary { background: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; transform: translateY(-1px); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-outline-primary { color: var(--primary) !important; border-color: var(--primary) !important; background: transparent !important; }
.btn-outline-primary:hover { background: var(--primary) !important; color: white !important; }
.btn-success { background: var(--success) !important; border-color: var(--success) !important; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-warning { background: var(--warning) !important; border-color: var(--warning) !important; color: white !important; }
.btn-danger { background: var(--danger) !important; border-color: var(--danger) !important; }
.btn-sm { padding: 5px 12px; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-outline-warning, .btn-outline-info, .btn-outline-success, .btn-outline-danger {
    background: white !important; transition: var(--transition);
}

.bg-primary { background: var(--primary) !important; }
.text-primary { color: var(--primary) !important; }

/* Sidebar */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-width);
    background: linear-gradient(175deg, #001f3f 0%, #002952 30%, #003670 60%, var(--primary) 100%);
    color: white; z-index: 1030; overflow-y: auto;
    transition: var(--transition-slow);
    box-shadow: 4px 0 30px rgba(0,0,0,.2);
}
.sidebar::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at top left, rgba(255,255,255,.04) 0%, transparent 70%);
    pointer-events: none;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 22px; font-size: 1.3rem; font-weight: 800;
    border-bottom: 1px solid rgba(255,255,255,.1);
    letter-spacing: -.02em;
    position: relative; z-index: 1;
}
.sidebar .brand i {
    font-size: 1.6rem; color: rgba(255,255,255,.95);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}
.sidebar .brand span { background: linear-gradient(135deg, #fff, #cce4ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sidebar .nav { padding: 8px 0; position: relative; z-index: 1; }
.sidebar .nav-item { list-style: none; margin: 1px 8px; }
.sidebar .nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; color: rgba(255,255,255,.7);
    font-size: .875rem; transition: var(--transition);
    border-radius: var(--radius-sm); font-weight: 500;
    position: relative;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.1); color: white; }
.sidebar .nav-link.active {
    background: rgba(255,255,255,.18); color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.sidebar .nav-link i { width: 20px; text-align: center; font-size: .95rem; opacity: .85; }
.sidebar .nav-link.active i { opacity: 1; }
.sidebar .nav-section {
    padding: 16px 22px 6px; font-size: .65rem; text-transform: uppercase;
    color: rgba(255,255,255,.35); letter-spacing: 2px; font-weight: 700;
}

/* Content */
.content { margin-left: var(--sidebar-width); min-height: 100vh; transition: var(--transition-slow); }

/* Header */
.header {
    height: var(--header-height); background: rgba(255,255,255,.92);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; box-shadow: 0 1px 3px rgba(0,0,0,.12); position: sticky;
    top: 0; z-index: 1020; gap: 15px;
}
.header .header-left .menu-toggle { font-size: 1.4rem; cursor: pointer; color: var(--gray-600); transition: var(--transition); }
.header .header-left .menu-toggle:hover { color: var(--primary); }
.header .header-right { display: flex; align-items: center; gap: 18px; }
.header .user-menu { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); transition: var(--transition); }
.header .user-menu:hover { background: var(--gray-100); }
.header .user-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: .95rem; flex-shrink: 0;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.header .user-avatar img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.header .user-name { font-size: .875rem; font-weight: 600; color: var(--gray-800); }

.notification-bell { position: relative; cursor: pointer; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); transition: var(--transition); }
.notification-bell:hover { background: var(--gray-100); }
.notification-bell i { font-size: 1.2rem; color: var(--gray-500); }
.notification-bell .badge {
    position: absolute; top: 2px; right: 2px;
    font-size: .6rem; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
    background: var(--danger); border-radius: 10px; font-weight: 700;
    border: 2px solid white; padding: 0 5px;
}

/* Main */
.main-content { padding: 28px 24px; max-width: 1400px; }

/* Cards */
.card {
    background: white; border-radius: var(--radius-lg); border: 1px solid var(--gray-200);
    box-shadow: var(--shadow); margin-bottom: 24px; transition: var(--transition); overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    background: white; border-bottom: 1px solid var(--gray-100);
    padding: 16px 22px; font-weight: 700; font-size: .95rem;
    display: flex; align-items: center; justify-content: space-between;
    color: var(--gray-800);
}
.card-body { padding: 22px; }

/* Stat cards */
.stat-card {
    text-align: center; padding: 18px 12px; border-radius: var(--radius-lg);
    color: white; transition: var(--transition); position: relative; overflow: hidden;
    border: none;
}
.stat-card::before {
    content: ''; position: absolute; top: -20px; right: -20px;
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.stat-card::after {
    content: ''; position: absolute; bottom: -25px; left: -25px;
    width: 90px; height: 90px; border-radius: 50%;
    background: rgba(255,255,255,.04);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 8px; position: relative; z-index: 1; opacity: .9; }
.stat-card .stat-number { font-size: 1.8rem; font-weight: 800; position: relative; z-index: 1; letter-spacing: -.02em; }
.stat-card .stat-label { font-size: .7rem; opacity: .85; margin-top: 4px; position: relative; z-index: 1; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }

/* Badges */
.badge-status { font-size: .75rem; padding: 4px 14px; border-radius: 20px; font-weight: 600; letter-spacing: .01em; }
.badge-pendiente { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.badge-tomado { background: var(--info-light); color: #1e40af; border: 1px solid #93c5fd; }
.badge-cerrado { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }

/* Priority */
.priority-1 { color: var(--success); }
.priority-2 { color: var(--info); }
.priority-3 { color: var(--warning); }
.priority-4 { color: var(--danger); }

/* Timeline */
.timeline { position: relative; padding-left: 28px; margin-bottom: 0; }
.timeline::before {
    content: ''; position: absolute; left: 11px; top: 8px; bottom: 8px;
    width: 2px; background: linear-gradient(180deg, var(--primary) 0%, var(--gray-200) 100%);
    border-radius: 1px;
}
.timeline-item {
    position: relative; margin-bottom: 18px;
    padding: 16px 18px; background: var(--gray-50);
    border-radius: var(--radius); border: 1px solid var(--gray-100);
    transition: var(--transition);
}
.timeline-item:hover { background: white; box-shadow: var(--shadow-sm); }
.timeline-item::before {
    content: ''; position: absolute; left: -21px; top: 22px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); border: 2.5px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item .timeline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: .82rem; }
.timeline-item .timeline-header strong { color: var(--gray-800); }
.timeline-item .timeline-content { font-size: .9rem; color: var(--gray-600); line-height: 1.6; }

/* Pagination */
.pagination { gap: 3px; }
.page-link { color: var(--gray-600); border-radius: var(--radius-sm) !important; margin: 0; padding: 7px 14px; font-size: .875rem; font-weight: 500; border: 1px solid var(--gray-200); transition: var(--transition); }
.page-link:hover { background: var(--gray-100); color: var(--primary); border-color: var(--gray-300); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: white; font-weight: 600; }
.page-item.disabled .page-link { color: var(--gray-400); }

/* Tables */
.table { margin-bottom: 0; }
.table thead th {
    font-weight: 700; font-size: .78rem; color: var(--gray-500); border-top: none;
    padding: 14px 16px; background: var(--gray-50); text-transform: uppercase;
    letter-spacing: .04em; border-bottom: 2px solid var(--gray-200);
}
.table tbody td { padding: 12px 16px; font-size: .875rem; vertical-align: middle; border-color: var(--gray-100); }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table-hover > tbody > tr:hover { --bs-table-hover-bg: #f8fafc; }

/* Forms */
.form-control, .form-select {
    border-radius: var(--radius-sm); border: 1.5px solid var(--gray-300);
    font-size: .875rem; padding: 9px 14px; transition: var(--transition);
    background: white; color: var(--gray-800);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); outline: none;
}
.form-control::placeholder { color: var(--gray-400); }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: 5px; color: var(--gray-700); letter-spacing: .01em; }

/* Alerts */
.alert { border-radius: var(--radius); border: none; font-size: .875rem; padding: 14px 18px; font-weight: 500; }
.alert-success { background: var(--success-light); color: #065f46; }
.alert-error, .alert-danger { background: var(--danger-light); color: #991b1b; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-info { background: var(--info-light); color: #1e40af; }

/* Search */
.search-box { position: relative; }
.search-box input { padding-left: 38px; border-radius: var(--radius); }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: .9rem; }

/* Dropdown */
.dropdown-menu { border: 1px solid var(--gray-200); box-shadow: var(--shadow-md); border-radius: var(--radius); padding: 6px; min-width: 200px; }
.dropdown-item { border-radius: var(--radius-sm); padding: 8px 14px; font-size: .875rem; font-weight: 500; transition: var(--transition); }
.dropdown-item:hover { background: var(--gray-100); }
.dropdown-item i { color: var(--gray-500); }

/* Ticket list */
.ticket-list-item {
    display: flex; align-items: center; gap: 14px; padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100); transition: var(--transition); cursor: pointer;
}
.ticket-list-item:last-child { border-bottom: none; }
.ticket-list-item:hover { background: #f0f7ff; }
.ticket-list-item .ticket-id { font-weight: 800; color: var(--primary); min-width: 64px; font-size: .9rem; }
.ticket-list-item .ticket-info { flex: 1; min-width: 0; }
.ticket-list-item .ticket-asunto { font-weight: 600; font-size: .9rem; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-list-item .ticket-meta { font-size: .78rem; color: var(--gray-500); margin-top: 2px; }

/* Modals */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--gray-100); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--gray-100); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* Animations */
.fade-in { animation: fadeIn .4s cubic-bezier(.4,0,.2,1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Page heading */
.page-heading {
    display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.page-heading i {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    background: var(--primary-light); color: var(--primary); border-radius: var(--radius);
    font-size: 1.1rem;
}

/* Filter bar */
.filter-bar {
    background: white; border-radius: var(--radius); padding: 16px 20px;
    border: 1px solid var(--gray-200); margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Empty state */
.empty-state { text-align: center; padding: 50px 20px; color: var(--gray-500); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; color: var(--gray-300); }
.empty-state p { font-size: .95rem; }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { left: calc(-1 * var(--sidebar-width)); }
    .sidebar.open { left: 0; }
    .content { margin-left: 0; }
    .main-content { padding: 20px 16px; }
}
