/* ============================================================
   Teamkedin — Feuille de style principale
   ============================================================ */

:root {
    --color-primary:          #0077B5;
    --color-secondary:        #00BFA5;
    --color-accent:           #FF6B35;
    --color-primary-light:    color-mix(in srgb, var(--color-primary) 12%, white);
    --color-primary-dark:     color-mix(in srgb, var(--color-primary) 80%, black);
    --color-bg:               #F4F6F9;
    --color-surface:          #FFFFFF;
    --color-border:           #E5E7EB;
    --color-text:             #111827;
    --color-muted:            #6B7280;
    --color-light:            #9CA3AF;
    --color-success:          #10B981;
    --color-warning:          #F59E0B;
    --color-error:            #EF4444;
    --color-info:             #3B82F6;
    --font:                   -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Arial, sans-serif;
    --font-mono:              'SF Mono', 'Fira Code', Consolas, monospace;
    --radius-sm:              6px;
    --radius:                 10px;
    --radius-lg:              14px;
    --radius-xl:              20px;
    --radius-full:            9999px;
    --shadow-sm:              0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:                 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:              0 8px 32px rgba(0,0,0,0.12);
    --shadow-xl:              0 20px 60px rgba(0,0,0,0.15);
    --transition:             all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width:          252px;
    --topbar-height:          60px;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--color-bg); color: var(--color-text); line-height: 1.55; min-height: 100vh; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
hr { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }

/* ============================================================
   Typographie
   ============================================================ */
h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.3rem; font-weight: 700; line-height: 1.25; }
h3 { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
p:last-child { margin-bottom: 0; }
.text-muted  { color: var(--color-muted); }
.text-sm     { font-size: 0.85rem; }
.text-xs     { font-size: 0.75rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }

/* ============================================================
   Auth pages
   ============================================================ */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.35s ease;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
}
.auth-logo img { max-height: 52px; max-width: 200px; object-fit: contain; }
.auth-logo-text { font-size: 1.8rem; font-weight: 800; color: var(--color-primary); letter-spacing: -0.5px; }

.auth-title { font-size: 1.35rem; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-subtitle { text-align: center; color: var(--color-muted); font-size: 0.875rem; margin-bottom: 28px; line-height: 1.5; }

.auth-success-icon,
.auth-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin: 0 auto 20px;
}
.auth-success-icon { background: #d1fae5; color: #10B981; }
.auth-error-icon   { background: #fee2e2; color: #EF4444; }

.auth-footer-link { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--color-muted); }
.auth-footer-link a { color: var(--color-primary); font-weight: 500; }

.form-label-link { float: right; font-weight: 400; font-size: 0.8rem; color: var(--color-primary); }

/* Password strength */
.password-strength { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.password-strength-bar { flex: 1; height: 4px; background: var(--color-border); border-radius: 2px; overflow: hidden; }
.password-strength-fill { height: 100%; border-radius: 2px; transition: width 0.3s ease, background 0.3s ease; }
.password-strength-label { font-size: 0.75rem; font-weight: 600; white-space: nowrap; }

/* ============================================================
   Layout
   ============================================================ */
.layout {
    min-height: 100vh;
}

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

.sidebar-header {
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.sidebar-header img.sidebar-logo,
.sidebar-logo { max-height: 36px; max-width: 160px; object-fit: contain; }
.sidebar-brand { font-size: 1.1rem; font-weight: 800; color: var(--color-primary); letter-spacing: -0.3px; }
.sidebar-badge {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 4px;
}

.nav-section-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--color-light);
    padding: 10px 10px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--color-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; }
.nav-link:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.nav-link:hover svg { opacity: 1; }
.nav-link.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}
.nav-link.active svg { opacity: 1; }
.nav-link-danger:hover { background: #fee2e2; color: var(--color-error); }

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.75rem; color: var(--color-muted); margin-top: 1px; }

/* Backdrop mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.sidebar-backdrop.active { display: block; }

/* Topbar mobile */
.topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 98;
}
.topbar-menu-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    transition: var(--transition);
}
.topbar-menu-btn:hover { background: var(--color-bg); }
.topbar-brand { font-size: 1rem; font-weight: 800; color: var(--color-primary); }

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { color: var(--color-muted); font-size: 0.875rem; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   Stats grid
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stats-grid-sm {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.stat-card-sm { padding: 14px 16px; }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-body { min-width: 0; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--color-text); }
.stat-label { font-size: 0.8rem; color: var(--color-muted); margin-top: 4px; }
.stat-sub { font-size: 0.75rem; color: var(--color-muted); margin-top: 4px; }
.stat-sub a { color: var(--color-primary); }

/* ============================================================
   Card
   ============================================================ */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.card-highlight { border-color: var(--color-primary); border-width: 1.5px; }
.card-compact .card-body { padding: 14px 18px; }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-title { font-size: 0.9375rem; font-weight: 700; margin: 0; }
.card-subtitle { font-size: 0.8rem; color: var(--color-muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   Formulaires
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 0.8375rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}
.form-label .required { color: var(--color-error); margin-left: 2px; }
.form-label-link { float: right; font-weight: 400; font-size: 0.8rem; color: var(--color-primary); line-height: 1.6; }

.form-control {
    display: block;
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
    appearance: none;
    line-height: 1.5;
}
.form-control:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); }
.form-control::placeholder { color: var(--color-light); }
.form-control:disabled { background: var(--color-bg); cursor: not-allowed; color: var(--color-muted); }
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}
textarea.form-control { min-height: 90px; resize: vertical; }

.form-hint { font-size: 0.78rem; color: var(--color-muted); margin-top: 5px; display: block; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

.form-check {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}
.form-check span { font-size: 0.875rem; cursor: pointer; }

/* Password toggle */
.input-password-wrapper { position: relative; }
.input-password-wrapper .form-control { padding-right: 44px; }
.input-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--color-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: var(--transition);
}
.input-password-toggle:hover { color: var(--color-text); }
.input-password-toggle.active { color: var(--color-primary); }

/* ============================================================
   Boutons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    outline: none;
    line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; pointer-events: none; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary   { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: #fff; text-decoration: none; }

.btn-success   { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-success:hover { filter: brightness(0.92); color: #fff; text-decoration: none; }

.btn-danger    { background: var(--color-error); color: #fff; border-color: var(--color-error); }
.btn-danger:hover { filter: brightness(0.92); color: #fff; text-decoration: none; }
.btn-danger-outline { color: var(--color-error); border-color: var(--color-error); }
.btn-danger-outline:hover { background: var(--color-error); color: #fff; }
.btn-linkedin  { background: #0077B5; color: #fff; border-color: #0077B5; display:inline-flex;align-items:center;gap:6px; }
.btn-linkedin:hover { background: #005f8e; border-color: #005f8e; color: #fff; text-decoration: none; }

.btn-warning   { background: var(--color-warning); color: #fff; border-color: var(--color-warning); }
.btn-warning:hover { filter: brightness(0.92); color: #fff; text-decoration: none; }

.btn-outline {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-outline:hover { background: var(--color-bg); text-decoration: none; }

.btn-sm  { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); gap: 5px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg  { padding: 12px 26px; font-size: 1rem; }
.btn-block { width: 100%; }

/* Spinner dans bouton */
.spinner, .spinner-sm {
    width: 16px; height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}

/* ============================================================
   Tableaux
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.table thead th {
    background: var(--color-bg);
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--color-bg); }

.table-actions { display: flex; gap: 6px; align-items: center; }

/* Cellule utilisateur (avatar + nom) */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 600; font-size: 0.875rem; }
.user-role { font-size: 0.75rem; color: var(--color-muted); margin-top: 1px; }

/* Rank cell */
.rank-cell { font-size: 1.1rem; text-align: center; width: 48px; }
.rank-number { font-size: 0.8rem; font-weight: 700; color: var(--color-muted); }

/* Leaderboard rows highlighting */
.leaderboard-row.rank-1 td { background: #fffbeb; }
.leaderboard-row.rank-2 td { background: #f8fafc; }
.leaderboard-row.rank-3 td { background: #fff7f3; }
.leaderboard-row.my-row td { background: var(--color-primary-light); }

/* Code URN */
.urn-code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--color-muted); background: var(--color-bg); padding: 2px 6px; border-radius: 4px; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e3a8a; }
.badge-neutral { background: var(--color-bg); color: var(--color-muted); border: 1px solid var(--color-border); }
.badge-me      { background: var(--color-primary); color: #fff; font-size: 0.65rem; padding: 1px 7px; vertical-align: middle; margin-left: 6px; }
.badge-ad      { background: #f3e8ff; color: #6b21a8; font-size: 0.65rem; padding: 1px 7px; vertical-align: middle; }

/* Points badges */
.pts-badge { display: inline-block; font-weight: 700; font-size: 0.875rem; }
.pts-positive { color: var(--color-success); }
.pts-negative { color: var(--color-error); }
.pts-total { font-size: 1rem; font-weight: 800; color: var(--color-primary); }

/* ============================================================
   Alertes
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 16px;
    border-left: 3px solid transparent;
    line-height: 1.5;
}
.alert-success { background: #d1fae5; color: #065f46; border-color: var(--color-success); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-color: var(--color-error); }
.alert-warning { background: #fef3c7; color: #92400e; border-color: var(--color-warning); }
.alert-info    { background: #dbeafe; color: #1e3a8a; border-color: var(--color-info); }

/* ============================================================
   Toasts
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 340px;
}
.toast {
    background: #1f2937;
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-error); }
.toast-warning { background: var(--color-warning); color: #fff; }
.toast-info    { background: var(--color-info); }
.toast-icon { flex-shrink: 0; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close { margin-left: auto; background: none; border: none; color: inherit; opacity: 0.7; cursor: pointer; font-size: 1.1rem; padding: 0 0 0 8px; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }

/* ============================================================
   Modales — IMPORTANT : display:none par défaut
   ============================================================ */
.modal-overlay {
    display: none;   /* caché par défaut */
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}
.modal-overlay.active {
    display: flex;   /* visible quand .active */
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    animation: fadeInUp 0.22s ease;
}
.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 1;
}
.modal-title { font-size: 1rem; font-weight: 700; margin: 0; }
.modal-close {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--color-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    transition: var(--transition);
    font-size: 1.1rem;
    flex-shrink: 0;
}
.modal-close:hover { background: var(--color-border); color: var(--color-text); }
.modal-body { padding: 22px 24px; }
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   Onglets (Tabs)
   ============================================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 20px;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-btn {
    padding: 11px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 7px;
    user-select: none;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-btn svg { width: 15px; height: 15px; }
.tab-count {
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
}
.tab-btn.active .tab-count { background: var(--color-primary-light); color: var(--color-primary); border-color: transparent; }

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.18s ease; }

/* ============================================================
   Avatars
   ============================================================ */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}
.avatar-xs { width: 24px; height: 24px; font-size: 0.62rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.73rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.85rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.4rem; }
.avatar-initials { color: #fff; }

.avatar-stack { display: flex; flex-direction: row; }
.avatar-stack .avatar { border: 2px solid var(--color-surface); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-more { background: var(--color-bg); color: var(--color-muted); border: 2px solid var(--color-surface); font-size: 0.62rem; font-weight: 700; }

.avatar-stack-cell { display: flex; align-items: center; justify-content: center; gap: 6px; flex-direction: column; }
.avatar-stack-count { font-size: 0.75rem; font-weight: 600; color: var(--color-muted); }

/* Photo edit (admin modal) */
.photo-edit-wrapper { display: flex; align-items: center; gap: 16px; }
.photo-edit-preview { flex-shrink: 0; }
.photo-edit-actions { display: flex; flex-direction: column; gap: 8px; }

/* ============================================================
   Filter bar / chips
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-chip {
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-muted);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.filter-chip:hover { border-color: var(--color-primary); color: var(--color-primary); text-decoration: none; }
.filter-chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ============================================================
   Sync status
   ============================================================ */
.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.875rem;
}
.sync-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sync-ok .sync-dot { background: var(--color-success); }
.sync-error .sync-dot { background: var(--color-error); }
.sync-ok { color: var(--color-success); }
.sync-error { color: var(--color-error); }
.sync-time { color: var(--color-muted); font-weight: 400; margin-left: 4px; }
.sync-message { font-size: 0.8rem; color: var(--color-muted); margin-top: 6px; }

/* ============================================================
   Leaderboard spécifique
   ============================================================ */
.leaderboard-mini { display: flex; flex-direction: column; gap: 6px; }
.leaderboard-mini-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--color-bg);
    border-radius: var(--radius);
    font-size: 0.875rem;
}
.rank-mini { width: 24px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.name-mini { flex: 1; font-weight: 600; }
.pts-mini { font-weight: 700; color: var(--color-primary); }
.section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); margin-bottom: 8px; }

/* ============================================================
   Winners / période
   ============================================================ */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--color-success); animation: pulse 2s infinite; }
.status-active { background: var(--color-success); }
.chip-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--color-success); margin-left: 6px; vertical-align: middle; }

.two-col-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.col-main { min-width: 0; }
.col-side { min-width: 0; }

.winner-slot { padding: 16px 0; }
.winner-slot-header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.winner-medal { font-size: 1.5rem; }
.winner-label { font-weight: 700; font-size: 0.875rem; }
.winner-divider { border: none; border-top: 1px dashed var(--color-border); margin: 4px 0; }

/* Leaderboard winner rows */
tr.winner-row { background: #fffbeb; }
tr.winner-row:hover { background: #fef3c7; }
.winner-gift-label { font-weight: 600; color: var(--color-primary); font-size: 0.875rem; }

/* ============================================================
   Archive
   ============================================================ */
.archive-winners {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.archive-winner-card {
    flex: 0 0 140px;
    text-align: center;
    padding: 16px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.winner-medal-big { font-size: 2rem; }
.winner-name { font-weight: 700; font-size: 0.85rem; }
.winner-gift { font-size: 0.75rem; color: var(--color-muted); }
.winner-note { font-size: 0.72rem; color: var(--color-muted); font-style: italic; }

.archive-leaderboard-details { margin-top: 8px; }
.archive-leaderboard-toggle {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 600;
    padding: 6px 0;
    user-select: none;
}

/* ============================================================
   Dashboard salarié
   ============================================================ */
.my-rank-card {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.my-rank-position { text-align: center; flex-shrink: 0; }
.my-rank-medal { font-size: 2.5rem; display: block; }
.my-rank-number { font-size: 2.5rem; font-weight: 800; display: block; }
.my-rank-number sup { font-size: 1rem; }
.my-rank-label { font-size: 0.75rem; opacity: 0.8; margin-top: 2px; display: block; }
.my-rank-stats { display: flex; gap: 20px; }
.my-rank-stat { text-align: center; }
.stat-val { display: block; font-size: 1.4rem; font-weight: 800; }
.stat-lbl { display: block; font-size: 0.72rem; opacity: 0.8; margin-top: 1px; }
.my-rank-total { margin-left: auto; text-align: right; }
.total-pts { display: block; font-size: 2.2rem; font-weight: 800; line-height: 1; }
.total-label { display: block; font-size: 0.75rem; opacity: 0.8; margin-top: 2px; }
.pts-breakdown { font-size: 0.72rem; opacity: 0.65; margin-top: 6px; line-height: 1.6; }

/* Posts */
.posts-toolbar { margin-bottom: 12px; }
.posts-search { max-width: 320px; }
.post-text { font-size: 0.85rem; line-height: 1.45; color: var(--color-text); max-width: 440px; }
.post-date { font-size: 0.75rem; color: var(--color-muted); margin-top: 3px; }
.btn-post-expand { background: none; border: none; cursor: pointer; color: var(--color-primary); padding: 0; display: inline-flex; align-items: center; gap: 3px; font-size: 0.8rem; font-weight: 600; vertical-align: middle; margin-left: 4px; white-space: nowrap; }
.btn-post-expand:hover { text-decoration: underline; }
.post-mention { color: var(--color-primary); text-decoration: none; }
.post-mention:hover { text-decoration: underline; }
.post-hashtag { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.post-hashtag:hover { text-decoration: underline; }

/* Bandeau lots dans l'onglet Posts */
.gifts-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: 12px; font-size: 0.82rem; }
.gifts-strip-label { font-weight: 600; color: var(--color-muted); flex-shrink: 0; }
.gift-strip-chip { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 20px; padding: 3px 10px; font-size: 0.8rem; }

/* Récompenses */
.gifts-bar { display: flex; gap: 12px; flex-wrap: wrap; }
.gift-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    flex: 0 0 auto;
}
.gift-medal { font-size: 1.3rem; }
.gift-photo { width: 36px; height: 36px; border-radius: var(--radius-sm); object-fit: cover; }
.gift-info { display: flex; flex-direction: column; gap: 2px; }
.gift-desc { font-weight: 600; font-size: 0.875rem; }
.gift-value { font-size: 0.75rem; color: var(--color-muted); }

/* ============================================================
   Profil
   ============================================================ */
.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}
.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}
.avatar-upload-label {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px; height: 28px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    border: 2px solid var(--color-surface);
    transition: var(--transition);
}
.avatar-upload-label:hover { filter: brightness(0.9); }
.avatar-upload-label svg { width: 14px; height: 14px; }
.profile-name { font-size: 1.1rem; font-weight: 700; }
.profile-role { font-size: 0.875rem; color: var(--color-muted); margin-top: 3px; }

/* ============================================================
   Settings grid
   ============================================================ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.logo-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

/* Barème */
.bareme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.bareme-item {
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.bareme-icon { font-size: 1.8rem; }
.bareme-label { font-size: 0.85rem; font-weight: 600; color: var(--color-muted); }
.bareme-input-group { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 4px; }
.bareme-input { width: 80px; text-align: center; font-size: 1.2rem; font-weight: 700; }
.bareme-unit { font-size: 0.875rem; font-weight: 600; color: var(--color-muted); }

/* Color picker */
.color-input-group { display: flex; align-items: center; gap: 10px; }
.color-picker-preview { width: 36px; height: 36px; border-radius: var(--radius); border: 1.5px solid var(--color-border); flex-shrink: 0; }
.color-picker-input {
    width: 44px; height: 36px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    cursor: pointer;
    padding: 3px;
    background: transparent;
    flex-shrink: 0;
}
.color-preview-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: var(--color-bg);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    margin-top: 16px;
    font-size: 0.85rem;
}

/* ============================================================
   Gift table
   ============================================================ */
.gift-cell { display: flex; align-items: center; gap: 10px; }
.gift-thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--color-border); }
.rank-badge { font-size: 1.2rem; text-align: center; }

/* SMTP toggle */
.mail-mode-selector { display: flex; gap: 12px; margin-bottom: 20px; }
.mail-mode-option {
    flex: 1;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.mail-mode-option:hover { border-color: var(--color-primary); }
.mail-mode-option.selected { border-color: var(--color-primary); background: var(--color-primary-light); }
.mail-mode-option input[type="radio"] { margin-top: 2px; accent-color: var(--color-primary); flex-shrink: 0; }
.mail-mode-title { font-weight: 700; font-size: 0.875rem; }
.mail-mode-desc { font-size: 0.78rem; color: var(--color-muted); margin-top: 2px; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes pulse     { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid-sm { grid-template-columns: repeat(2, 1fr); }
    .two-col-layout { grid-template-columns: 1fr; }
    .form-row-4 { grid-template-columns: 1fr 1fr; }
}

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

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
    .sidebar.open { transform: translateX(0); }
    .topbar { display: flex; }
    .main-content { margin-left: 0; padding: 16px; padding-top: calc(var(--topbar-height) + 16px); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .two-col-layout { grid-template-columns: 1fr; }
    .my-rank-card { flex-direction: column; text-align: center; }
    .my-rank-total { margin-left: 0; text-align: center; }
    .modal { max-height: 96vh; }
    #toast-container { bottom: 16px; right: 16px; left: 16px; max-width: 100%; }
    .archive-winners { justify-content: center; }
}

@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; }
    .stats-grid { grid-template-columns: 1fr; }
    .bareme-grid { grid-template-columns: 1fr; }
    .main-content { padding: 12px; padding-top: calc(var(--topbar-height) + 12px); }
}
