:root {
    --primary: #5B3E8C;
    --primary-light: #7B5EAC;
    --primary-dark: #3B1E6C;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #dee2e6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
}

.btn-back {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding-right: 3px;
    padding-bottom: 2px;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.9;
    color: white;
    margin-right: -0.5rem;
}

.btn-icon:hover {
    opacity: 1;
}

.settings-menu {
    position: absolute;
    right: 1rem;
    top: 3rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 100;
}

.settings-menu button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}

.settings-menu button:hover {
    background: var(--bg);
}

.settings-menu button:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

/* Navigation - Desktop : dans l'en-tête */
.bottom-nav {
    display: none;
}

.header-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.header-tabs .tab {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.header-tabs .tab.active {
    background: white;
    color: var(--primary);
}

.header-tabs .tab:hover {
    background: rgba(255,255,255,0.2);
}

.header-tabs .tab.active:hover {
    background: white;
}

/* Navigation - Mobile : en bas de l'écran */
@media (max-width: 768px) {
    .header-tabs {
        display: none;
    }

    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        background: linear-gradient(to top, #f8f9fa 0%, #ffffff 100%);
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        z-index: 100;
        padding: 0.5rem 1rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0));
        gap: 1rem;
    }

    .bottom-nav .tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 1rem;
        background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
        border: none;
        border-radius: 16px;
        color: var(--text-light);
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.25s ease;
        gap: 0.3rem;
        box-shadow:
            0 4px 6px rgba(0, 0, 0, 0.1),
            0 1px 3px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }

    .bottom-nav .tab:active {
        transform: scale(0.95);
        box-shadow:
            0 2px 4px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }

    .bottom-nav .tab.active {
        background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
        color: white;
        box-shadow:
            0 6px 12px rgba(91, 62, 140, 0.4),
            0 2px 4px rgba(91, 62, 140, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        transform: translateY(-2px);
    }

    .bottom-nav .tab.active:active {
        transform: translateY(0) scale(0.98);
    }

    /* Espace en bas pour la navigation fixe */
    #main-screen {
        padding-bottom: 90px;
    }
}

#jour-count {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.85;
    vertical-align: middle;
}

/* Auth screen */
#auth-screen main {
    padding: 1.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: var(--bg);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--primary);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 62, 140, 0.1);
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    text-align: center;
    padding: 0.5rem;
    background: #f8d7da;
    border-radius: 4px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
}

.tab {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.tab.active {
    background: white;
    color: var(--primary);
}

/* Écran de configuration */
#config-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#config-screen main {
    flex: 1;
    padding: 1rem;
    padding-bottom: 2rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.intro {
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

/* Sections de configuration */
.config-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.section-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
}

.section-header h2 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.section-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

.section-intro {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.section-intro strong {
    color: var(--primary);
}

#penitence-options h4 {
    margin: 1.5rem 0 0.5rem;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* Grille de cartes pour la configuration */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.25rem 0.75rem; /* Plus d'espace vertical pour le badge pré-carême */
    margin-bottom: 1rem;
    padding-top: 0.5rem; /* Espace pour le badge de la première ligne */
}

.penitence-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.75rem;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 90px;
    text-align: center;
}

.penitence-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 62, 140, 0.15);
}

.penitence-card.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(91, 62, 140, 0.3);
}

.penitence-card.selected .card-label {
    color: white;
}

.card-emoji {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.card-label {
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.3;
}

/* Ancien style checkbox (conservé pour compatibilité) */
.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    accent-color: var(--primary);
}

.checkbox-item label {
    cursor: pointer;
    flex: 1;
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--bg);
    border: 1px solid var(--primary);
    border-radius: 50%;
    cursor: help;
    position: relative;
}

.tooltip:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--primary-dark);
    color: white;
    font-size: 0.8rem;
    border-radius: 6px;
    white-space: nowrap;
    max-width: 280px;
    white-space: normal;
    text-align: center;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin-bottom: 8px;
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--primary-dark);
    margin-bottom: -4px;
    z-index: 101;
}

/* Légende de configuration */
.config-legend {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.config-legend p {
    margin-bottom: 0.5rem;
}

.config-legend ul {
    list-style: none;
    padding-left: 0;
}

.config-legend li {
    padding: 0.3rem 0;
    font-size: 0.9rem;
}

.badge-precareme-example {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.15rem 0.4rem;
    background: linear-gradient(135deg, #d4a017 0%, #f1c40f 100%);
    color: #333;
    border-radius: 4px;
    vertical-align: middle;
}

/* État pré-carême pour les cartes de pénitence */
.penitence-card.precareme {
    background: linear-gradient(135deg, var(--primary) 0%, #6a3d9a 100%);
    border-color: #d4a017;
    color: white;
    position: relative;
    box-shadow: 0 0 0 3px #d4a017, 0 4px 15px rgba(212, 160, 23, 0.3);
}

.penitence-card.precareme::after {
    content: 'PRÉ-CARÊME';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.5rem;
    background: linear-gradient(135deg, #d4a017 0%, #f1c40f 100%);
    color: #333;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.penitence-card.precareme .card-label {
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.penitence-card.precareme .card-emoji {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.custom-section {
    margin-top: 2rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #fef9f3 0%, #fdf4e8 100%);
    border: 2px solid #f0e6d3;
    border-radius: 16px;
}

.custom-header {
    margin-bottom: 1rem;
}

.custom-section h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--primary);
}

.custom-description {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    margin: 0;
}

.custom-suggestions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.suggestions-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
}

.suggestions-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-tag {
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-tag:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: scale(1.05);
}

.suggestion-tag.hidden {
    display: none;
}

/* Cartes d'engagements personnalisés */
.custom-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem 0.75rem;
    margin-bottom: 1rem;
    padding-top: 0.5rem;
}

.custom-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem 0.75rem;
    color: var(--text);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.4rem;
}

.custom-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 62, 140, 0.15);
}

.custom-card-label {
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
}

/* Boutons d'action (visibles au survol) */
.custom-card-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.custom-card:hover .custom-card-actions {
    opacity: 1;
}

.custom-card-edit,
.custom-card-delete {
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-card-edit:hover {
    background: var(--primary);
}

.custom-card-delete:hover {
    background: var(--danger);
}

/* Cartes sélectionnées */
.custom-card.selected-card {
    background: var(--primary);
    border: 2px solid var(--primary);
    color: white;
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(91, 62, 140, 0.3);
}

.custom-card.selected-card:hover {
    transform: scale(1.04);
}

.custom-card.selected-card .custom-card-label {
    color: white;
}

/* Cartes pré-carême */
.custom-card.precareme {
    background: linear-gradient(135deg, var(--primary) 0%, #6a3d9a 100%);
    border-color: #d4a017;
    box-shadow: 0 0 0 3px #d4a017, 0 4px 15px rgba(212, 160, 23, 0.3);
    color: white;
}

.custom-card.precareme::after {
    content: 'PRÉ-CARÊME';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    background: linear-gradient(135deg, #d4a017 0%, #f1c40f 100%);
    color: #333;
    border-radius: 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Carte pour ajouter */
.custom-card.add-card {
    background: transparent;
    border: 2px dashed var(--border);
    color: var(--text-light);
}

.custom-card.add-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f5f0fa;
}

.add-card-icon {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
}

/* Carte de saisie d'engagement personnalisé */
.custom-card.input-card {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    padding: 1rem;
    min-height: 100px;
    max-height: 100px;
}

.custom-card.input-card:hover {
    transform: none;
    box-shadow: none;
}

.input-card-wrapper {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 25px;
    padding: 0.3rem 0.3rem 0.3rem 0.75rem;
    width: 100%;
}

.input-card-field {
    flex: 1;
    min-width: 0;
    padding: 0.25rem 0;
    border: none;
    font-size: 0.8rem;
    background: transparent;
    color: var(--text);
}

.input-card-field::placeholder {
    color: var(--text-light);
}

.input-card-field:focus {
    outline: none;
}

.input-card-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-card-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px dashed var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin-top: 0.5rem;
}

/* Compteur de pénitences */
.penitence-counter {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    margin-top: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.counter-stats {
    display: flex;
    gap: 1rem;
}

.counter-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.counter-item.complete {
    border-color: var(--success);
    background: linear-gradient(135deg, #ffffff 0%, #d4edda 100%);
}

.counter-item.warning {
    border-color: #ffc107;
    background: linear-gradient(135deg, #ffffff 0%, #fff8e1 100%);
}

.counter-item.excellent {
    border-color: #17a2b8;
    background: linear-gradient(135deg, #ffffff 0%, #e1f5fe 100%);
}

.counter-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.counter-icon {
    font-size: 1.2rem;
}

.counter-badge-pre {
    font-size: 0.55rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    background: linear-gradient(135deg, #d4a017 0%, #f1c40f 100%);
    color: #333;
    border-radius: 4px;
}

.counter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.counter-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-track {
    flex: 1;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.4s ease, background 0.3s ease;
    min-width: 0;
}

.counter-item.complete .progress-fill {
    background: linear-gradient(90deg, #28a745 0%, #5cb85c 100%);
}

.counter-item.excellent .progress-fill {
    background: linear-gradient(90deg, #17a2b8 0%, #5bc0de 100%);
}

.counter-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 35px;
    text-align: right;
}

.counter-item.complete .counter-text {
    color: var(--success);
}

.counter-item.excellent .counter-text {
    color: #17a2b8;
}

.counter-message {
    text-align: center;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.counter-message.status-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.counter-message.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid var(--success);
}

.counter-message.status-excellent {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #17a2b8;
}

/* Lien réinitialiser */
.reset-link-container {
    text-align: center;
    margin-top: 2rem;
    padding-bottom: 1rem;
}

.btn-reset-link {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.btn-reset-link:hover {
    color: var(--text);
}

/* Barre sticky de configuration */
.config-sticky-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.sticky-counters {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.sticky-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.sticky-counter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
}

.sticky-counter-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    min-width: 40px;
}

.sticky-counter-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #6a3d9a 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sticky-counter-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    min-width: 28px;
}

.sticky-counter.complete .sticky-counter-value {
    color: var(--success);
}

.sticky-counter.complete .sticky-counter-bar .progress-fill {
    background: var(--success);
}

.btn-primary-footer {
    background: linear-gradient(135deg, var(--primary) 0%, #6a3d9a 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(91, 62, 140, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary-footer:hover {
    background: linear-gradient(135deg, #6a3d9a 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 62, 140, 0.4);
}

.btn-primary-footer:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6a3d9a 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 16px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(91, 62, 140, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6a3d9a 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 62, 140, 0.4);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(91, 62, 140, 0.3);
}

/* Bandeau d'échéances */
.echeances-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.echeance-card {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    text-align: center;
}

.echeance-card .label {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.echeance-card .status {
    font-size: 0.75rem;
}

.echeance-card.done {
    background: #d4edda;
    border-color: var(--success);
}

.echeance-card.done .status {
    color: var(--success);
}

.echeance-card.warning {
    background: #fff3cd;
    border-color: var(--warning);
}

.echeance-card.urgent {
    background: #f8d7da;
    border-color: var(--danger);
}

.echeance-card.urgent .status {
    color: var(--danger);
    font-weight: 600;
}

/* Calendrier */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--card-bg);
}

.btn-nav {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

#current-month {
    font-weight: 600;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding: 0 1rem 1rem;
    background: var(--card-bg);
}

.calendar-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    padding: 0.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    position: relative;
}

.calendar-day:hover {
    background: var(--bg);
}

.calendar-day.today {
    background: var(--primary-light);
    color: white;
    font-weight: 600;
}

.calendar-day.selected {
    outline: 2px solid var(--primary);
}

.calendar-day.outside {
    color: #ccc;
}

.calendar-day.has-entries::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
}

/* === NOUVELLE VUE TÂCHES UNIFIÉES === */
#tasks-view {
    padding: 1rem;
}

.task-section {
    margin-bottom: 1.5rem;
}

/* Navigation par jour */
.day-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.day-title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.day-title-container .section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.nav-day-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 0;
    padding: 0;
    padding-bottom: 3px;
}

.nav-day-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.nav-day-btn:active {
    transform: scale(0.95);
}

.nav-day-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    opacity: 0.5;
}

.nav-day-btn:disabled:hover {
    transform: none;
}

.btn-go-today {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.section-header-with-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.section-header-with-badge .section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.urgency-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-light);
}

.urgency-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.urgency-badge.urgent {
    background: #f8d7da;
    color: #721c24;
    animation: pulse 1.5s infinite;
}

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

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 0.75rem;
}

.task-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(91, 62, 140, 0.1);
    transform: translateX(4px);
}

.task-item:active {
    transform: scale(0.98);
}

.task-item.warning {
    border-left: 4px solid var(--warning);
    background: linear-gradient(90deg, #fff8e1 0%, var(--card-bg) 20%);
}

.task-item.urgent {
    border-left: 4px solid var(--danger);
    background: linear-gradient(90deg, #ffebee 0%, var(--card-bg) 20%);
}

.task-checkbox {
    width: 26px;
    height: 26px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.task-item.checked .task-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.task-item.checked .task-checkbox::after {
    content: '✓';
    font-weight: bold;
    font-size: 0.9rem;
}

.task-item.checked {
    opacity: 0.7;
}

.task-item.checked .task-label {
    text-decoration: line-through;
    color: var(--text-light);
}

.task-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.task-label {
    flex: 1;
    font-size: 0.95rem;
}

.task-info-tooltip {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.task-info-btn {
    font-size: 0.9rem;
    cursor: help;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.task-info-tooltip:hover .task-info-btn {
    opacity: 1;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--primary-dark);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.5;
    width: 280px;
    max-width: 80vw;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transition: opacity 0.2s, visibility 0.2s;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 10px;
    border: 6px solid transparent;
    border-top-color: var(--primary-dark);
}

.task-info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.task-deadline {
    font-size: 0.8rem;
    color: var(--text-light);
}

.task-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-light);
    flex-shrink: 0;
}

.task-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.task-badge.urgent {
    background: #f8d7da;
    color: #721c24;
}

.no-tasks {
    text-align: center;
    padding: 1rem;
    color: var(--text-light);
    font-style: italic;
}

/* Bandeau "autre jour" */
.other-day-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin: -1rem -1rem 1rem -1rem;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border-bottom: 2px solid #ffc107;
    gap: 1rem;
}

.other-day-banner span {
    font-weight: 600;
    color: #856404;
}

.btn-back-today {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-back-today:hover {
    background: #ffc107;
    color: #333;
}

/* Calendrier repliable */
.calendar-section {
    margin-top: 2rem;
}

.calendar-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    transition: all 0.2s;
}

.calendar-toggle:hover {
    background: var(--card-bg);
    border-color: var(--primary-light);
}

.toggle-arrow {
    transition: transform 0.3s ease;
}

.calendar-toggle.open .toggle-arrow {
    transform: rotate(180deg);
}

.calendar-collapsible {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

/* Anciens styles conservés pour compatibilité */
.engagement-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.engagement-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 4px;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.engagement-item.checked .engagement-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.engagement-item.checked .engagement-checkbox::after {
    content: '✓';
    font-weight: bold;
}

.engagement-label {
    flex: 1;
}

.engagement-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    background: var(--bg);
    color: var(--text-light);
}

/* Stats */
.stats-container {
    padding: 1rem;
}

.stats-container h2 {
    font-size: 1rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary);
}

.stats-container h2:first-child {
    margin-top: 0;
}

.progress-bar {
    height: 24px;
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.3s ease;
}

#progress-text {
    text-align: center;
    margin-top: 0.5rem;
    color: var(--text-light);
}

.stat-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.stat-value {
    width: 50px;
    text-align: right;
    font-weight: 600;
}

.serie-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.serie-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.serie-label {
    flex: 1;
}

.serie-count {
    font-weight: 600;
    color: var(--primary);
}

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

/* Zones de clic plus grandes sur mobile */
@media (max-width: 768px) {
    /* Cartes de pénitence */
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .penitence-card {
        padding: 0.75rem 0.5rem;
        min-height: 80px;
    }

    .card-emoji {
        font-size: 1.5rem;
    }

    .card-label {
        font-size: 0.8rem;
    }

    /* Cartes personnalisées */
    .custom-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .custom-card {
        padding: 0.75rem 0.5rem;
        min-height: 80px;
    }

    .custom-card-label {
        font-size: 0.75rem;
    }

    .custom-card.input-card {
        min-height: 80px;
        max-height: 80px;
        padding: 0.75rem;
    }

    .input-card-wrapper {
        padding: 0.3rem 0.3rem 0.3rem 0.75rem;
    }

    .input-card-field {
        font-size: 0.75rem;
    }

    .input-card-btn {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }

    /* Engagements - zones tactiles agrandies */
    .engagement-item {
        padding: 1rem 0.5rem;
        margin: 0 -0.5rem;
        min-height: 56px;
    }

    .engagement-checkbox {
        width: 32px;
        height: 32px;
        margin-right: 1rem;
    }

    .engagement-label {
        font-size: 1rem;
    }

    /* Checkboxes de configuration plus grandes */
    .checkbox-item {
        padding: 0.75rem 0;
        min-height: 52px;
    }

    .checkbox-item input[type="checkbox"] {
        width: 26px;
        height: 26px;
        margin-right: 1rem;
    }

    .checkbox-item label {
        font-size: 1rem;
    }

    /* Tooltips adaptés au mobile */
    .tooltip {
        width: 24px;
        height: 24px;
        font-size: 0.85rem;
    }

    .tooltip:hover::after,
    .tooltip:active::after {
        left: auto;
        right: 0;
        transform: none;
        max-width: 250px;
    }

    /* Calendrier optimisé */
    .calendar {
        gap: 4px;
        padding: 0.5rem;
    }

    .calendar-day {
        font-size: 0.95rem;
        min-height: 40px;
    }

    /* Header compact */
    header {
        padding: 0.75rem;
    }

    header h1 {
        font-size: 1.3rem;
    }

    .header-info {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Tabs plus grandes */
    .tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Boutons plus grands */
    .btn-primary {
        padding: 1.25rem 2rem;
        font-size: 1.1rem;
    }

    .btn-nav {
        padding: 0.75rem 1.25rem;
        font-size: 1.1rem;
    }

    /* Échéances scrollables */
    .echeances-bar {
        padding: 0.5rem;
        gap: 0.75rem;
        -webkit-overflow-scrolling: touch;
    }

    .echeance-card {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    /* Sections avec plus d'espace */
    #daily-engagements {
        padding: 0.75rem;
    }

    .engagement-category {
        margin-bottom: 1rem;
    }

    .engagement-category h3 {
        font-size: 0.9rem;
        padding: 0.5rem 0;
    }

    /* Compteur de pénitences sur mobile */
    .penitence-counter {
        padding: 1rem;
        gap: 0.75rem;
    }

    .counter-stats {
        flex-direction: column;
        gap: 0.75rem;
    }

    .counter-item {
        padding: 0.75rem;
    }

    .counter-header {
        gap: 0.4rem;
    }

    .counter-icon {
        font-size: 1rem;
    }

    .counter-label {
        font-size: 0.75rem;
    }

    .progress-track {
        height: 10px;
    }

    .counter-text {
        font-size: 0.9rem;
        min-width: 30px;
    }

    .counter-message {
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }
}

/* Très petits écrans */
@media (max-width: 380px) {
    header h1 {
        font-size: 1.1rem;
    }

    .tab {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .calendar-day {
        font-size: 0.85rem;
    }

    .engagement-label {
        font-size: 0.95rem;
    }
}

/* Touch-friendly: feedback visuel au tap */
@media (hover: none) and (pointer: coarse) {
    .engagement-item:active {
        background: var(--primary-light);
        transform: scale(0.98);
    }

    .engagement-item:active .engagement-label {
        color: white;
    }

    .calendar-day:active {
        background: var(--primary-light);
        color: white;
    }

    .checkbox-item:active {
        background: var(--bg);
    }

    .penitence-card:active {
        transform: scale(0.95);
    }

    .tab:active {
        transform: scale(0.95);
    }

    .btn-primary:active {
        transform: scale(0.98);
        background: var(--primary-dark);
    }

    /* Actions de configuration sur mobile */
    .config-sticky-footer {
        padding: 0.6rem 0.75rem;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .sticky-counters {
        gap: 0.5rem;
        width: 100%;
        order: 1;
    }

    .sticky-counter-label {
        font-size: 0.65rem;
    }

    .sticky-counter-value {
        font-size: 0.75rem;
    }

    .btn-primary-footer {
        width: 100%;
        order: 2;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

/* Empêcher le zoom sur double-tap des inputs */
input, select, textarea, button {
    font-size: 16px;
}

/* Safe area pour les téléphones avec encoche */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* === PAGE STATISTIQUES === */

.stats-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.stats-section:last-child {
    border-bottom: none;
}

.stats-section h2 {
    margin-top: 1.5rem;
}

.stats-section h2:first-child {
    margin-top: 0;
}

.section-warning {
    color: #856404 !important;
}

/* Taux global */
.taux-global {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

.taux-global-bar {
    height: 20px;
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.taux-global-bar .progress-fill {
    transition: width 0.5s ease, background-color 0.3s ease;
}

#taux-global-text {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

/* Liste d'engagements avec barres */
.engagement-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.engagement-list.collapsed {
    display: none;
}

.engagement-stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.engagement-stat-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.engagement-stat-info {
    flex: 1;
    min-width: 0;
}

.engagement-stat-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.engagement-stat-freq {
    font-size: 0.75rem;
    color: var(--text-light);
}

.engagement-stat-bar {
    width: 80px;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.engagement-stat-bar .progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.engagement-stat-pct {
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 45px;
    text-align: right;
}

/* Couleurs selon le pourcentage */
.pct-success { color: var(--success); }
.pct-warning { color: #f0ad4e; }
.pct-danger { color: var(--danger); }

.bar-success { background: var(--success) !important; }
.bar-warning { background: #f0ad4e !important; }
.bar-danger { background: var(--danger) !important; }

/* Catégories */
.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.category-bar {
    flex: 1;
    height: 16px;
    background: var(--bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.category-pct {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
}

.btn-expand {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

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

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

/* Séries */
.series-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.serie-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.serie-icon {
    font-size: 1.2rem;
}

.serie-label {
    flex: 1;
    font-size: 0.95rem;
}

.serie-count {
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.serie-count .fire {
    color: #ff6b35;
}

.series-perdues {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

.series-perdues .serie-item {
    opacity: 0.7;
    background: #fff8f8;
    border-color: #ffdddd;
}

.series-perdues .serie-count {
    color: var(--danger);
    font-weight: 500;
}

/* Graphique d'évolution */
.evolution-chart {
    min-height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.evolution-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    max-width: 60px;
    height: 100%;
    justify-content: flex-end;
}

.evolution-bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.evolution-bar.bar-success {
    background: linear-gradient(to top, #28a745 0%, #5cb85c 100%);
}

.evolution-bar.bar-warning {
    background: linear-gradient(to top, #f0ad4e 0%, #ffc107 100%);
}

.evolution-bar.bar-danger {
    background: linear-gradient(to top, #dc3545 0%, #ff6b6b 100%);
}

.evolution-label {
    font-size: 0.7rem;
    color: var(--text-light);
}

.evolution-value {
    font-size: 0.75rem;
    font-weight: 600;
}

.evolution-tendance {
    text-align: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    font-weight: 600;
}

.evolution-tendance.up {
    background: #d4edda;
    color: #155724;
}

.evolution-tendance.down {
    background: #f8d7da;
    color: #721c24;
}

.evolution-tendance.stable {
    background: #fff3cd;
    color: #856404;
}

.no-data {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: 1rem;
}

.series-perdues-title {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

/* Responsive stats */
@media (max-width: 768px) {
    .engagement-stat-bar {
        width: 60px;
    }

    .engagement-stat-pct {
        min-width: 40px;
        font-size: 0.8rem;
    }

    .evolution-chart {
        height: 150px;
        padding: 0.75rem;
    }

    .evolution-label {
        font-size: 0.6rem;
    }
}

/* === PAGE ADMIN === */

.admin-container {
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.admin-updated {
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.admin-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
}

.admin-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.admin-card-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.admin-section {
    margin-bottom: 2rem;
}

.admin-section h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.admin-table-container {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-light);
}

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

.admin-table tr:hover td {
    background: var(--bg);
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.admin-list-rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.admin-list-label {
    flex: 1;
    font-size: 0.95rem;
}

.admin-list-count {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.admin-list-taux {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--success);
}

.admin-list-taux.warning {
    color: #f0ad4e;
}

.admin-list-taux.danger {
    color: var(--danger);
}

.btn-delete-user {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-delete-user:hover {
    background: rgba(220, 53, 69, 0.1);
}

@media (max-width: 768px) {
    .admin-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .admin-card {
        padding: 1rem 0.5rem;
    }

    .admin-card-value {
        font-size: 1.5rem;
    }

    .admin-card-label {
        font-size: 0.75rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* === ADMIN HEADER === */

#admin-screen header {
    padding-bottom: 0.75rem;
}

#admin-screen header .btn-back {
    top: 1rem;
    transform: none;
}

/* === ADMIN TABS === */

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.admin-tab {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.admin-tab:hover {
    background: rgba(255, 255, 255, 0.2);
}

.admin-tab.active {
    background: white;
    color: var(--primary);
}

.admin-tab-content {
    animation: fadeIn 0.3s ease;
}

.admin-tab-content.hidden {
    display: none;
}

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

@media (max-width: 768px) {
    .admin-tabs {
        gap: 0.25rem;
    }

    .admin-tab {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* === ADMIN CHART (graphique inscriptions) === */

.admin-chart {
    min-height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.chart-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 80px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.chart-label {
    font-size: 0.7rem;
    color: var(--text-light);
    text-align: center;
}

.chart-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

/* === ADMIN COMPARISON (comparaison hebdo) === */

.admin-comparison {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.comparison-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.comparison-card.current {
    border-color: var(--primary);
    background: linear-gradient(135deg, #f8f5ff 0%, #ffffff 100%);
}

.comparison-title {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.comparison-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.comparison-detail {
    font-size: 0.8rem;
    color: var(--text-light);
}

.comparison-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.comparison-trend.up {
    background: #d4edda;
    color: #155724;
}

.comparison-trend.down {
    background: #f8d7da;
    color: #721c24;
}

.comparison-trend.stable {
    background: #fff3cd;
    color: #856404;
}

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

/* === ADMIN HEATMAP (carte thermique) === */

.admin-heatmap-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-heatmap-filter label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.admin-heatmap-filter select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--card-bg);
    cursor: pointer;
}

.admin-heatmap {
    display: grid;
    grid-template-columns: 40px repeat(7, 1fr);
    gap: 3px;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.heatmap-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    padding: 0.25rem;
}

.heatmap-week-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.heatmap-day-header {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    padding: 0.25rem;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: #ebedf0;
    cursor: pointer;
    transition: transform 0.1s;
    position: relative;
}

.heatmap-cell:hover {
    transform: scale(1.2);
    z-index: 10;
}

.heatmap-cell[data-level="0"] { background: #ebedf0; }
.heatmap-cell[data-level="1"] { background: #c6e48b; }
.heatmap-cell[data-level="2"] { background: #7bc96f; }
.heatmap-cell[data-level="3"] { background: #239a3b; }
.heatmap-cell[data-level="4"] { background: #196127; }

.heatmap-cell.outside {
    background: transparent;
    pointer-events: none;
}

.heatmap-cell.future {
    background: #f5f5f5;
    opacity: 0.5;
}

.heatmap-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.heatmap-cell:hover .heatmap-tooltip {
    opacity: 1;
    visibility: visible;
}

.admin-heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

.legend-gradient {
    width: 100px;
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(to right, #ebedf0, #c6e48b, #7bc96f, #239a3b, #196127);
}

/* === ADMIN TABLE ENHANCED === */

.admin-table .user-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-action:hover {
    background: var(--bg);
}

.btn-action.danger:hover {
    background: rgba(220, 53, 69, 0.1);
}

.admin-table .user-name {
    display: flex;
    flex-direction: column;
}

.admin-table .user-email {
    font-size: 0.8rem;
    color: var(--text-light);
}

.admin-table .user-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.admin-table .user-status.active {
    background: #d4edda;
    color: #155724;
}

.admin-table .user-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.admin-table .user-status.pending {
    background: #fff3cd;
    color: #856404;
}

/* === PENITENCES REPARTITION === */

.penitence-repartition-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.penitence-repartition-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.penitence-repartition-info {
    flex: 1;
    min-width: 0;
}

.penitence-repartition-label {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.penitence-repartition-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.penitence-repartition-bar .progress-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--primary);
}

.penitence-repartition-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 70px;
    text-align: right;
}

/* === MODALES === */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h3 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
}

.modal-info {
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: var(--bg);
    border-color: var(--text-light);
}

.btn-primary-small {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary-small:hover {
    background: var(--primary-dark);
}

/* Modale mot de passe */

.password-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.password-display code {
    flex: 1;
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.1em;
}

.btn-copy {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: var(--primary-dark);
}

.btn-copy.copied {
    background: var(--success);
}

/* === BOUTONS ACTIONS UTILISATEURS === */

.action-btns {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-edit-user,
.btn-reset-password,
.btn-delete-user {
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-edit-user:hover {
    background: rgba(91, 62, 140, 0.1);
    border-color: var(--primary);
}

.btn-reset-password:hover {
    background: rgba(255, 193, 7, 0.15);
    border-color: #ffc107;
}

.btn-delete-user:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
}

/* === BARRES STATISTIQUES === */

.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.stat-bar-label {
    min-width: 140px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
}

.stat-bar-track {
    flex: 1;
    height: 18px;
    background: var(--bg);
    border-radius: 9px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 9px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.stat-bar-fill.success {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.stat-bar-fill.warning {
    background: linear-gradient(90deg, #fd7e14 0%, #ffc107 100%);
}

.stat-bar-fill.danger {
    background: linear-gradient(90deg, #dc3545 0%, #e83e8c 100%);
}

.stat-bar-value {
    min-width: 80px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-light);
    white-space: nowrap;
}

@media (max-width: 600px) {
    .stat-bar-row {
        flex-wrap: wrap;
    }

    .stat-bar-label {
        min-width: 100%;
        margin-bottom: 0.25rem;
    }

    .stat-bar-track {
        flex: 1;
    }

    .stat-bar-value {
        min-width: auto;
    }
}

