/* ============================================================
   MIO Panel — MCF Intelligence Director Hub
   Premium design for Malaga CF Secretaria Tecnica
   ============================================================ */

:root {
    /* MCF Colors */
    --mcf-dark: #002B52;
    --mcf-blue: #0055A0;
    --mcf-blue-light: #0068C4;
    --mcf-blue-deep: #001D3A;
    --mcf-gold: #C5A44E;
    --mcf-gold-light: #D4B96A;
    --mcf-gold-glow: rgba(197, 164, 78, 0.15);

    /* Internal-IA */
    --ia-cyan: #00D4AA;

    /* Neutrals */
    --bg: #F5F7FA;
    --bg-card: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #EDF2F7;
    --text: #1A202C;
    --text-secondary: #718096;
    --text-muted: #A0AEC0;

    /* Status */
    --green: #38A169;
    --green-bg: #F0FFF4;
    --green-light: #C6F6D5;
    --red: #E53E3E;
    --red-bg: #FFF5F5;
    --red-light: #FED7D7;
    --yellow: #D69E2E;
    --yellow-bg: #FFFFF0;
    --blue-bg: #EBF8FF;
    --purple: #805AD5;
    --purple-bg: #FAF5FF;
    --cyan-bg: #E6FFFA;
    --orange: #DD6B20;
    --orange-bg: #FFFAF0;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--mcf-blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--mcf-blue-light); }

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--mcf-dark) 0%, #001A36 100%);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.sidebar-logo {
    width: 42px; height: 42px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-brand { display: flex; flex-direction: column; }

.brand-main {
    font-size: 15px; font-weight: 700;
    letter-spacing: -0.01em; line-height: 1.2;
}

.brand-sub {
    font-size: 10px; font-weight: 600;
    color: var(--mcf-gold);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* Nav sections */
.nav-section-label {
    padding: 20px 20px 6px;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.sidebar-nav {
    flex: 1;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 1px 8px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    text-decoration: none;
}

.nav-item:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
    color: #FFFFFF;
    background: rgba(197, 164, 78, 0.1);
    border-left-color: var(--mcf-gold);
    font-weight: 600;
}

.nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-item:hover .nav-icon { opacity: 0.9; }
.nav-item.active .nav-icon { opacity: 1; color: var(--mcf-gold-light); }

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 100px;
    min-width: 20px;
    text-align: center;
    line-height: 1.3;
}

.nav-badge-amber { background: var(--mcf-gold); color: #fff; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 20px 16px;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.user-avatar-sidebar {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--mcf-gold), var(--mcf-gold-light));
    display: flex;
    align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(197, 164, 78, 0.3);
}

.user-info-sidebar { display: flex; flex-direction: column; }
.user-name-sidebar { font-size: 12px; font-weight: 600; color: #fff; }
.user-role-sidebar { font-size: 10px; color: rgba(255,255,255,0.4); }

.sidebar-powered {
    display: flex;
    align-items: center;
    gap: 8px;
}

.internalia-logo {
    width: 20px; height: 20px;
    border-radius: 4px;
    object-fit: contain;
    opacity: 0.5;
}

.powered-text {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */

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

/* ============================================================
   TOP BAR
   ============================================================ */

.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0; z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
}

.sidebar-toggle {
    display: none;
    background: none; border: none;
    color: var(--text-secondary); cursor: pointer; padding: 4px;
}

.topbar-title {
    font-size: 16px; font-weight: 700;
    color: var(--text); flex: 1;
    letter-spacing: -0.02em;
}

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

.topbar-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--green); font-weight: 500;
}

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-dot 2s infinite;
    box-shadow: 0 0 0 2px rgba(56, 161, 105, 0.2);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 2px rgba(56, 161, 105, 0.2); }
    50% { opacity: 0.6; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(56, 161, 105, 0.1); }
}

.topbar-env {
    font-size: 11px;
    padding: 3px 10px;
    background: var(--bg);
    border-radius: 6px;
    color: var(--text-muted);
    font-weight: 600;
    border: 1px solid var(--border-light);
}

/* ============================================================
   CONTENT
   ============================================================ */

.content {
    flex: 1;
    padding: 28px;
    max-width: 1320px;
    width: 100%;
}

/* ============================================================
   PANEL FOOTER
   ============================================================ */

.panel-footer {
    padding: 14px 28px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

.panel-footer strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ============================================================
   JORNADA HERO CARD
   ============================================================ */

.jornada-card {
    background: linear-gradient(135deg, var(--mcf-blue-deep) 0%, var(--mcf-dark) 50%, #003366 100%);
    border-radius: var(--radius);
    padding: 28px 28px 24px;
    margin-bottom: 22px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.jornada-card::before {
    content: '';
    position: absolute;
    top: -60%; right: -15%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(197, 164, 78, 0.1), transparent 60%);
    pointer-events: none;
}

.jornada-card::after {
    content: '';
    position: absolute;
    bottom: -40%; left: -10%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(0, 85, 160, 0.15), transparent 60%);
    pointer-events: none;
}

.jornada-label {
    font-size: 11px; font-weight: 700;
    color: var(--mcf-gold);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.jornada-title {
    font-size: 24px; font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.jornada-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.jornada-reports {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.jornada-report-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
}

.jornada-report-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-1px);
}

.jornada-report-link svg {
    width: 14px; height: 14px;
    opacity: 0.7;
}

.jornada-report-size {
    font-size: 10px;
    opacity: 0.5;
    margin-left: 2px;
}

.jornada-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.5);
}

.tag-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
}

.tag-dot-ready { background: var(--green); box-shadow: 0 0 6px rgba(56, 161, 105, 0.5); }
.tag-dot-pending { background: var(--yellow); }

/* ============================================================
   DASHBOARD HEADER
   ============================================================ */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
}

.section-title {
    font-size: 22px; font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}

.section-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================
   STAT CARDS
   ============================================================ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--border);
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.01));
    pointer-events: none;
}

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

.stat-datasets { border-left-color: var(--mcf-blue); }
.stat-players { border-left-color: var(--mcf-gold); }
.stat-reports { border-left-color: var(--green); }
.stat-alerts { border-left-color: var(--orange); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-datasets .stat-icon { background: var(--blue-bg); color: var(--mcf-blue); }
.stat-players .stat-icon { background: var(--mcf-gold-glow); color: var(--mcf-gold); }
.stat-reports .stat-icon { background: var(--green-bg); color: var(--green); }
.stat-alerts .stat-icon { background: var(--orange-bg); color: var(--orange); }

.stat-content { display: flex; flex-direction: column; }

.stat-number {
    font-size: 28px; font-weight: 800;
    line-height: 1; color: var(--text);
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 11px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

/* Animated counter */
.stat-number[data-target] {
    transition: color 0.3s ease;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: box-shadow var(--transition-slow);
}

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

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

.card-title {
    font-size: 14px; font-weight: 700; color: var(--text);
    letter-spacing: -0.01em;
}

.card-subtitle {
    font-size: 12px; color: var(--text-muted); margin-top: 1px;
}

.card-link {
    font-size: 13px; font-weight: 500; color: var(--mcf-blue);
}

.card-body { padding: 18px 22px; }
.card-body-compact { padding: 8px 22px; }

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
}

/* ============================================================
   REPORT ROWS
   ============================================================ */

.report-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.report-row:last-child { border-bottom: none; }

.report-row:hover {
    background: rgba(0, 0, 0, 0.01);
}

.report-row-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.report-row:hover .report-row-icon {
    transform: scale(1.05);
}

.report-icon-pdf { background: var(--red-bg); color: var(--red); }
.report-icon-pptx { background: var(--orange-bg); color: var(--orange); }
.report-icon-mp3 { background: var(--purple-bg); color: var(--purple); }
.report-icon-alert { background: var(--mcf-gold-glow); color: var(--mcf-gold); }
.report-icon-xlsx { background: var(--green-bg); color: var(--green); }

.report-row-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.report-row-info strong {
    font-size: 13px; font-weight: 600; color: var(--text);
}

.report-row-info span {
    font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

.report-row-actions {
    display: flex; gap: 8px;
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

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

.activity-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
    position: relative;
}

.activity-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: inherit;
    opacity: 0.2;
}

.activity-dot-green { background: var(--green); }
.activity-dot-blue { background: var(--mcf-blue); }
.activity-dot-amber { background: var(--mcf-gold); }
.activity-dot-cyan { background: var(--ia-cyan); }
.activity-dot-red { background: var(--red); }

.activity-content { display: flex; flex-direction: column; }

.activity-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.activity-text strong { color: var(--text); font-weight: 600; }

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   REPORT TABS
   ============================================================ */

.report-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--border-light);
}

.report-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}

.report-tab:hover { color: var(--text-secondary); }

.report-tab.active {
    color: var(--mcf-blue);
    border-bottom-color: var(--mcf-blue);
    font-weight: 600;
}

/* ============================================================
   ALERT PROFILE CARDS
   ============================================================ */

.alert-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.alert-section-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.alert-profiles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.alert-profile-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all var(--transition-slow);
    position: relative;
}

.alert-profile-card:hover {
    border-color: var(--mcf-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.alert-profile-active {
    border-color: rgba(197, 164, 78, 0.4);
    background: linear-gradient(135deg, #FFFFFF 0%, #FFFDF5 100%);
}

.alert-profile-active::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--mcf-gold), var(--mcf-gold-light));
    border-radius: var(--radius) var(--radius) 0 0;
}

.alert-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.alert-profile-header strong { font-size: 14px; }

.alert-profile-position {
    font-size: 12px;
    color: var(--mcf-blue);
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-profile-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.alert-profile-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alert-profile-detail svg {
    width: 12px; height: 12px;
    opacity: 0.5;
}

.alert-profile-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.metric-tag {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
}

.metric-tag:hover {
    border-color: var(--mcf-gold);
    background: var(--mcf-gold-glow);
}

.metric-tag-pass {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green-light);
}

.metric-tag-fail {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red-light);
}

.alert-profile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

/* Triggered alert cards */
.triggered-alert-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 16px;
    transition: all var(--transition-slow);
}

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

.triggered-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(90deg, var(--bg) 0%, var(--bg-card) 100%);
}

.triggered-alert-player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.triggered-alert-avatar {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--mcf-dark);
    color: #fff;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    flex-shrink: 0;
}

.triggered-alert-info { display: flex; flex-direction: column; }
.triggered-alert-name { font-size: 15px; font-weight: 700; color: var(--text); }
.triggered-alert-meta { font-size: 12px; color: var(--text-muted); }

.triggered-alert-body {
    padding: 18px 22px;
}

.triggered-alert-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.triggered-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 12px;
}

.triggered-metric-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.triggered-metric-value {
    font-weight: 700;
}

.triggered-metric-pass .triggered-metric-value { color: var(--green); }
.triggered-metric-fail .triggered-metric-value { color: var(--red); }

.triggered-alert-actions {
    display: flex;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

/* ============================================================
   TABLES
   ============================================================ */

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
}

.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr {
    transition: background var(--transition);
    cursor: pointer;
}

.table tbody tr:nth-child(even) {
    background: rgba(245, 247, 250, 0.5);
}

.table tbody tr:hover {
    background: var(--blue-bg);
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

.file-info { display: flex; align-items: center; gap: 10px; }
.file-icon { color: var(--text-muted); flex-shrink: 0; }
.file-icon-pdf { color: var(--red); }
.file-icon-pptx { color: var(--mcf-gold); }
.file-name { font-weight: 500; font-size: 13px; word-break: break-all; }

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    width: 320px;
    transition: all var(--transition);
}

.search-box:focus-within {
    border-color: var(--mcf-blue);
    box-shadow: 0 0 0 3px rgba(0, 85, 160, 0.08);
}
.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.search-input {
    border: none; background: none;
    font-family: inherit; font-size: 13px;
    color: var(--text); width: 100%; outline: none;
}
.search-input::placeholder { color: var(--text-muted); }

.position-filter {
    display: flex;
    gap: 4px;
}

.position-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.position-btn:hover {
    border-color: var(--mcf-blue);
    color: var(--mcf-blue);
}

.position-btn.active {
    background: var(--mcf-blue);
    color: #fff;
    border-color: var(--mcf-blue);
}

/* Player names */
.player-name { display: flex; align-items: center; gap: 12px; }
.player-avatar {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--mcf-dark), var(--mcf-blue));
    color: #FFFFFF;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}

/* Player modal */
.player-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.player-modal-overlay.open {
    display: flex;
}

.player-modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

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

.player-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--mcf-dark), var(--mcf-blue));
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
}

.player-modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 18px;
    transition: background var(--transition);
}

.player-modal-close:hover { background: rgba(255,255,255,0.25); }

.player-modal-body {
    padding: 24px;
}

.player-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.player-stat-item {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-align: center;
}

.player-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

.player-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-pdf { background: var(--red-bg); color: var(--red); }
.badge-pptx { background: var(--orange-bg); color: var(--orange); }
.badge-xlsx { background: var(--green-bg); color: var(--green); }
.badge-live { background: var(--green-bg); color: var(--green); }
.badge-info { background: var(--blue-bg); color: var(--mcf-blue); }
.badge-warning { background: var(--mcf-gold-glow); color: var(--mcf-gold); }
.badge-position { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border-light); }
.badge-high { background: var(--red-bg); color: var(--red); }
.badge-normal { background: var(--blue-bg); color: var(--mcf-blue); }
.badge-low { background: var(--bg); color: var(--text-muted); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gold { background: var(--mcf-gold-glow); color: var(--mcf-gold); border: 1px solid rgba(197, 164, 78, 0.2); }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(135deg, var(--mcf-blue), var(--mcf-blue-light));
    color: #FFFFFF;
    border-color: var(--mcf-blue);
    box-shadow: 0 2px 4px rgba(0, 85, 160, 0.2);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--mcf-blue-light), #007AE6);
    color: #FFFFFF;
    box-shadow: 0 4px 8px rgba(0, 85, 160, 0.3);
    transform: translateY(-1px);
}

.btn-gold {
    background: linear-gradient(135deg, var(--mcf-gold), var(--mcf-gold-light));
    color: #FFFFFF;
    border-color: var(--mcf-gold);
    box-shadow: 0 2px 4px rgba(197, 164, 78, 0.3);
}
.btn-gold:hover:not(:disabled) {
    box-shadow: 0 4px 8px rgba(197, 164, 78, 0.4);
    transform: translateY(-1px);
    color: #FFFFFF;
}

.btn-outline {
    background: transparent;
    color: var(--mcf-blue);
    border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--mcf-blue);
    background: var(--blue-bg);
    color: var(--mcf-blue);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 10px;
}
.btn-ghost:hover:not(:disabled) {
    color: var(--text);
    background: var(--bg);
}

.btn-danger { background: var(--red); color: #FFFFFF; border-color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #C53030; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-dark {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--mcf-blue);
}

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

/* ============================================================
   QUICK ACTIONS
   ============================================================ */

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text);
    text-align: left;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
}

.action-card:hover {
    border-color: var(--mcf-gold);
    box-shadow: var(--shadow);
    color: var(--text);
    transform: translateX(4px);
}

.action-card.loading { opacity: 0.7; pointer-events: none; }

.action-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
}

.action-icon svg { width: 18px; height: 18px; }

.action-icon-upload { background: var(--blue-bg); color: var(--mcf-blue); }
.action-icon-report { background: var(--mcf-gold-glow); color: var(--mcf-gold); }
.action-icon-players { background: var(--green-bg); color: var(--green); }
.action-icon-alerts { background: var(--orange-bg); color: var(--orange); }

.action-text { display: flex; flex-direction: column; }
.action-text strong { font-size: 13px; font-weight: 600; }
.action-text span { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state svg { margin-bottom: 16px; opacity: 0.3; }

.empty-state h3 {
    font-size: 17px; font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ============================================================
   UPLOAD PAGE
   ============================================================ */

.form-group { margin-bottom: 24px; }
.form-label {
    display: block;
    font-size: 13px; font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.source-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.source-option { cursor: pointer; }
.source-option input { display: none; }

.source-card {
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}
.source-card strong {
    font-size: 15px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.source-card span { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.source-logo {
    width: 28px; height: 28px;
    border-radius: 6px;
    object-fit: contain;
}

.source-option:hover .source-card {
    border-color: var(--text-muted);
}

.source-option.selected .source-card,
.source-option input:checked + .source-card {
    border-color: var(--mcf-blue);
    background: var(--blue-bg);
    box-shadow: 0 0 0 3px rgba(0, 85, 160, 0.08);
}

.source-check {
    position: absolute;
    top: 12px; right: 12px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--mcf-blue);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
}

.source-option.selected .source-check,
.source-option input:checked + .source-card .source-check {
    display: flex;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(0, 0, 0, 0.005) 10px,
        rgba(0, 0, 0, 0.005) 20px
    );
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--mcf-blue);
    background: var(--blue-bg);
}

.drop-zone-input {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
}

.drop-zone-content svg { color: var(--mcf-blue); margin-bottom: 12px; opacity: 0.4; }
.drop-zone-text { font-size: 15px; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.drop-zone-hint { font-size: 12px; color: var(--text-muted); }

.drop-zone-file {
    display: flex;
    align-items: center; justify-content: center;
    gap: 10px; font-size: 14px;
    font-weight: 600; color: var(--mcf-blue);
}

.drop-zone-remove {
    background: none; border: none;
    color: var(--red); font-size: 20px;
    cursor: pointer; padding: 4px 8px;
    border-radius: 6px; line-height: 1;
}
.drop-zone-remove:hover { background: var(--red-bg); }

/* Upload progress bar */
.upload-progress {
    display: none;
    margin-top: 16px;
}

.upload-progress.active { display: block; }

.progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mcf-blue), var(--ia-cyan));
    border-radius: 3px;
    transition: width 0.3s ease;
    animation: progressPulse 1.5s ease infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
}

/* Recent imports table */
.import-history {
    margin-top: 8px;
}

/* ============================================================
   ALERTS (inline messages)
   ============================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
}
.alert svg { flex-shrink: 0; margin-top: 1px; }

.alert-success {
    background: var(--green-bg);
    border: 1px solid var(--green-light);
    color: #276749;
}
.alert-error {
    background: var(--red-bg);
    border: 1px solid var(--red-light);
    color: #9B2C2C;
}

.alert strong { display: block; margin-bottom: 2px; }
.alert p { margin: 0; opacity: 0.85; }

/* ============================================================
   FLASH MESSAGES (floating)
   ============================================================ */

.flash-container {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash-message {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: flashIn 0.3s ease;
    max-width: 400px;
}

.flash-message.success { background: var(--green); color: #FFFFFF; }
.flash-message.error { background: var(--red); color: #FFFFFF; }

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

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

/* ============================================================
   CANTERA - WhatsApp mockup
   ============================================================ */

.cantera-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.wa-mockup {
    background: #E5DDD5;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    max-height: 500px;
}

.wa-header {
    background: #075E54;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wa-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #128C7E;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
}

.wa-header-info { display: flex; flex-direction: column; }
.wa-header-name { font-size: 14px; font-weight: 600; }
.wa-header-status { font-size: 11px; opacity: 0.8; }

.wa-messages {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.wa-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    position: relative;
}

.wa-bubble-in {
    background: #fff;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.wa-bubble-out {
    background: #DCF8C6;
    align-self: flex-end;
    border-top-right-radius: 0;
}

.wa-bubble-time {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.4);
    text-align: right;
    margin-top: 4px;
}

.wa-audio-msg {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-audio-play {
    width: 28px; height: 28px;
    background: #075E54;
    border-radius: 50%;
    display: flex;
    align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.wa-audio-wave {
    flex: 1;
    height: 20px;
    background: linear-gradient(90deg,
        rgba(7, 94, 84, 0.3) 2px, transparent 2px) left / 4px 100%;
    border-radius: 4px;
}

/* Ficha card */
.ficha-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 12px;
    transition: all var(--transition);
}

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

.ficha-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.ficha-avatar {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--mcf-dark), var(--mcf-blue));
    color: #fff;
    display: flex;
    align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}

.ficha-info { display: flex; flex-direction: column; flex: 1; }
.ficha-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ficha-meta { font-size: 11px; color: var(--text-muted); }

.ficha-body {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.ficha-stats {
    display: flex;
    gap: 8px;
    padding: 0 16px 14px;
}

.ficha-stat {
    padding: 6px 10px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.ficha-stat-value { color: var(--mcf-blue); }

/* ============================================================
   NEXT MATCH CARD
   ============================================================ */

.next-match-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    transition: all var(--transition-slow);
}

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

.next-match-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 14px;
    background: var(--mcf-dark);
    border-radius: var(--radius-sm);
    color: #fff;
    min-width: 60px;
}

.next-match-day {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.next-match-month {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin-top: 2px;
}

.next-match-info { flex: 1; }
.next-match-teams { font-size: 15px; font-weight: 700; color: var(--text); }
.next-match-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

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

@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .alert-profiles-grid { grid-template-columns: 1fr; }
    .cantera-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .content { padding: 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .source-selector { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; gap: 12px; }
    .topbar { padding: 0 16px; }
    .search-box { width: 100%; }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .position-filter { flex-wrap: wrap; }
    .triggered-alert-metrics { grid-template-columns: 1fr; }
}

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

/* ============================================================
   CHAT WIDGET — WhatsApp Style
   ============================================================ */

/* WhatsApp Colors */
:root {
    --wa-green: #25D366;
    --wa-green-dark: #075E54;
    --wa-green-header: #075E54;
    --wa-green-user: #DCF8C6;
    --wa-bg: #ECE5DD;
    --wa-bg-pattern: #E4DDD6;
    --wa-bubble-bot: #FFFFFF;
    --wa-bubble-user: #DCF8C6;
    --wa-time: #999999;
    --wa-input-bg: #F0F0F0;
}

/* Floating Action Button */
.chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wa-green);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: chatFabBounce 2s ease 0.5s 1, chatFabPulse 2.5s ease 3s 3;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

.chat-fab.active {
    background: #128C7E;
}

.chat-fab .chat-fab-icon,
.chat-fab .chat-fab-close {
    position: absolute;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-fab .chat-fab-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.chat-fab.active .chat-fab-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.chat-fab.active .chat-fab-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

@keyframes chatFabBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-12px); }
    60% { transform: translateY(-6px); }
}

@keyframes chatFabPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4); }
    50% { box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4), 0 0 0 12px rgba(37, 211, 102, 0.15); }
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    height: 550px;
    background: var(--wa-bg);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 199;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--wa-green-header);
    color: #FFFFFF;
    flex-shrink: 0;
    min-height: 56px;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-header-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.25);
}

.chat-header-text {
    display: flex;
    flex-direction: column;
}

.chat-header-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    color: #FFFFFF;
}

.chat-header-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-online-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ADE80;
    animation: onlinePulse 2s ease infinite;
}

@keyframes onlinePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chat-header-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chat-header-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scroll-behavior: smooth;
    background-color: var(--wa-bg);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' opacity='0.06'%3E%3Cdefs%3E%3Cpattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Cpath d='M20 2l2 6h6l-5 4 2 6-5-4-5 4 2-6-5-4h6z' fill='%23000' fill-opacity='0.3'/%3E%3Ccircle cx='8' cy='32' r='2' fill='%23000' fill-opacity='0.2'/%3E%3Crect x='30' y='28' width='5' height='5' rx='1' fill='%23000' fill-opacity='0.15'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='200' height='200' fill='url(%23p)'/%3E%3C/svg%3E");
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 5px;
}

/* Date Divider */
.chat-date-divider {
    display: flex;
    justify-content: center;
    margin: 8px 0 12px;
}

.chat-date-divider span {
    background: rgba(225, 219, 211, 0.9);
    color: #54656F;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Message Bubbles */
.chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 82%;
    animation: msgAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chat-msg-assistant {
    align-self: flex-start;
}

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

.chat-msg-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.chat-msg-bubble {
    padding: 7px 10px 6px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.chat-msg-text {
    white-space: pre-line;
}

.chat-msg-time {
    display: block;
    text-align: right;
    font-size: 0.65rem;
    color: var(--wa-time);
    margin-top: 3px;
    font-style: italic;
    line-height: 1;
}

/* Bot bubble — white, tail on left */
.chat-msg-assistant .chat-msg-bubble {
    background: var(--wa-bubble-bot);
    color: #303030;
    border-top-left-radius: 0;
}

.chat-msg-assistant .chat-msg-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent var(--wa-bubble-bot) transparent transparent;
}

/* User bubble — green, tail on right */
.chat-msg-user .chat-msg-bubble {
    background: var(--wa-bubble-user);
    color: #303030;
    border-top-right-radius: 0;
}

.chat-msg-user .chat-msg-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 0 0;
    border-color: var(--wa-bubble-user) transparent transparent transparent;
}

/* Typing Indicator */
.chat-typing-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    align-self: flex-start;
    animation: msgAppear 0.3s ease;
}

.chat-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    background: var(--wa-bubble-bot);
    border-radius: 8px;
    border-top-left-radius: 0;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    position: relative;
    width: fit-content;
}

.chat-typing::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent var(--wa-bubble-bot) transparent transparent;
}

.chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #90A4AE;
    animation: chatTypingBounce 1.4s ease-in-out infinite;
}

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

@keyframes chatTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Quick Chips */
.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0 4px;
    align-self: flex-start;
    transition: opacity 0.4s ease, max-height 0.4s ease;
    overflow: hidden;
    max-height: 200px;
}

.chat-chips.hiding {
    opacity: 0;
    max-height: 0;
    padding: 0;
}

.chat-chip {
    padding: 6px 14px;
    border-radius: 18px;
    border: 1px solid #B2EBF2;
    background: #E1F5FE;
    color: #0277BD;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.3;
}

.chat-chip:hover {
    background: #B3E5FC;
    border-color: #4FC3F7;
    transform: translateY(-1px);
}

/* Input Area */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: #F0F0F0;
    flex-shrink: 0;
}

.chat-attach-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    opacity: 1;
}

.chat-input {
    flex: 1;
    border: none;
    border-radius: 21px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    color: #303030;
    background: #FFFFFF;
    outline: none;
    transition: box-shadow 0.2s ease;
    min-width: 0;
}

.chat-input::placeholder {
    color: #999999;
}

.chat-input:focus {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--wa-green);
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.chat-send:hover {
    background: #20C05C;
    transform: scale(1.06);
}

.chat-send .chat-send-icon,
.chat-send .chat-mic-icon {
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-send .chat-mic-icon {
    opacity: 1;
    transform: scale(1);
}

.chat-send .chat-send-icon {
    opacity: 0;
    transform: scale(0.5);
}

.chat-send.has-text .chat-mic-icon {
    opacity: 0;
    transform: scale(0.5);
}

.chat-send.has-text .chat-send-icon {
    opacity: 1;
    transform: scale(1);
}

/* Responsive Chat */
@media (max-width: 480px) {
    .chat-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chat-fab {
        bottom: 20px;
        right: 20px;
    }
}


/* ============================================================
   SCOUTING — Valoraciones / Dato + Ojo
   ============================================================ */

.stat-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* --- Cruce Dato + Ojo cards --- */
.scouting-cruce-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cruce-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.cruce-card:hover {
    box-shadow: var(--shadow-md);
}
.cruce-coinciden { border-left: 4px solid var(--green); }
.cruce-divergencia { border-left: 4px solid var(--orange); }
.cruce-descartan { border-left: 4px solid var(--red); }

.cruce-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 10px;
}
.cruce-player {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cruce-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--mcf-dark);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
    flex-shrink: 0;
}
.cruce-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}
.cruce-meta {
    font-size: .82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.cruce-match-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}
.cruce-badge-green {
    background: var(--green-bg);
    color: var(--green);
}
.cruce-badge-orange {
    background: var(--orange-bg);
    color: var(--orange);
}
.cruce-badge-red {
    background: var(--red-bg);
    color: var(--red);
}
.cruce-match-icon {
    font-size: 1rem;
}

.cruce-body {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    padding: 20px;
    gap: 0;
}
@media (max-width: 768px) {
    .cruce-body {
        grid-template-columns: 1fr;
    }
    .cruce-divider {
        width: 100% !important;
        height: 1px !important;
        margin: 16px 0 !important;
    }
}

.cruce-col {
    padding: 0 16px;
}
.cruce-col:first-child { padding-left: 0; }
.cruce-col:last-child { padding-right: 0; }

.cruce-col-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.cruce-divider {
    width: 1px;
    background: var(--border);
    margin: 0 4px;
}

/* Rating bar */
.cruce-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.cruce-rating-bar {
    flex: 1;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}
.cruce-rating-fill {
    height: 100%;
    background: var(--green);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.cruce-fill-medium { background: var(--orange); }
.cruce-fill-low { background: var(--red); }
.cruce-rating-num {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
    min-width: 40px;
}

/* Percentile circle */
.cruce-percentile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: .88rem;
    color: var(--text-secondary);
}
.cruce-percentile-circle {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: .9rem;
    color: #fff;
    flex-shrink: 0;
}
.cruce-p-high { background: var(--green); }
.cruce-p-medium { background: var(--orange); }
.cruce-p-low { background: var(--red); }

/* Detail tags */
.cruce-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.cruce-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
}
.cruce-tag-green { background: var(--green-bg); color: var(--green); }
.cruce-tag-neutral { background: var(--bg); color: var(--text-secondary); }
.cruce-tag-red { background: var(--red-bg); color: var(--red); }

.cruce-detail-text {
    font-size: .85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.5;
}
.cruce-detail-text strong {
    color: var(--text);
}

/* Recommendation badges */
.cruce-rec {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 700;
}
.cruce-rec-fichar { background: var(--green-bg); color: var(--green); }
.cruce-rec-observar { background: var(--orange-bg); color: var(--orange); }
.cruce-rec-descartar { background: var(--red-bg); color: var(--red); }
.cruce-rec-alerta { background: var(--mcf-gold-glow); color: var(--mcf-gold); }

/* --- Scout pending cards --- */
.scout-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}
@media (max-width: 500px) {
    .scout-cards-grid { grid-template-columns: 1fr; }
}

.scout-pending-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    padding: 20px;
    transition: box-shadow var(--transition);
}
.scout-pending-card:hover {
    box-shadow: var(--shadow-md);
}
.scout-pending-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.scout-pending-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--mcf-blue);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
    flex-shrink: 0;
}
.scout-pending-name {
    font-weight: 700;
    font-size: 1rem;
}
.scout-pending-meta {
    font-size: .82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.scout-pending-info {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
}
.scout-pending-row {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    color: var(--text);
    padding: 3px 0;
}
.scout-pending-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* --- Scout form --- */
.scout-form {
    margin-top: 16px;
}
.scout-form-divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 16px;
}
.scout-form-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--mcf-dark);
    margin-bottom: 16px;
}
.scout-field {
    margin-bottom: 14px;
}
.scout-field-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 600px) {
    .scout-field-row { grid-template-columns: 1fr; }
}
.scout-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.scout-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    transition: border-color var(--transition);
}
.scout-select:focus {
    outline: none;
    border-color: var(--mcf-blue);
}
.scout-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    transition: border-color var(--transition);
}
.scout-textarea:focus {
    outline: none;
    border-color: var(--mcf-blue);
}

/* Slider */
.scout-slider-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.scout-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    outline: none;
}
.scout-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--mcf-blue);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.scout-slider::-moz-range-thumb {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--mcf-blue);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.scout-slider-val {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--mcf-blue);
    min-width: 30px;
    text-align: center;
}

/* Radio group */
.scout-radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.scout-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    color: var(--text);
    cursor: pointer;
}
.scout-radio input[type="radio"] {
    accent-color: var(--mcf-blue);
    width: 16px; height: 16px;
}

/* Success message */
.scout-success {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: var(--green-bg);
    border-radius: var(--radius-sm);
    color: var(--green);
    font-weight: 600;
    font-size: .95rem;
    margin-top: 16px;
}

/* Badge variants for cards */
.badge-amber {
    background: var(--orange-bg);
    color: var(--orange);
}
.badge-blue {
    background: var(--blue-bg);
    color: var(--mcf-blue);
}
