/* ============================================
   CEO GENERATIVO - Estilos Principales
   ============================================ */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #93c5fd;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #f8fafc;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 64px;

    --transition: all 0.2s ease;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

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

ul { list-style: none; }

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
}

.login-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
}

.login-container {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: white;
    box-shadow: 0 8px 32px rgba(59,130,246,0.3);
}

.login-header h1 {
    color: var(--text-white);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.login-form label i {
    margin-right: 6px;
    width: 16px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    color: var(--text-white);
    font-size: 0.95rem;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.login-form input::placeholder {
    color: var(--text-light);
    opacity: 0.5;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    opacity: 0.6;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--secondary);
    color: white;
}
.btn-secondary:hover { background: #475569; }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-input); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    position: relative;
}
.btn-icon:hover { background: var(--border-light); color: var(--primary); }

.btn-ai-glow {
    color: var(--primary);
    animation: aiGlow 2s ease-in-out infinite;
}

@keyframes aiGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(59,130,246,0.2); }
    50% { box-shadow: 0 0 20px rgba(59,130,246,0.4); }
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 10px;
    position: absolute;
    top: 2px;
    right: 2px;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-top: 16px;
}

.alert-error {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.2);
}

.alert-success {
    background: rgba(34,197,94,0.1);
    color: var(--success);
    border: 1px solid rgba(34,197,94,0.2);
}

/* ============================================
   APP LAYOUT
   ============================================ */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-divider,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-details,
.sidebar.collapsed .badge {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-white);
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-logo i {
    font-size: 1.4rem;
    color: var(--primary);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-light);
    border-radius: var(--radius);
    transition: var(--transition);
    margin-bottom: 2px;
    font-size: 0.9rem;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-white);
}

.nav-item.active {
    background: rgba(59,130,246,0.15);
    color: var(--primary-light);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-item .badge {
    position: static;
    margin-left: auto;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 12px 14px;
}

.nav-section-title {
    color: var(--text-light);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 14px 8px;
    opacity: 0.6;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 500;
}

.user-role {
    color: var(--text-light);
    font-size: 0.7rem;
    text-transform: capitalize;
}

.sidebar-footer .btn-icon {
    color: var(--text-light);
}
.sidebar-footer .btn-icon:hover {
    color: var(--danger);
    background: rgba(239,68,68,0.1);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.topbar-left h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-light);
    font-size: 0.85rem;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    font-size: 0.85rem;
    width: 240px;
    transition: var(--transition);
    font-family: inherit;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
    width: 300px;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-blue .stat-icon { background: rgba(59,130,246,0.1); color: var(--primary); }
.stat-green .stat-icon { background: rgba(34,197,94,0.1); color: var(--success); }
.stat-purple .stat-icon { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.stat-orange .stat-icon { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-teal .stat-icon { background: rgba(6,182,212,0.1); color: var(--info); }
.stat-pink .stat-icon { background: rgba(236,72,153,0.1); color: #ec4899; }
.stat-indigo .stat-icon { background: rgba(99,102,241,0.1); color: #6366f1; }

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body {
    padding: 16px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================
   AI CHAT
   ============================================ */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height) - 48px);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.ai-message.ai-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.ai-bot .ai-avatar {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
}

.ai-user .ai-avatar {
    background: var(--secondary);
    color: white;
}

.ai-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.6;
}

.ai-bot .ai-bubble {
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.ai-user .ai-bubble {
    background: var(--primary);
    color: white;
}

.ai-bubble ul {
    margin: 8px 0;
    padding-left: 4px;
}

.ai-bubble li {
    margin-bottom: 4px;
}

.ai-bubble p {
    margin-bottom: 8px;
}

.ai-bubble p:last-child {
    margin-bottom: 0;
}

.ai-chat-input {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-card);
}

.ai-input-actions {
    display: flex;
    gap: 4px;
}

.ai-chat-input textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: var(--transition);
}

.ai-chat-input textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* ============================================
   CHAT LAYOUT
   ============================================ */
.chat-layout {
    display: flex;
    height: calc(100vh - var(--topbar-height) - 48px);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.chat-sidebar {
    width: 300px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}

.conversation-item:hover {
    background: var(--bg-input);
}

.conversation-item.active {
    background: rgba(59,130,246,0.08);
    border-left: 3px solid var(--primary);
}

.conversation-item h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.conversation-item p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-main-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.chat-main-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    gap: 10px;
    max-width: 70%;
}

.chat-msg.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
}

.chat-msg:not(.own) .chat-msg-bubble {
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.chat-msg.own .chat-msg-bubble {
    background: var(--primary);
    color: white;
}

.chat-msg-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}

.chat-msg-time {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 4px;
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ============================================
   SECTION HEADERS
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.section-header-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   FILTER TABS
   ============================================ */
.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 3px;
}

.filter-tab {
    padding: 6px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.filter-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

/* ============================================
   TASKS LIST
   ============================================ */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    cursor: pointer;
}

.task-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.task-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    display: flex;
    gap: 12px;
}

.task-priority {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-urgent { background: rgba(239,68,68,0.1); color: var(--danger); }
.priority-high { background: rgba(245,158,11,0.1); color: var(--warning); }
.priority-medium { background: rgba(59,130,246,0.1); color: var(--primary); }
.priority-low { background: rgba(34,197,94,0.1); color: var(--success); }

.task-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-pending { background: rgba(245,158,11,0.1); color: var(--warning); }
.status-in_progress { background: rgba(59,130,246,0.1); color: var(--primary); }
.status-review { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.status-completed { background: rgba(34,197,94,0.1); color: var(--success); }

/* ============================================
   DOCUMENTS GRID
   ============================================ */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.document-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.document-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.document-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.doc-pdf .document-icon { background: rgba(239,68,68,0.1); color: var(--danger); }
.doc-excel .document-icon { background: rgba(34,197,94,0.1); color: var(--success); }
.doc-word .document-icon { background: rgba(59,130,246,0.1); color: var(--primary); }
.doc-image .document-icon { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.doc-other .document-icon { background: rgba(100,116,139,0.1); color: var(--secondary); }

.document-title {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ============================================
   KNOWLEDGE LIST
   ============================================ */
.knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.knowledge-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: var(--transition);
}

.knowledge-item:hover {
    box-shadow: var(--shadow);
}

.knowledge-item h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.knowledge-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.knowledge-tags {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.knowledge-tag {
    padding: 2px 8px;
    background: rgba(59,130,246,0.08);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* ============================================
   DATA TABLE
   ============================================ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

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

.data-table th {
    background: var(--bg-input);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
}

.data-table tr:hover td {
    background: var(--bg-input);
}

.status-active {
    color: var(--success);
    font-weight: 500;
}

.status-inactive {
    color: var(--danger);
    font-weight: 500;
}

/* ============================================
   CONFIG FORM
   ============================================ */
.config-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 4px;
    flex-wrap: wrap;
}

.config-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.config-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

.config-form {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 24px;
}

.config-field {
    margin-bottom: 16px;
}

.config-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.config-field .config-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 6px;
}

.config-field input,
.config-field select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.config-field input:focus,
.config-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ============================================
   INTEGRATIONS GRID
   ============================================ */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.integration-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

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

.integration-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
}

.integration-card h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.integration-card p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.integration-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    min-width: 300px;
    max-width: 450px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }

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

/* ============================================
   AI QUICK PANEL
   ============================================ */
.ai-quick-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 500;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

.ai-quick-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(59,130,246,0.05), rgba(139,92,246,0.05));
}

.ai-quick-header h4 {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.ai-quick-body {
    padding: 16px 20px;
}

.ai-quick-body textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    margin-bottom: 10px;
}

.ai-quick-body textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.ai-quick-response {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius);
    font-size: 0.85rem;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

/* ============================================
   AI SUGGESTION
   ============================================ */
.ai-suggestion-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(59,130,246,0.04), rgba(139,92,246,0.04));
    border-radius: var(--radius);
    border: 1px solid rgba(59,130,246,0.1);
    margin-bottom: 8px;
}

.ai-suggestion-item i {
    color: var(--primary);
    font-size: 1.1rem;
    margin-top: 2px;
}

.ai-suggestion-item p {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ============================================
   ACTIVITY ITEM
   ============================================ */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--primary);
    flex-shrink: 0;
}

.activity-info {
    flex: 1;
}

.activity-info strong {
    font-weight: 500;
}

.activity-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Indicador de IA pensando - burbujas animadas */
.ai-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 1px solid #c7d2fe;
    color: #4338ca;
    font-size: 0.85rem;
    font-weight: 500;
    animation: ai-thinking-pulse 2s ease-in-out infinite;
}

.ai-thinking .dots-container {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.ai-thinking .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6366f1;
    animation: ai-dot-bounce 1.4s ease-in-out infinite;
}

.ai-thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes ai-thinking-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.15); }
    50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

/* Overlay de generación de documentos */
.doc-generating-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.doc-generating-card {
    background: white;
    border-radius: 16px;
    padding: 40px 48px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    max-width: 380px;
    width: 90%;
}

.doc-generating-card .spinner-ring {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.doc-generating-card h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 8px;
}

.doc-generating-card p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

.doc-generating-card .progress-text {
    margin-top: 16px;
    font-size: 0.8rem;
    color: #94a3b8;
    animation: dots 1.5s steps(4, end) infinite;
}

.doc-generating-card .progress-text::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -var(--sidebar-width);
        height: 100vh;
        z-index: 200;
    }

    .sidebar.open {
        left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .chat-layout {
        flex-direction: column;
    }

    .chat-sidebar {
        width: 100%;
        max-height: 200px;
    }

    .ai-quick-panel {
        width: calc(100% - 40px);
    }
}

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

    .content-area {
        padding: 16px;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ============================================
   WELCOME BANNER (Manager & Worker dashboards)
   ============================================ */
.welcome-banner {
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.worker-banner {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.manager-banner {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.welcome-text h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.welcome-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.welcome-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #6366f1);
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* ============================================
   QUICK ACTIONS (Worker dashboard)
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.quick-action-btn i {
    font-size: 1.3rem;
    color: var(--primary);
}

.quick-action-btn:hover {
    background: rgba(59,130,246,0.06);
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   SYSTEM STATUS (Admin dashboard)
   ============================================ */
.system-status-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.system-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}

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

.system-status-item span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   REPORT BAR CHART (Manager reports)
   ============================================ */
.report-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.report-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.report-bar-label {
    width: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.report-bar-item .progress-bar {
    flex: 1;
}

.report-bar-value {
    width: 30px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}
