/* ============================================================
   Klaris - Sistema de Diseno Completo
   Light/Dark Mode con CSS Custom Properties
   ============================================================ */

/* ===== IMPORTACION DE FUENTE ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== TEMA CLARO (por defecto) ===== */
:root[data-theme="light"] {
    /* Superficie */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --bg-modal: #ffffff;
    --bg-dropdown: #ffffff;
    --bg-table-stripe: #f8fafc;
    --bg-code: #f1f5f9;

    /* Texto */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Bordes */
    --border-color: #e2e8f0;
    --border-color-strong: #cbd5e1;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Kanban */
    --kanban-col-bg: #f1f5f9;
    --kanban-card-bg: #ffffff;
    --kanban-card-border: #e2e8f0;

    /* Bootstrap overrides */
    --bs-body-bg: #f1f5f9;
    --bs-body-color: #1e293b;
    --bs-modal-bg: #ffffff;
    --bs-modal-color: #1e293b;
    --bs-dropdown-bg: #ffffff;
    --bs-dropdown-link-color: #1e293b;
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8fafc;
    --bs-border-color: #e2e8f0;
    --bs-card-bg: #ffffff;
}

/* ===== TEMA OSCURO ===== */
:root[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #1e293b;
    --bg-modal: #1e293b;
    --bg-dropdown: #1e293b;
    --bg-table-stripe: #334155;
    --bg-code: #0f172a;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --border-color: #334155;
    --border-color-strong: #475569;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);

    --kanban-col-bg: #1e293b;
    --kanban-card-bg: #334155;
    --kanban-card-border: #475569;

    /* Bootstrap overrides dark */
    --bs-body-bg: #0f172a;
    --bs-body-color: #f1f5f9;
    --bs-modal-bg: #1e293b;
    --bs-modal-color: #f1f5f9;
    --bs-dropdown-bg: #1e293b;
    --bs-dropdown-link-color: #f1f5f9;
    --bs-table-bg: #1e293b;
    --bs-table-striped-bg: #334155;
    --bs-border-color: #334155;
    --bs-card-bg: #1e293b;
    --bs-input-bg: #1e293b;
    --bs-input-color: #f1f5f9;
    --bs-input-border-color: #334155;
    --bs-input-focus-border-color: #4f46e5;
}

/* ===== COLORES CONSTANTES (ambos temas) ===== */
:root {
    /* Fuente */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Marca */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --primary-dark: #3730a3;

    /* Sidebar (siempre oscuro) */
    --sidebar-bg: #1a1f36;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(79, 70, 229, 0.15);
    --sidebar-active-text: #818cf8;
    --sidebar-active-border: #4f46e5;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;

    /* Estados de tarea */
    --status-new: #3b82f6;
    --status-new-bg: #eff6ff;
    --status-progress: #f59e0b;
    --status-progress-bg: #fffbeb;
    --status-review: #8b5cf6;
    --status-review-bg: #f5f3ff;
    --status-done: #22c55e;
    --status-done-bg: #f0fdf4;
    --status-archived: #94a3b8;
    --status-archived-bg: #f8fafc;

    /* Prioridades */
    --priority-low: #94a3b8;
    --priority-medium: #3b82f6;
    --priority-high: #f97316;
    --priority-critical: #ef4444;

    /* Feedback */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Espaciado */
    --navbar-height: 60px;
    --border-radius: 0.5rem;
    --border-radius-sm: 0.375rem;
    --border-radius-lg: 0.75rem;

    /* Transicion */
    --transition: all 0.2s ease;
    --transition-slow: all 0.35s ease;
}

/* ===== RESET Y BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* ===== LAYOUT PRINCIPAL ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}

.content-area {
    flex: 1;
    padding: 1.5rem;
    margin-top: var(--navbar-height);
}

/* Paginas de auth: sin sidebar ni navbar, ocupan toda la pantalla */
.main-content--auth {
    margin-left: 0 !important;
    width: 100%;
}

.content-area--auth {
    margin-top: 0 !important;
    padding: 0 !important;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background-color: #334155; border-radius: 2px; }

/* Logo / Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-decoration: none;
    min-height: var(--navbar-height);
}

.sidebar-brand-logo {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.025em;
    white-space: nowrap;
}

/* Nav items */
.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
}

.sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-text);
    padding: 0.75rem 0.5rem 0.375rem;
    margin-top: 0.5rem;
}

.sidebar-item {
    margin-bottom: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--border-radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text-hover);
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--sidebar-active-border);
}

.sidebar-link i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Badge en sidebar */
.sidebar-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
}

/* Footer del sidebar */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ===== NAVBAR ===== */
.navbar-top {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: left var(--transition-slow), background-color 0.3s ease;
}

.navbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    line-height: 1;
}

.navbar-hamburger:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Busqueda */
.navbar-search {
    flex: 1;
    max-width: 400px;
}

.navbar-search .input-group {
    border-radius: var(--border-radius);
}

.navbar-search .form-control {
    background: var(--bg-body);
    border-color: var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    border-right: none;
}

.navbar-search .form-control::placeholder {
    color: var(--text-muted);
}

.navbar-search .form-control:focus {
    background: var(--bg-body);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.navbar-search .input-group-text {
    background: var(--bg-body);
    border-color: var(--border-color);
    color: var(--text-muted);
    border-left: none;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.navbar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    text-decoration: none;
}

.navbar-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Badge notificacion */
.notif-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

/* Avatar usuario en navbar */
.navbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.navbar-avatar:hover {
    transform: scale(1.1);
}

.navbar-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

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

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

.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
    color: var(--text-primary);
}

/* ===== FORMULARIOS ===== */
.form-control,
.form-select {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ===== BOTONES ===== */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

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

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

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

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

/* ===== MODALES ===== */
.modal-content {
    background-color: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    filter: var(--btn-close-filter, none);
}

:root[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* ===== DROPDOWNS ===== */
.dropdown-menu {
    background-color: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
}

.dropdown-item {
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.25rem 0;
}

.dropdown-header {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem;
}

/* ===== TABLAS ===== */
.table {
    color: var(--text-primary);
    --bs-table-bg: var(--bg-card);
    --bs-table-striped-bg: var(--bg-table-stripe);
    --bs-table-border-color: var(--border-color);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    background: var(--bg-card);
}

.table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table-hover tbody tr:hover td {
    background-color: var(--bg-card-hover);
}

/* ===== BADGES ===== */
.badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.3em 0.6em;
    border-radius: 999px;
    letter-spacing: 0.01em;
}

/* ===== KANBAN ===== */
.kanban-board {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1rem;
    overflow-x: auto;
    min-height: calc(100vh - var(--navbar-height) - 8rem);
}

.kanban-column {
    flex: 0 0 300px;
    min-width: 300px;
    background: var(--kanban-col-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--navbar-height) - 8rem);
}

.kanban-column-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    background: var(--kanban-col-bg);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    z-index: 1;
}

.kanban-column-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.kanban-column-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--border-color);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanban-cards {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Tarjeta Kanban */
.task-card {
    background: var(--kanban-card-bg);
    border: 1px solid var(--kanban-card-border);
    border-radius: var(--border-radius);
    padding: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    box-shadow: var(--shadow-sm);
}

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

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(1deg);
}

.task-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.task-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.task-card-tag {
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    color: white;
}

/* Prioridad en tarjetas */
.priority-low    { border-left-color: var(--priority-low); }
.priority-medium { border-left-color: var(--priority-medium); }
.priority-high   { border-left-color: var(--priority-high); }
.priority-critical { border-left-color: var(--priority-critical); }

/* Zona de drop */
.kanban-drop-zone {
    min-height: 60px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    transition: var(--transition);
}

.kanban-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary);
}

/* ===== SKELETON LOADER ===== */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    pointer-events: none;
}

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        var(--bg-card-hover) 25%,
        var(--border-color) 50%,
        var(--bg-card-hover) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-50 { width: 50%; }

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

/* ===== EMPTY STATE ===== */
.empty-state {
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state h5 {
    color: var(--text-primary);
    font-weight: 600;
    margin-top: 1rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ===== AVATAR ===== */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-placeholder {
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-sm, .avatar-placeholder.avatar-sm { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar-md, .avatar-placeholder.avatar-md { width: 36px; height: 36px; font-size: 0.875rem; }
.avatar-lg, .avatar-placeholder.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.avatar-xl, .avatar-placeholder.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* ===== ALERTAS / TOAST ===== */
.toast-custom {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

/* ===== PAGINAS DE AUTH ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
}

.auth-panel-left {
    flex: 1;
    background: linear-gradient(135deg, #1a1f36 0%, #2d3561 50%, #1a1f36 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-panel-left::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.15);
    top: -100px;
    right: -100px;
}

.auth-panel-left::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.08);
    bottom: -80px;
    left: -80px;
}

.auth-panel-right {
    flex: 0 0 480px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 380px;
}

/* ===== INDICADOR DE FORTALEZA DE PASSWORD ===== */
.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    margin-top: 0.375rem;
    overflow: hidden;
}

.password-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
    width: 0%;
}

.strength-weak   { width: 25%; background: var(--danger); }
.strength-fair   { width: 50%; background: var(--warning); }
.strength-good   { width: 75%; background: var(--info); }
.strength-strong { width: 100%; background: var(--success); }

/* ===== PAGINA DE PERFIL ===== */
.profile-cover {
    height: 200px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.profile-avatar-wrapper {
    margin-top: -50px;
    padding: 0 1.5rem;
}

/* ===== DASHBOARD STATS ===== */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ===== SEPARADORES ===== */
hr {
    border-color: var(--border-color);
    opacity: 1;
}

/* ===== TEXTO UTILITARIO ===== */
.text-primary-custom { color: var(--primary) !important; }
.text-body           { color: var(--text-primary) !important; }
.text-secondary      { color: var(--text-secondary) !important; }
.text-muted          { color: var(--text-muted) !important; }
.fw-semibold         { font-weight: 600; }

/* ===== SCROLLBAR GLOBAL ===== */
:root[data-theme="dark"] {
    scrollbar-color: #334155 #1e293b;
}
:root[data-theme="dark"] ::-webkit-scrollbar { width: 8px; height: 8px; }
:root[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e293b; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ===== PAGINAS DE ERROR ===== */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    opacity: 0.15;
    position: absolute;
}

/* ===== NAV TABS ===== */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: none;
}

.tab-content {
    padding-top: 1.25rem;
}

/* ===== LISTAS ===== */
.list-group-item {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.list-group-item:hover {
    background: var(--bg-card-hover);
}

/* ===== RESPONSIVE ===== */

/* Tablet: sidebar colapsado */
@media (max-width: 1199.98px) {
    :root { --sidebar-width: 64px; }

    .sidebar-brand-name,
    .sidebar-link span,
    .sidebar-section-title,
    .sidebar-badge { display: none; }

    .sidebar-link {
        justify-content: center;
        padding: 0.75rem;
        border-left: none;
        border-radius: var(--border-radius-sm);
    }

    .sidebar-link.active {
        border-left: none;
        background: var(--sidebar-active-bg);
    }

    .sidebar-link i { width: auto; font-size: 1.25rem; }

    .sidebar-brand { justify-content: center; }

    .sidebar-brand-logo { width: 36px; height: 36px; }
}

/* Movil: sidebar como offcanvas */
@media (max-width: 991.98px) {
    :root { --sidebar-width: 0px; }

    .sidebar {
        width: 260px;
        transform: translateX(-100%);
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar-brand-name,
    .sidebar-link span,
    .sidebar-section-title,
    .sidebar-badge { display: flex; }

    .sidebar-link {
        justify-content: flex-start;
        padding: 0.625rem 0.75rem;
    }

    .main-content { margin-left: 0; }
    .navbar-top { left: 0; }
    .navbar-hamburger { display: flex; }

    /* Overlay cuando sidebar abierto */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1039;
    }
    .sidebar-overlay.show { display: block; }
}

/* Kanban responsive */
@media (max-width: 767.98px) {
    .kanban-board {
        flex-direction: column;
        overflow-x: visible;
    }
    .kanban-column {
        flex: none;
        width: 100%;
        min-width: unset;
        max-height: none;
    }
}

/* Modal responsive */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0;
        min-height: 100vh;
        max-width: 100%;
    }
    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }
    .auth-panel-left { display: none; }
    .auth-panel-right {
        flex: 1;
        padding: 2rem 1.5rem;
    }
}

/* Touch friendly */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .dropdown-item { min-height: 44px; }
    .task-card { padding: 1rem; }
    .sidebar-link { min-height: 48px; }
}

/* Dashboard responsive */
@media (max-width: 991.98px) {
    .content-area { padding: 1rem; }
}

@media (max-width: 575.98px) {
    .content-area { padding: 0.75rem; }
    .stat-value { font-size: 1.5rem; }
}

/* ===== SELECT2 DARK MODE ===== */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary);
    line-height: 36px;
}

.select2-container--default .select2-selection--single {
    height: 38px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted);
}

.select2-dropdown {
    background-color: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
}

.select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: var(--text-muted);
}

.select2-container--default .select2-results__option {
    color: var(--text-primary);
    background-color: var(--bg-dropdown);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary);
    color: #fff;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.select2-results__message {
    color: var(--text-muted);
}

/* ===== AVATAR UPLOAD BUTTON ===== */
.profile-avatar-wrapper {
    position: relative;
    display: inline-block;
}

.avatar-upload-btn {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    border: 2px solid var(--bg-card);
    transition: background var(--transition);
}

.avatar-upload-btn:hover {
    background: var(--primary-dark, #4338ca);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgba(79, 70, 229, 0.15);
    border: 1px solid rgba(79, 70, 229, 0.3);
    color: var(--primary);
}

/* ===== AVATAR ENHANCEMENTS ===== */
.avatar-placeholder, .navbar-avatar, .chat-avatar, .member-avatar {
    object-fit: cover !important;
}

.avatar-expandable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.avatar-expandable:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Lightbox Modal */
#avatarLightbox .modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
}

#avatarLightbox .modal-body {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#avatarLightbox img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 3px solid white;
}

/* Cropper Modal */
.cropper-container-wrapper {
    max-height: 400px;
    width: 100%;
}

#cropperImage {
    display: block;
    max-width: 100%;
}

/* Avatar History */
.avatar-history-item {
    position: relative;
    width: 64px;
    height: 64px;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 2px;
    transition: all 0.3s ease;
}

.avatar-history-item.active {
    border-color: var(--primary);
}

.avatar-history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-history-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(0,0,0,0.4);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.avatar-history-item:hover .avatar-history-actions {
    opacity: 1;
    pointer-events: all;
}

.avatar-history-actions button {
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
}

 / *   D a s h b o a r d   A n a l y t i c s   &   P r e m i u m   U I   * / 
 . s t a t - c a r d   { 
         b o r d e r - r a d i u s :   1 . 2 5 r e m ; 
         p a d d i n g :   1 . 5 r e m ; 
         d i s p l a y :   f l e x ; 
         a l i g n - i t e m s :   c e n t e r ; 
         g a p :   1 . 2 5 r e m ; 
         t r a n s i t i o n :   a l l   0 . 3 s   c u b i c - b e z i e r ( 0 . 4 ,   0 ,   0 . 2 ,   1 ) ; 
         b o r d e r :   1 p x   s o l i d   r g b a ( 0 ,   0 ,   0 ,   0 . 0 5 ) ; 
         b o x - s h a d o w :   0   4 p x   6 p x   - 1 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 0 5 ) ,   0   2 p x   4 p x   - 1 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 0 3 ) ; 
         o v e r f l o w :   h i d d e n ; 
         p o s i t i o n :   r e l a t i v e ; 
         b a c k g r o u n d :   v a r ( - - b g - c a r d ) ; 
 } 
 
 [ d a t a - t h e m e = \  
 d a r k \ ]   . s t a t - c a r d   { 
         b o r d e r - c o l o r :   r g b a ( 2 5 5 ,   2 5 5 ,   2 5 5 ,   0 . 0 8 ) ; 
         b o x - s h a d o w :   0   1 0 p x   1 5 p x   - 3 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 3 ) ; 
 } 
 
 . s t a t - c a r d : h o v e r   { 
         t r a n s f o r m :   t r a n s l a t e Y ( - 4 p x )   s c a l e ( 1 . 0 2 ) ; 
         b o x - s h a d o w :   0   2 0 p x   2 5 p x   - 5 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 1 ) ,   0   1 0 p x   1 0 p x   - 5 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 0 4 ) ; 
 } 
 
 . s t a t - i c o n   { 
         w i d t h :   3 . 5 r e m ; 
         h e i g h t :   3 . 5 r e m ; 
         b o r d e r - r a d i u s :   1 r e m ; 
         d i s p l a y :   f l e x ; 
         a l i g n - i t e m s :   c e n t e r ; 
         j u s t i f y - c o n t e n t :   c e n t e r ; 
         f o n t - s i z e :   1 . 5 r e m ; 
         f l e x - s h r i n k :   0 ; 
 } 
 
 [ d a t a - t h e m e = \ d a r k \ ]   . c a r d   { 
         b a c k g r o u n d :   r g b a ( 3 0 ,   4 1 ,   5 9 ,   0 . 7 )   ! i m p o r t a n t ; 
         b a c k d r o p - f i l t e r :   b l u r ( 1 2 p x ) ; 
         - w e b k i t - b a c k d r o p - f i l t e r :   b l u r ( 1 2 p x ) ; 
         b o r d e r - c o l o r :   r g b a ( 2 5 5 ,   2 5 5 ,   2 5 5 ,   0 . 1 )   ! i m p o r t a n t ; 
 } 
 
 . t r a n s i t i o n - a l l   { 
         t r a n s i t i o n :   a l l   0 . 2 s   e a s e - i n - o u t ; 
 } 
 
 . h o v e r - s h a d o w - s m : h o v e r   { 
         b a c k g r o u n d :   r g b a ( 7 9 ,   7 0 ,   2 2 9 ,   0 . 0 6 )   ! i m p o r t a n t ; 
         t r a n s f o r m :   t r a n s l a t e X ( 4 p x ) ; 
 } 
  
 