.drawer {
    position: fixed;
    top: 0;
    right: -550px;
    width: 500px;
    height: 100%;
    max-width: 100%;
    background: var(--c-surface);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer.open { right: 0; }
.drawer__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1999;
}
.drawer__header {
    padding: 20px;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.drawer__header h3 {
    margin:0;
}
.drawer__form {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 24px;
    flex-grow: 1;
    overflow-y: auto;
}
.drawer__form-close {
    background:none;
    border:none;
    font-size:var(--text-4xl);
    cursor:pointer;
}
.drawer__tile {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.drawer__tile-label {
    cursor: pointer;
    margin: 0;
}
.drawer__tile-label input, .drawer_privacy-item input {
    display: none;
}
.drawer__tile-label:hover .drawer__tile-content {
    border-color: var(--c-green);
    background: var(--c-green-tint);
}
.drawer__tile-label input:checked + .drawer__tile-content {
    border-color: var(--c-green-dark);
    background: var(--c-green-dark);
    box-shadow: var(--shadow-md);
}
.drawer__tile-label input:checked + .drawer__tile-content span {
    color: #fff;
}
.drawer__tile-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-pill);
    background: var(--c-surface);
    transition: all 0.2s ease;
}
.drawer__tile-content span {
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--c-text);
}
.drawer_privacy {
    display: flex;
    background: var(--c-surface-alt);
    padding: 6px;
    border-radius: var(--radius-lg);
    gap: 4px;
}
.drawer_privacy-item { 
    flex: 1; 
    cursor: pointer; 
    margin: 0; 
}
.drawer_privacy-item input:checked + .drawer_privacy-item--content {
    background: var(--c-surface);
    color: var(--c-green);
    box-shadow: var(--shadow-md);
    border-color: var(--c-border);
}

.drawer_privacy-item input:checked + .drawer_privacy-item--content i {
    color: var(--c-green);
}
.drawer_privacy-item--content {
    padding: 12px 8px;
    text-align: center;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--c-muted);
    transition: all 0.2s ease;
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    gap: 6px;
    background: transparent;
    border: 1px solid transparent;
}
.drawer_privacy-item--content i {
    font-size: var(--text-xl);
    color: var(--c-subtle);
}
.drawer__calendar { 
    border: 1px solid var(--c-border); 
    border-radius: var(--radius-lg); 
    padding: 16px; 
    background: var(--c-surface);
}
.drawer__calendar-header { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.drawer__calendar-header--selects {
    display: flex;
    gap: 6px;
}
.drawer__calendar-nav--prev, .drawer__calendar-nav--next {
    background: var(--c-surface-alt);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.drawer__calendar-nav:hover {
    background: var(--c-border);
}
.drawer__calendar-days { 
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.drawer__calendar-date--selected {
    margin-bottom: 10px;
    font-size: var(--text-sm);
    color: var(--c-green);
    background: var(--c-green-light);
    padding: 10px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 600;
}
/* Aucune date choisie (occasion autre que « Mes envies ») */
.drawer__calendar-date--missing {
    color: var(--c-danger-dark);
    background: var(--c-danger-bg);
}
.drawer__calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--c-muted); }
.drawer__calendar-day:hover { background: var(--c-surface-alt); }
.drawer__calendar-day--selected { 
    background: var(--c-green-dark) !important;
    color: white !important;
    font-weight: 600;
}
.drawer__footer {
    padding: 20px 0 0 0;
    border-top: 1px solid var(--c-border);
    display: flex;
    gap: 12px;
    background: var(--c-surface);
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .drawer { 
        width: 100%;
        right: -100%;
    }
    .drawer__tile-content { padding: 6px 12px; }
    .drawer__tile-content span { font-size: var(--text-sm); }
    .drawer_privacy { flex-wrap: wrap; }
    .drawer_privacy-item { flex: 0 0 calc(50% - 4px); }
    .drawer_privacy-item--content {
        padding: 8px 4px;
        font-size: var(--text-2xs);
    }
}
.drawer__res-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.drawer__res-option:hover { border-color: var(--c-green-light); background: var(--c-green-tint); }

/* Le bloc est un <label> : on annule le style des titres de champ (.form-group > label en inline-block)
   pour qu'il passe sous « Réservations », sur toute la largeur, comme les autres champs */
.form-group > .drawer__res-option {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    font-weight: 400;
}

/* Tiroir ouvert par un collaborateur : confidentialité, code et mode surprise réservés au propriétaire */
.drawer__owner-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--c-surface-alt);
    color: var(--c-muted);
    font-size: var(--text-sm);
    line-height: 1.5;
}
.drawer__owner-note i { display: flex; margin-top: 2px; }

.drawer__res-option-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--c-green-tint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    color: var(--c-green);
    flex-shrink: 0;
    transition: background 0.15s;
}

.drawer__res-option-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.drawer__res-option-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--c-text);
}
.drawer__res-option-desc {
    font-size: var(--text-xs);
    color: var(--c-muted);
    line-height: 1.5;
}

.drawer__res-switch {
    position: relative;
    flex-shrink: 0;
}
.drawer__res-switch input { display: none; }
.drawer__res-track {
    display: block;
    width: 46px;
    height: 26px;
    background: var(--c-border);
    border-radius: var(--radius-pill);
    transition: background 0.2s;
    position: relative;
    cursor: pointer;
}
.drawer__res-switch input:checked ~ .drawer__res-track { background: var(--c-green-fill); }
.drawer__res-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s;
    box-shadow: var(--shadow-sm);
}
.drawer__res-switch input:checked ~ .drawer__res-track .drawer__res-thumb { left: 23px; }

.drawer__res-option:has(input:checked) {
    border-color: var(--c-green-light);
    background: var(--c-green-tint);
}
.drawer__res-option:has(input:checked) .drawer__res-option-icon {
    background: var(--c-green-tint);
}

/* Application iPhone : le panneau commence sous la barre d'état et ses boutons restent au-dessus de la barre d'accueil */
.is-app .drawer {
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}
