/**
 * KINETIX V2 — Design System CSS
 * Paleta: Negro Obsidiana + Cian Eléctrico + Verde Menta
 * Modo: Dark Mode como estándar (brandbook)
 */

/* ═══════════════════════════════════════════════════════
   1. IMPORTAR FUENTES (Google Fonts)
═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&family=Teko:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ═══════════════════════════════════════════════════════
   2. VARIABLES CSS — TOKENS DE DISEÑO KINETIX
═══════════════════════════════════════════════════════ */
:root {
    /* Paleta principal */
    --color-bg:         #0B0C10;   /* Negro Obsidiana — fondo */
    --color-surface:    #1F2833;   /* Gris Carbón — tarjetas, modales */
    --color-surface-2:  #16213E;   /* Superficie más profunda */
    --color-border:     #2A3A4A;   /* Bordes sutiles */

    /* Acentos */
    --color-primary:    #66FCF1;   /* Cian Eléctrico — CTAs, progreso */
    --color-secondary:  #45A29E;   /* Verde Menta — niveles, checks */
    --color-primary-dim:#66FCF140; /* Cian con transparencia */
    --color-primary-glow: 0 0 20px #66FCF140;

    /* Texto */
    --color-text:       #F1F2F6;   /* Blanco Hielo — texto principal */
    --color-text-muted: #8B9DB0;   /* Gris azulado — texto secundario */
    --color-text-dim:   #4A5568;   /* Muy atenuado */

    /* Estados */
    --color-success:    #22C55E;
    --color-warning:    #F59E0B;
    --color-danger:     #EF4444;
    --color-info:       #3B82F6;

    /* Score colors */
    --score-elite:      #66FCF1;
    --score-good:       #22C55E;
    --score-medium:     #F59E0B;
    --score-low:        #EF4444;

    /* Tipografías */
    --font-display:     'Teko', 'Montserrat', sans-serif;
    --font-heading:     'Montserrat', sans-serif;
    --font-body:        'Inter', sans-serif;

    /* Espaciado */
    --space-xs:   4px;
    --space-sm:   8px;
    --space-md:   16px;
    --space-lg:   24px;
    --space-xl:   32px;
    --space-2xl:  48px;
    --space-3xl:  64px;

    /* Border radius */
    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  20px;
    --radius-xl:  32px;
    --radius-full: 9999px;

    /* Sombras */
    --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
    --shadow-md:  0 4px 16px rgba(0,0,0,.5);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
    --shadow-glow: 0 0 24px rgba(102,252,241,.2);

    /* Transiciones */
    --transition-fast:   0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow:   0.4s ease;

    /* Navbar */
    --navbar-height: 64px;

    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
}

/* ═══════════════════════════════════════════════════════
   3. RESET Y BASE
═══════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

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

input, textarea, select, button {
    font-family: var(--font-body);
    font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════
   4. TIPOGRAFÍA
═══════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
}

.display-title {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

.text-primary  { color: var(--color-primary); }
.text-muted    { color: var(--color-text-muted); }
.text-success  { color: var(--color-success); }
.text-warning  { color: var(--color-warning); }
.text-danger   { color: var(--color-danger); }
.text-center   { text-align: center; }
.text-sm       { font-size: 0.875rem; }
.text-lg       { font-size: 1.125rem; }
.font-bold     { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ═══════════════════════════════════════════════════════
   5. LAYOUT
═══════════════════════════════════════════════════════ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm { max-width: 800px; margin: 0 auto; padding: 0 var(--space-lg); }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 0 var(--space-lg); }

.section { padding: var(--space-3xl) 0; }
.section-sm { padding: var(--space-2xl) 0; }

/* Grid system */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

/* Flex utilities */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ═══════════════════════════════════════════════════════
   6. COMPONENTES — CARDS
═══════════════════════════════════════════════════════ */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

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

.card-glass {
    background: rgba(31, 40, 51, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(102, 252, 241, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.card-glow {
    border-color: rgba(102, 252, 241, 0.3);
    box-shadow: var(--shadow-glow);
}

/* Stat cards */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}
.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    margin: var(--space-sm) 0;
}
.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════
   7. COMPONENTES — BOTONES
═══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--color-primary);
    color: #0B0C10;
}
.btn-primary:hover {
    background: #fff;
    color: #0B0C10;
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-secondary);
    color: #fff;
}
.btn-secondary:hover {
    background: var(--color-primary);
    color: #0B0C10;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}
.btn-outline:hover {
    background: var(--color-primary);
    color: #0B0C10;
}

.btn-ghost {
    background: rgba(102, 252, 241, 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(102, 252, 241, 0.2);
}
.btn-ghost:hover {
    background: rgba(102, 252, 241, 0.15);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

.btn-sm { padding: 6px 16px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ═══════════════════════════════════════════════════════
   8. COMPONENTES — FORMULARIOS
═══════════════════════════════════════════════════════ */
.form-group { margin-bottom: var(--space-md); }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 252, 241, 0.15);
}
.form-input::placeholder { color: var(--color-text-dim); }

.form-textarea { resize: vertical; min-height: 100px; }

/* Input con icono */
.input-group { position: relative; }
.input-group .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}
.input-group .form-input { padding-left: 40px; }

/* ═══════════════════════════════════════════════════════
   9. COMPONENTES — BADGE / CHIPS
═══════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}
.badge-primary  { background: rgba(102,252,241,0.15); color: var(--color-primary); }
.badge-success  { background: rgba(34,197,94,0.15);   color: var(--color-success); }
.badge-warning  { background: rgba(245,158,11,0.15);  color: var(--color-warning); }
.badge-danger   { background: rgba(239,68,68,0.15);   color: var(--color-danger); }
.badge-muted    { background: rgba(139,157,176,0.15); color: var(--color-text-muted); }

/* ═══════════════════════════════════════════════════════
   10. COMPONENTES — KINETIX SCORE™
═══════════════════════════════════════════════════════ */
.score-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-value {
    position: absolute;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}
.score-ring .score-label {
    position: absolute;
    bottom: -4px;
    font-size: 0.6rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-bar {
    height: 6px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.score-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s ease;
    background: linear-gradient(90deg, var(--color-secondary), var(--color-primary));
}

/* ═══════════════════════════════════════════════════════
   11. COMPONENTES — AVATAR
═══════════════════════════════════════════════════════ */
.avatar {
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
}
.avatar-sm  { width: 32px;  height: 32px; }
.avatar-md  { width: 48px;  height: 48px; }
.avatar-lg  { width: 72px;  height: 72px; }
.avatar-xl  { width: 96px;  height: 96px; }
.avatar-glow { border-color: var(--color-primary); box-shadow: var(--shadow-glow); }

.avatar-placeholder {
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    color: #0B0C10;
}

/* ═══════════════════════════════════════════════════════
   12. COMPONENTES — ALERT / TOAST
═══════════════════════════════════════════════════════ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}
.alert-success { background: rgba(34,197,94,0.1);   border-color: var(--color-success); color: var(--color-success); }
.alert-warning { background: rgba(245,158,11,0.1);  border-color: var(--color-warning); color: var(--color-warning); }
.alert-danger  { background: rgba(239,68,68,0.1);   border-color: var(--color-danger);  color: var(--color-danger); }
.alert-info    { background: rgba(102,252,241,0.1); border-color: var(--color-primary); color: var(--color-primary); }

/* Toast container */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    min-width: 280px;
    font-size: 0.9rem;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

/* ═══════════════════════════════════════════════════════
   13. COMPONENTES — NAVBAR PÚBLICA
═══════════════════════════════════════════════════════ */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: rgba(11, 12, 16, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    display: flex;
    align-items: center;
}
.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}
.navbar-logo img { height: 36px; }
.navbar-nav { display: flex; align-items: center; gap: var(--space-xl); }
.navbar-nav a {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}
.navbar-nav a:hover { color: var(--color-primary); }

/* ═══════════════════════════════════════════════════════
   14. COMPONENTES — SIDEBAR DASHBOARD
═══════════════════════════════════════════════════════ */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.sidebar-logo img { height: 32px; }

.sidebar-nav { flex: 1; padding: var(--space-md) 0; }

.sidebar-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-dim);
    padding: var(--space-sm) var(--space-lg);
    margin-top: var(--space-md);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px var(--space-lg);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-radius: 0;
    position: relative;
    text-decoration: none;
}
.sidebar-link:hover {
    color: var(--color-primary);
    background: rgba(102, 252, 241, 0.06);
}
.sidebar-link.active {
    color: var(--color-primary);
    background: rgba(102, 252, 241, 0.1);
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}
.sidebar-link svg, .sidebar-link .icon { width: 20px; height: 20px; flex-shrink: 0; }

/* Badge en sidebar link */
.sidebar-link .badge-count {
    margin-left: auto;
    background: var(--color-danger);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: var(--space-xl);
    min-height: 100vh;
}

/* Page header */
.page-header {
    margin-bottom: var(--space-xl);
}
.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}
.page-header p { color: var(--color-text-muted); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════
   15. COMPONENTES — TABLA
═══════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th {
    text-align: left;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.table td {
    padding: var(--space-md);
    border-bottom: 1px solid rgba(42, 58, 74, 0.5);
    color: var(--color-text);
    vertical-align: middle;
}
.table tr:hover td { background: rgba(102, 252, 241, 0.03); }
.table tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════
   16. COMPONENTES — PROGRESS BAR
═══════════════════════════════════════════════════════ */
.progress {
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
    background: linear-gradient(90deg, var(--color-secondary), var(--color-primary));
}
.progress-sm { height: 4px; }
.progress-lg { height: 12px; }

/* ═══════════════════════════════════════════════════════
   17. COMPONENTES — WATER TRACKER
═══════════════════════════════════════════════════════ */
.water-tracker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.water-glass-wrap {
    position: relative;
    width: 80px;
    height: 120px;
}
.water-glass {
    width: 100%;
    height: 100%;
    border: 3px solid var(--color-primary);
    border-radius: 4px 4px 16px 16px;
    position: relative;
    overflow: hidden;
    background: rgba(102, 252, 241, 0.05);
}
.water-fill {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(180deg, rgba(102,252,241,0.4), rgba(69,162,158,0.6));
    transition: height 0.6s ease;
    border-radius: 0 0 13px 13px;
}
.water-wave {
    position: absolute;
    top: -10px; left: -10px; right: -10px;
    height: 20px;
    background: rgba(102,252,241,0.3);
    border-radius: 50%;
    animation: wave 2s linear infinite;
}
@keyframes wave {
    0%   { transform: translateX(0); }
    50%  { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════
   18. COMPONENTES — FOTO COMPARATIVA / SLIDER
═══════════════════════════════════════════════════════ */
.photo-compare {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: ew-resize;
    user-select: none;
}
.photo-compare img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.photo-compare .photo-after {
    clip-path: inset(0 50% 0 0);
    transition: clip-path 0s;
}
.photo-compare-divider {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--color-primary);
    z-index: 2;
}
.photo-compare-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: var(--shadow-md);
}

/* ═══════════════════════════════════════════════════════
   19. COMPONENTES — EJERCICIO CARD
═══════════════════════════════════════════════════════ */
.exercise-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
}
.exercise-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}
.exercise-card-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--color-surface-2);
    overflow: hidden;
}
.exercise-card-thumb img,
.exercise-card-thumb video {
    width: 100%; height: 100%;
    object-fit: cover;
}
.exercise-card-thumb .play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11,12,16,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.exercise-card:hover .play-overlay { opacity: 1; }
.play-btn {
    width: 48px; height: 48px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    color: #0B0C10;
}
.exercise-card-body {
    padding: var(--space-sm) var(--space-md);
}
.exercise-card-body h4 { font-size: 0.95rem; margin-bottom: 2px; }
.exercise-card-body .muscle {
    font-size: 0.75rem;
    color: var(--color-secondary);
}

/* Marca de agua en videos */
.video-watermark {
    position: absolute;
    bottom: 8px; right: 8px;
    opacity: 0.3;
    width: 40px;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   20. COMPONENTES — CHAT
═══════════════════════════════════════════════════════ */
.chat-container {
    display: flex;
    height: calc(100vh - var(--navbar-height) - 80px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.chat-sidebar {
    width: 280px;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-list { flex: 1; overflow-y: auto; }
.chat-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid rgba(42,58,74,0.3);
}
.chat-item:hover { background: rgba(102,252,241,0.04); }
.chat-item.active { background: rgba(102,252,241,0.08); }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-name { font-weight: 600; font-size: 0.9rem; }
.chat-item-preview { font-size: 0.8rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.message-bubble {
    max-width: 70%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
}
.message-bubble.mine {
    align-self: flex-end;
    background: var(--color-primary);
    color: #0B0C10;
    border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}
.message-bubble.theirs {
    align-self: flex-start;
    background: var(--color-surface-2);
    color: var(--color-text);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
}
.chat-input-bar {
    border-top: 1px solid var(--color-border);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ═══════════════════════════════════════════════════════
   21. COMPONENTES — TIMELINE
═══════════════════════════════════════════════════════ */
.timeline {
    position: relative;
    padding-left: 40px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 15px; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--color-primary), transparent);
}
.timeline-item {
    position: relative;
    margin-bottom: var(--space-xl);
}
.timeline-dot {
    position: absolute;
    left: -33px;
    top: 4px;
    width: 16px; height: 16px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    border: 3px solid var(--color-bg);
    box-shadow: 0 0 0 2px var(--color-primary);
}
.timeline-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════
   22. ANIMACIONES GLOBALES
═══════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(102,252,241,0.3); }
    50%       { box-shadow: 0 0 20px rgba(102,252,241,0.6); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-in { animation: fadeIn 0.4s ease; }
.animate-glow { animation: pulse-glow 2s infinite; }
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════════════════
   23. UTILIDADES
═══════════════════════════════════════════════════════ */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.hidden { display: none !important; }
.visible { display: block !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-lg) 0;
}

.rounded { border-radius: var(--radius-md); }
.rounded-full { border-radius: var(--radius-full); }

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Scrollbar personalizado */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-secondary); }

/* ═══════════════════════════════════════════════════════
   24. TEXTURA DE MARCA (fondo-diagonal.jpg a baja opacidad)
═══════════════════════════════════════════════════════ */
.brand-texture {
    position: absolute;
    inset: 0;
    background: url('../../brand/fondo-diagonal.jpg') center/cover no-repeat;
    opacity: 0.05;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   25. MODALES
═══════════════════════════════════════════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11,12,16,0.8);
    backdrop-filter: blur(4px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}
.modal-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    padding: var(--space-xl);
    position: relative;
    box-shadow: var(--shadow-lg);
}
.modal-box.modal-video {
    max-width: 720px;
    padding: var(--space-md);
}
.modal-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,.08);
    color: var(--color-text);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.modal-close:hover { background: rgba(255,255,255,.16); }
.modal-video video {
    width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-md);
    display: block;
    background: #000;
}
.thumb-play-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(11,12,16,.25);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.thumb-play-overlay:hover { background: rgba(11,12,16,.45); }
.thumb-play-overlay .play-btn { width: 44px; height: 44px; font-size: 1.1rem; }

/* ═══════════════════════════════════════════════════════
   26. RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: var(--space-md); }
    .container { padding: 0 var(--space-md); }
    .navbar-nav { display: none; }
    .chat-sidebar { display: none; }
}
