:root {
    --home-primary: #2C5545;
    --home-secondary: #F5F0E5;
    /* Typo unique des fiches : petite, harmonieuse, s'adapte à l'écran (rem) */
    --home-card-text: 0.8125rem;
    /* Couleurs typo harmonisées : 2 niveaux max pour cohérence visuelle */
    --home-card-text-color: #1F2933;
    --home-card-text-muted: #4B5563;
}

.home-body {
    margin: 0;
    min-height: 100vh;
    background: var(--home-primary);
    color: var(--home-secondary);
    font-family: var(--font-body, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    display: flex;
    flex-direction: column;
}

/* Header : fond blanc */
.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #FFFFFF;
    color: var(--home-primary);
}

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

.home-logo {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
}

.home-logo-main {
    color: var(--color-primary, var(--home-primary));
}

.home-logo-accent {
    color: var(--color-accent, #D4A373);
}

/* Bouton hamburger : style desktop (pages avec header-logged-drawer) */
body:has(.header-logged-drawer) .home-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--home-primary);
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

body:has(.header-logged-drawer) .home-menu-btn:hover {
    background: rgba(44, 85, 69, 0.1);
}

body:has(.header-logged-drawer) .home-menu-btn:focus {
    outline: 2px solid var(--home-primary);
    outline-offset: 2px;
}

body:has(.header-logged-drawer) .home-menu-btn-icon {
    width: 24px;
    height: 24px;
}

.home-account {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--color-primary, var(--home-primary));
    color: #FFFFFF;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.home-account-icon {
    width: 20px;
    height: 20px;
}

.home-main {
    display: flex;
    align-items: stretch;
    gap: 24px;
    padding: 24px;
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
}

/* Sidebar : fond blanc */
.home-sidebar {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.home-sidebar-inner {
    background: #FFFFFF;
    color: var(--home-primary);
    border-radius: 20px;
    padding: 16px 16px 56px 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
}

.home-sidebar-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 12px;
    opacity: 0.75;
}

.home-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.home-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--home-primary);
    font-size: 0.9rem;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.home-nav-item--active {
    background: rgba(44, 85, 69, 0.12);
    font-weight: 600;
}

.home-nav-item:hover {
    background: rgba(44, 85, 69, 0.16);
    transform: translateY(-1px);
}

.home-nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

.home-sidebar-toggle {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--home-primary);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.home-sidebar-toggle:hover {
    background: #234a3a;
    transform: scale(1.05);
}

.home-sidebar-toggle-icon {
    width: 13px;
    height: 13px;
    display: block;
}

.home-sidebar-toggle-icon.hidden {
    display: none;
}

/* Sidebar replié */
.home-sidebar--collapsed .home-sidebar-inner {
    padding: 16px 10px 20px;
    align-items: center;
}

.home-sidebar--collapsed .home-sidebar-title {
    display: none;
}

.home-sidebar--collapsed .home-nav {
    align-items: center;
}

.home-sidebar--collapsed .home-nav-item {
    justify-content: center;
    padding: 10px;
}

.home-sidebar--collapsed .home-nav-text {
    display: none;
}

.home-sidebar--collapsed {
    flex: 0 0 56px;
}

.home-sidebar--collapsed .home-sidebar-toggle-icon--collapse {
    display: none;
}

.home-sidebar--collapsed .home-sidebar-toggle-icon--expand {
    display: block;
}

.home-sidebar--collapsed .home-sidebar-toggle-icon--expand.hidden {
    display: block !important;
}

.home-sidebar:not(.home-sidebar--collapsed) .home-sidebar-toggle-icon--expand {
    display: none;
}

/* Content */
.home-content {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.home-content-header {
    padding: 8px 0 4px;
}

.home-content-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.home-personnaliser-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--home-secondary);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.home-personnaliser-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.home-personnaliser-btn:focus {
    outline: 2px solid var(--home-secondary);
    outline-offset: 2px;
}

.home-personnaliser-icon {
    width: 20px;
    height: 20px;
}

.home-title {
    margin: 0 0 4px;
    font-size: 1.5rem;
    color: #FFFFFF;
}

.home-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(245, 240, 229, 0.85);
}

/* Bannière PWA */
.home-pwa-banner {
    padding: 13px 18px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 13px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--home-primary);
}
.home-pwa-banner__text {
    margin: 0 0 12px;
    font-size: var(--home-card-text);
}
.home-pwa-banner__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.home-pwa-banner__btn {
    padding: 8px 16px;
    border-radius: 10px;
    border: none;
    font-size: var(--home-card-text);
    cursor: pointer;
    font-family: inherit;
}
.home-pwa-banner__btn--primary {
    background: var(--home-primary);
    color: #FFFFFF;
}
.home-pwa-banner__btn--secondary {
    background: transparent;
    color: var(--home-primary);
    border: 1px solid var(--home-primary);
}

.home-panels-section {
    margin-bottom: 24px;
}

.home-panels-section:last-child {
    margin-bottom: 0;
}

.home-panels-section-title {
    margin: 0 0 12px;
    font-size: var(--home-card-text);
    font-weight: 600;
    color: rgba(245, 240, 229, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.home-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

/* Cards */
.home-card {
    background: #FFFFFF;
    color: var(--home-card-text-color);
    border-radius: 18px;
    padding: 14px 16px 16px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.home-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.home-card:focus {
    outline: 2px solid var(--home-primary);
    outline-offset: 2px;
}

.home-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.home-card-title {
    margin: 0;
    font-size: var(--home-card-text);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.home-card-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

.home-card-text {
    margin: 0;
    font-size: var(--home-card-text);
    line-height: 1.4;
    color: var(--home-card-text-color);
}

.home-card-text--muted {
    color: var(--home-card-text-muted);
    font-size: var(--home-card-text);
}

.home-card-list {
    margin: 0;
}

.home-card-list-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.home-card-list-items li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: var(--home-card-text);
    line-height: 1.4;
}

.home-card-list-date {
    color: var(--home-card-text-muted);
    font-size: var(--home-card-text);
    flex-shrink: 0;
    min-width: 90px;
}

.home-card-list-label {
    color: var(--home-card-text-color);
    flex: 1;
}

.home-card-list-more {
    color: var(--home-card-text-muted);
    font-size: var(--home-card-text);
    font-style: italic;
    margin-top: 2px;
}

.home-card-list-item--over {
    display: none !important;
}

.home-card--expanded .home-card-list-item--over {
    display: flex !important;
}

.home-card-expand-hint {
    margin: 6px 0 0;
    font-size: var(--home-card-text);
    color: var(--home-card-text-muted);
    font-style: italic;
}

.home-card--expanded .home-card-expand-hint {
    display: none;
}

.home-card-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.home-card-footer--hidden {
    display: none;
}

.home-card--expanded .home-card-footer--hidden {
    display: block;
}

.home-card-link {
    font-size: var(--home-card-text);
    color: var(--home-primary);
    text-decoration: none;
    font-weight: 500;
}

.home-card-link:hover {
    text-decoration: underline;
}

.home-card--expandable {
    cursor: pointer;
}

.home-card--expandable .home-card-link {
    pointer-events: auto;
}

.home-card--expandable .home-card-header::after {
    content: '';
    width: 16px;
    height: 16px;
    margin-left: auto;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234B5563'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    transition: transform 0.2s ease;
}

.home-card--expanded .home-card-header::after {
    transform: rotate(180deg);
}

.home-card-list-items--todo .home-card-todo-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.home-card-todo-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid var(--home-primary);
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
}

.home-card-todo-checkbox--checked {
    background: var(--home-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
    background-size: 10px 8px;
    background-position: center;
    background-repeat: no-repeat;
}

.home-card-todo-item--done .home-card-todo-label {
    text-decoration: line-through;
    color: var(--home-card-text-muted, #6b7280);
}

.home-card-todo-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-card-todo-label[data-expanded="true"] {
    white-space: normal;
    overflow: visible;
}

.home-card-data-source {
    display: flex;
    align-items: center;
    gap: 10px;
}

.home-card-data-logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.home-card-data-text {
    font-size: var(--home-card-text);
    color: var(--home-card-text-color);
}

.home-card--email {
    border-inline-start: 3px solid var(--home-primary);
}

.home-card--tasks {
    border-inline-start: 3px solid #2563EB;
}

.home-card--pricing {
    border-inline-start: 3px solid #D97706;
}

.home-card--data {
    border-inline-start: 3px solid #0F766E;
}

.home-card--summary {
    border-inline-start: 3px solid #A21CAF;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 960px) {
    .home-main {
        flex-direction: column;
        gap: 16px;
    }

    .home-sidebar {
        flex: 0 0 auto;
    }

    .home-sidebar-inner {
        flex: none;
    }

    .home-sidebar--collapsed {
        flex: 0 0 auto;
    }

    .home-sidebar--collapsed .home-sidebar-inner {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .home-sidebar--collapsed .home-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .home-sidebar-toggle {
        position: static;
        margin-top: 8px;
    }
}

@media (max-width: 640px) {
    .home-header {
        padding-inline: 16px;
    }

    .home-main {
        padding-inline: 16px;
    }

    .home-sidebar-inner {
        border-radius: 16px;
    }

    .home-panels {
        grid-template-columns: 1fr;
    }
}

/* Modal personnalisation profil */
.home-profile-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: visibility 0.2s ease, opacity 0.2s ease;
}

.home-profile-modal--open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.home-profile-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.home-profile-modal__dialog {
    position: relative;
    background: #FFFFFF;
    border-radius: 18px;
    padding: 24px;
    width: min(440px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.home-profile-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--home-card-text-muted);
}

.home-profile-modal__close:hover {
    color: var(--home-primary);
}

.home-profile-modal__content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.home-profile-modal__icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(44, 85, 69, 0.12);
    border-radius: 12px;
}

.home-profile-modal__icon-img {
    width: 24px;
    height: 24px;
}

.home-profile-modal__content h3 {
    margin: 0 0 4px;
    font-size: 1.15rem;
    color: var(--home-card-text-color);
}

.home-profile-modal__content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--home-card-text-muted);
}

.home-profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.home-profile-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--home-card-text-color);
    margin-bottom: 4px;
}

.home-profile-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
}

.home-profile-field input:focus {
    outline: none;
    border-color: var(--home-primary);
    box-shadow: 0 0 0 2px rgba(44, 85, 69, 0.15);
}

.home-profile-status {
    font-size: 0.875rem;
    margin: 0;
}

.home-profile-actions {
    margin-top: 4px;
}

.home-profile-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--home-primary);
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.home-profile-save-btn:hover {
    filter: brightness(1.08);
}
