/* ========================================
   TecinfoBCN - Portal del Cliente
   Modern Design System v2.0
   ======================================== */

/* ---- CSS Variables / Theming ---- */
:root {
    --primary: #1a56db;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --primary-50: #eff6ff;
    --primary-rgb: 26, 86, 219;
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --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;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 10px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.1), 0 8px 16px -6px rgba(0,0,0,0.05);
    --shadow-glow: 0 0 20px rgba(26, 86, 219, 0.15);
    --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark mode variables */
[data-theme="dark"] {
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-400: #6b7280;
    --gray-500: #9ca3af;
    --gray-600: #d1d5db;
    --gray-700: #e5e7eb;
    --gray-800: #f3f4f6;
    --gray-900: #f9fafb;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] .card,
[data-theme="dark"] .auth-card,
[data-theme="dark"] .stat-card {
    background: #1e293b;
    border: 1px solid #334155;
}

[data-theme="dark"] .form-control {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--primary);
    background: #1e293b;
}

[data-theme="dark"] table th {
    background: #1e293b;
}

[data-theme="dark"] table td {
    border-bottom-color: #334155;
}

[data-theme="dark"] table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

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

img { max-width: 100%; height: auto; }

::selection {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary-dark);
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- Header ---- */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0 20px;
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header .logo {
    font-size: 22px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.header .logo span {
    font-weight: 300;
    opacity: 0.75;
    font-size: 14px;
    margin-left: 8px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-nav a {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.header-nav a:hover {
    color: white;
    background: rgba(255,255,255,0.12);
    text-decoration: none;
}

.header-nav .user-name {
    color: white;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.15);
}

/* ---- Container ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* ---- Cards ---- */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
    border: 1px solid var(--gray-100);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
    letter-spacing: -0.3px;
}

/* ---- Formularios ---- */
.form-group {
    margin-bottom: 22px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group .help {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 6px;
    line-height: 1.5;
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: white;
    color: var(--gray-800);
}

.form-control:hover {
    border-color: var(--gray-300);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.08);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.form-control.is-valid {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.7;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* File input styling */
input[type="file"].form-control {
    padding: 8px 16px;
    cursor: pointer;
}

input[type="file"].form-control::file-selector-button {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    margin-right: 12px;
    transition: background var(--transition-fast);
}

input[type="file"].form-control::file-selector-button:hover {
    background: var(--primary);
    color: white;
}

/* ---- Botones ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, var(--primary-dark));
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #16a34a);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 8px 20px;
}

.btn-outline::after { display: none; }

.btn-outline:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: 8px 16px;
}

.btn-ghost::after { display: none; }

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    box-shadow: none;
    transform: none;
}

.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 12px; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius);
}

.btn-group {
    display: inline-flex;
    gap: 2px;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* Loading state */
.btn.loading {
    pointer-events: none;
    opacity: 0.75;
}

.btn.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.2px;
    transition: transform var(--transition-fast);
}

.badge:hover {
    transform: scale(1.05);
}

.badge-blue, .badge-abierto { background: #eff6ff; color: #1d4ed8; }
.badge-green, .badge-cerrado { background: #f0fdf4; color: #15803d; }
.badge-yellow, .badge-en-progreso { background: #fefce8; color: #a16207; }
.badge-red, .badge-urgente { background: #fef2f2; color: #b91c1c; }
.badge-purple { background: #faf5ff; color: #7e22ce; }
.badge-gray, .badge-pendiente { background: #f3f4f6; color: #4b5563; }
.badge-orange { background: #fff7ed; color: #c2410c; }

/* Priority badges with dot indicator */
.badge-priority::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ---- Tablas ---- */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 14px 16px;
    background: var(--gray-50);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 5;
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
    vertical-align: middle;
    transition: background var(--transition-fast);
}

/* Zebra striping */
table tbody tr:nth-child(even) {
    background: rgba(249, 250, 251, 0.5);
}

table tbody tr {
    transition: all var(--transition-fast);
}

table tbody tr:hover {
    background: var(--primary-50);
}

table .ticket-num {
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: -0.3px;
}

table .ticket-num:hover {
    color: var(--primary-dark);
}

/* Sortable table headers */
table th[data-sort] {
    cursor: pointer;
    user-select: none;
}

table th[data-sort]:hover {
    color: var(--primary);
    background: var(--primary-50);
}

/* ---- Alertas ---- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: alertSlideIn 0.3s ease-out;
    line-height: 1.5;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

.alert-success::before { content: '\2713'; font-weight: 700; font-size: 16px; }
.alert-error::before { content: '\2717'; font-weight: 700; font-size: 16px; }
.alert-warning::before { content: '\26A0'; font-size: 16px; }
.alert-info::before { content: '\2139'; font-weight: 700; font-size: 16px; }

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 420px;
    pointer-events: all;
    animation: toastIn var(--transition-slow) ease-out;
    border-left: 4px solid var(--primary);
    font-size: 14px;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

.toast.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    margin-left: auto;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--gray-700);
}

/* ---- Login / Registro - Glass morphism ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1a56db 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.3) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: authFloat 8s ease-in-out infinite;
}

.auth-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.15) 0%, transparent 70%);
    bottom: -200px;
    left: -150px;
    border-radius: 50%;
    animation: authFloat 10s ease-in-out infinite reverse;
}

@keyframes authFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -30px) scale(1.05); }
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    width: 100%;
    max-width: 440px;
    padding: 44px;
    position: relative;
    z-index: 1;
    animation: authCardIn 0.6s ease-out;
}

@keyframes authCardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card .logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .logo h1 {
    color: var(--primary);
    font-size: 28px;
    letter-spacing: -1px;
    font-weight: 800;
}

.auth-card .logo p {
    color: var(--gray-500);
    font-size: 14px;
    margin-top: 6px;
}

.auth-card h2 {
    text-align: center;
    color: var(--gray-800);
    margin-bottom: 28px;
    font-size: 20px;
    font-weight: 700;
}

.auth-card .form-control {
    background: var(--gray-50);
    border-color: var(--gray-200);
    padding: 13px 16px;
}

.auth-card .form-control:focus {
    background: white;
}

.auth-card .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    margin-top: 8px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--gray-500);
}

.auth-footer a {
    font-weight: 600;
}

/* ---- Notas / Conversacion ---- */
.nota {
    padding: 18px 20px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    position: relative;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    animation: notaIn 0.3s ease-out;
}

.nota:hover {
    transform: translateX(4px);
}

@keyframes notaIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Public notes: soft blue */
.nota-publica {
    background: linear-gradient(135deg, #eff6ff 0%, #e0efff 100%);
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.06);
}

.nota-publica::before {
    content: '\1F4AC';
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 14px;
    opacity: 0.5;
}

/* Private notes: soft yellow with lock icon */
.nota-privada {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border-left: 4px solid #eab308;
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.08);
}

.nota-privada::before {
    content: '\1F512';
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 14px;
    opacity: 0.6;
}

/* Client notes: soft green */
.nota-cliente {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 4px solid var(--success);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.06);
}

.nota-cliente::before {
    content: '\1F464';
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 14px;
    opacity: 0.5;
}

.nota-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    padding-right: 30px;
}

.nota-autor {
    font-weight: 700;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nota-fecha {
    color: var(--gray-400);
    font-size: 12px;
}

.nota-badge-privada {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nota-badge-privada::before {
    content: '\1F512';
    font-size: 10px;
}

.nota-contenido {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---- Historial ---- */
.historial-item {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    color: var(--gray-600);
    transition: background var(--transition-fast);
    padding-left: 8px;
    padding-right: 8px;
    border-radius: var(--radius-sm);
}

.historial-item:hover {
    background: var(--gray-50);
}

.historial-item:last-child {
    border-bottom: none;
}

.historial-fecha {
    color: var(--gray-400);
    white-space: nowrap;
    font-size: 12px;
    min-width: 130px;
    font-family: var(--font-mono);
}

/* ---- Tiempo ---- */
.tiempo-total {
    background: linear-gradient(135deg, var(--primary-light) 0%, #c7d8f5 100%);
    border-radius: var(--radius);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
}

.tiempo-total .valor {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    font-family: var(--font-mono);
}

.tiempo-total .label {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
}

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

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--gray-100);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    opacity: 0;
    transition: opacity var(--transition-base);
}

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

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 6px;
    font-weight: 500;
}

/* ---- SLA Indicador ---- */
.sla-ok {
    color: var(--success);
    font-weight: 600;
}

.sla-proximo {
    color: var(--warning);
    font-weight: 600;
}

.sla-vencido {
    color: var(--danger);
    font-weight: 700;
    animation: slaPulse 2s ease-in-out infinite;
}

@keyframes slaPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* SLA Progress bar */
.sla-progress {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.sla-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
}

.sla-progress-bar.ok { background: linear-gradient(90deg, var(--success), #4ade80); }
.sla-progress-bar.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.sla-progress-bar.danger {
    background: linear-gradient(90deg, var(--danger), #f87171);
    animation: slaPulse 1.5s ease-in-out infinite;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-400);
}

.empty-state .icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.6;
    animation: emptyFloat 3s ease-in-out infinite;
}

@keyframes emptyFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.empty-state h3 {
    color: var(--gray-600);
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
}

.empty-state p {
    color: var(--gray-400);
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

.empty-state .btn {
    margin-top: 8px;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    font-weight: 500;
    transition: all var(--transition-fast);
    min-width: 40px;
    text-align: center;
}

.pagination a:hover {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.pagination .active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

/* ---- PWA Install Prompt ---- */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 20px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    max-width: 460px;
    width: calc(100% - 40px);
    border: 1px solid var(--gray-200);
    transition: transform var(--transition-spring);
}

.pwa-install-prompt.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-install-prompt .pwa-icon {
    font-size: 36px;
    flex-shrink: 0;
}

.pwa-install-prompt .pwa-text h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.pwa-install-prompt .pwa-text p {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.4;
}

.pwa-install-prompt .pwa-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.pwa-install-prompt .pwa-dismiss {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.pwa-install-prompt .pwa-dismiss:hover {
    color: var(--gray-700);
}

/* ---- Dark Mode Toggle ---- */
.dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* ---- Skeleton Loading ---- */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 22px;
    width: 60%;
    margin-bottom: 12px;
}

/* ---- Utility Classes ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 13px; }
.text-mono { font-family: var(--font-mono); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }

    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }

    .header-nav {
        gap: 4px;
        width: 100%;
        justify-content: flex-end;
    }

    .header-nav a {
        padding: 6px 10px;
        font-size: 13px;
    }

    table { font-size: 13px; }
    table th, table td { padding: 10px 12px; }

    .container { padding: 16px; }
    .card { padding: 18px; border-radius: var(--radius); }
    .auth-card { padding: 28px; }

    .nota-header { flex-direction: column; align-items: flex-start; gap: 4px; }

    .toast-container {
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: unset;
        width: 100%;
    }

    .pwa-install-prompt {
        flex-direction: column;
        text-align: center;
        bottom: 10px;
    }

    .pwa-install-prompt .pwa-actions {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .btn { width: 100%; justify-content: center; }
    .pagination { gap: 2px; }
    .pagination a, .pagination span { padding: 6px 10px; font-size: 13px; }
}

/* ---- Print Styles ---- */
@media print {
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: white;
    }

    .header, .header-nav, .btn, .pagination,
    .pwa-install-prompt, .toast-container,
    .dark-mode-toggle, .filters,
    .hamburger, .sidebar, .sidebar-overlay {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
        page-break-inside: avoid;
        margin-bottom: 16px;
    }

    table {
        border-collapse: collapse;
    }

    table th, table td {
        border: 1px solid #ccc;
        padding: 8px;
    }

    table th {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }

    .nota {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .badge {
        border: 1px solid currentColor;
    }

    .admin-content {
        margin-left: 0 !important;
    }
}
