:root {
    --club: #7b1e56;
    --club-light: #f7eef3;
    --club-dark: #5a1640;
    --club-hover: #8e2564;
    --gold: #c4952e;
    --gold-light: #faf3e0;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --text: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #999;
    --border: #e5e5e5;
    --border-strong: #ccc;
    --radius: 8px;
    --radius-lg: 12px;
    --success: #2d7a3a;
    --success-bg: #edf7ee;
    --danger: #c0392b;
    --danger-bg: #fdecea;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--club); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
    max-width: 900px;
    margin: 20px auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.04);
}

/* Topbar */
.topbar {
    background: var(--club);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo { font-size: 24px; }
.topbar-title { color: #fff; font-size: 15px; font-weight: 600; }
.topbar-sub { color: rgba(255,255,255,0.7); font-size: 12px; }
.topbar-actions { display: flex; gap: 6px; }
.topbar-btn {
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius);
    color: #fff;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    text-decoration: none;
}
.topbar-btn:hover { background: rgba(255,255,255,0.22); text-decoration: none; }

/* Navigation */
.nav-bar {
    background: var(--club-dark);
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-bar::-webkit-scrollbar { display: none; }
.nav-item {
    padding: 10px 16px;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.nav-item:hover { color: rgba(255,255,255,0.85); text-decoration: none; }
.nav-item.active { color: #fff; border-bottom-color: var(--gold); }

/* Contenu */
.content {
    background: var(--surface);
    padding: 24px;
    min-height: 400px;
}

/* Welcome */
.welcome {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}
.avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--club-light);
    color: var(--club);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 16px;
    flex-shrink: 0;
}
.welcome-titre { font-size: 20px; font-weight: 600; }
.welcome-sous { font-size: 13px; color: var(--text-secondary); }

/* Metrics */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.metric {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
.metric-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.metric-valeur { font-size: 24px; font-weight: 600; color: var(--text); }
.metric-accent .metric-valeur { color: var(--club); }
.metric-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Quick actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 24px;
}
.quick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}
.quick-btn:hover { border-color: var(--club); color: var(--club); text-decoration: none; }

/* Two columns */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Sections */
.section { margin-bottom: 20px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.section-titre { font-size: 15px; font-weight: 600; }
.section-lien { font-size: 12px; color: var(--club); }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 20px; font-weight: 600; }

/* Result rows */
.result-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    gap: 12px;
}
.result-date { min-width: 50px; text-align: center; flex-shrink: 0; }
.result-jour { font-size: 18px; font-weight: 600; line-height: 1; }
.result-mois { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; }
.result-info { flex: 1; min-width: 0; }
.result-lieu { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.result-detail-scores { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.result-score { font-size: 20px; font-weight: 600; color: var(--club); min-width: 50px; text-align: right; flex-shrink: 0; }
.result-score span { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* Licence card */
.licence-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.licence-icon { font-size: 28px; }
.licence-info { flex: 1; }
.licence-titre { font-size: 13px; font-weight: 500; }
.licence-sous { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Covoiturage */
.covoit-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    gap: 12px;
}
.covoit-info { flex: 1; min-width: 0; }
.covoit-titre { font-size: 13px; font-weight: 500; }
.covoit-lieu { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.covoit-badges { display: flex; gap: 6px; flex-shrink: 0; }

.covoit-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.covoit-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.covoit-card-header .covoit-titre { font-size: 16px; }
.covoit-statut { font-size: 13px; color: var(--text-secondary); padding: 8px 0; }
.covoit-form .form-row { margin-bottom: 8px; }

.badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-cond { background: var(--success-bg); color: var(--success); }
.badge-pass { background: var(--club-light); color: var(--club); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--club); color: #fff; }
.btn-primary:hover { background: var(--club-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* Forms */
.form { }
.form-groupe { margin-bottom: 14px; }
.form-groupe label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-secondary);
}
.form-groupe input,
.form-groupe select,
.form-groupe textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
}
.form-groupe input:focus,
.form-groupe select:focus {
    outline: none;
    border-color: var(--club);
    box-shadow: 0 0 0 3px rgba(123, 30, 86, 0.1);
}
.form-groupe input:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
}
.form-groupe input[type="file"] {
    padding: 8px;
    border-style: dashed;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.form-row .form-groupe { margin-bottom: 0; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 8px;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: auto; }

/* Auth pages */
.auth-container {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}
.auth-card {
    width: 100%;
    max-width: 400px;
}
.auth-titre { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.auth-sous-titre { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }
.auth-lien {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}
.message-ok { background: var(--success-bg); color: var(--success); }
.message-erreur { background: var(--danger-bg); color: var(--danger); }

/* Empty state */
.vide { font-size: 13px; color: var(--text-muted); padding: 8px 0; }
.vide-large {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.vide-large .btn { margin-top: 12px; }

/* Licence page */
.licence-section { }
.licence-info-bloc,
.licence-fichier-bloc {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.licence-info-bloc h2,
.licence-fichier-bloc h2 { font-size: 16px; margin-bottom: 12px; }
.licence-fichier-bloc h3 { font-size: 14px; margin: 16px 0 8px; }
.info-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-item { }
.info-label { display: block; font-size: 12px; color: var(--text-muted); }
.info-valeur { font-size: 14px; font-weight: 500; }
.licence-image { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.licence-pdf-preview { padding: 16px; text-align: center; }
.licence-etapes {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px 20px;
}
.licence-etapes li { margin-bottom: 4px; }

/* Grille volees entrainement */
.grille-volees-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
}
.grille-volees-table th {
    background: var(--club-light);
    color: var(--club);
    padding: 8px 6px;
    text-align: center;
    font-weight: 500;
    font-size: 12px;
}
.grille-volees-table td { padding: 4px; text-align: center; }
.grille-volees-table input[type="number"] {
    width: 44px;
    padding: 6px 2px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}
.grille-volees-table input:focus {
    outline: none;
    border-color: var(--club);
}
.grille-volees-table .volee-total {
    font-weight: 600;
    color: var(--club);
}
.score-total-label {
    font-size: 16px;
    text-align: right;
    padding: 12px 0;
}
.score-total-label strong {
    font-size: 24px;
    color: var(--club);
}

/* Responsive */
@media (max-width: 768px) {
    .app { margin: 0; border-radius: 0; }
    .content { padding: 16px; }
    .two-col { grid-template-columns: 1fr; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .welcome-titre { font-size: 18px; }
    .nav-item { padding: 8px 12px; font-size: 12px; }
    .nav-label { display: none; }
    .nav-icon { font-size: 18px; }
    .page-header { flex-direction: column; gap: 10px; align-items: flex-start; }
    .form-row { grid-template-columns: 1fr; }
    .info-grille { grid-template-columns: 1fr; }
    .covoit-card-header { flex-wrap: wrap; }
    .covoit-badges { width: 100%; }
}

@media (max-width: 480px) {
    .metrics { grid-template-columns: 1fr 1fr; }
    .quick-actions { grid-template-columns: 1fr; }
    .topbar { padding: 12px 14px; }
    .topbar-title { font-size: 13px; }
}
