/* =============================================================================
   PLANNING V2 — Extras (nouvelles fonctionnalités)
   ============================================================================= */

/* ── Default modal max-width ─────────────────────────────────────────────────── */
.p2-modal { max-width: 560px; }

/* ── Backdrop modal (alias) ──────────────────────────────────────────────────── */
.p2-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: var(--p2-z-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.p2-modal-lg  { max-width: 780px; }
.p2-modal-xl  { max-width: 960px; }

/* ── Tabs dans la modal ──────────────────────────────────────────────────────── */
.p2-modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-panel);
    flex-shrink: 0;
}
.p2-modal-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--trans-fast);
}
.p2-modal-tab:hover { color: var(--text-main); }
.p2-modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Form helpers ────────────────────────────────────────────────────────────── */
.p2-form-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.p2-form-input {
    background: var(--bg-body);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: var(--text-sm);
    padding: 9px 12px;
    outline: none;
    transition: border-color var(--trans-fast);
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.p2-form-input:focus { border-color: var(--accent); }
.p2-form-input::placeholder { color: var(--text-muted); opacity: .6; }
.p2-muted { color: var(--text-muted); }

/* ── Boutons variantes ───────────────────────────────────────────────────────── */
/* Double convention : .p2-btn.primary (conv A) ET .p2-btn-primary (conv B) — forcés visibles */
.p2-btn.primary,
.p2-btn-primary {
    background: var(--accent, #3B82F6) !important;
    border: 1px solid var(--accent, #3B82F6) !important;
    color: #fff !important;
    padding: 8px 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.p2-btn.primary:hover:not(:disabled),
.p2-btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.p2-btn-ghost {
    background: transparent;
    border: 1px solid var(--border-panel);
    color: var(--text-muted);
}
.p2-btn-ghost:hover:not(:disabled) { background: var(--bg-body); color: var(--text-main); }
.p2-btn-danger-ghost {
    background: transparent;
    border: 1px solid rgba(220,38,38,.3);
    color: #ef4444;
}
.p2-btn-danger-ghost:hover:not(:disabled) { background: rgba(220,38,38,.1); }
.p2-btn-sm { padding: 5px 10px; font-size: var(--text-xs); }
.p2-btn-danger { background: rgba(220,38,38,.1); border-color: rgba(220,38,38,.3); color: #ef4444; }
.p2-btn-danger:hover:not(:disabled) { background: rgba(220,38,38,.2); }


/* Les labels sont toujours visibles — la toolbar scrolle si besoin */
.p2-tb-btn-label { display: inline; }

/* ── Bandeau semaine validée ──────────────────────────────────────────────────── */
.p2-validated-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    background: rgba(16,185,129,.08);
    border-bottom: 1px solid rgba(16,185,129,.2);
    font-size: var(--text-xs);
    font-weight: 600;
    color: #10b981;
    flex-shrink: 0;
}

/* ── Badge Férié dans l'en-tête ───────────────────────────────────────────────── */
.p2-ferie-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--seg-ferie, #F43F5E);
    margin-top: 2px;
}
.p2-col-day.ferie { background: rgba(244,63,94,.04); }
.p2-day-cell.ferie { background: rgba(244,63,94,.04); }

/* ── Grille complète : bordures horizontales renforcées ─────────────────────── */
.p2-grid tbody tr { border-bottom: 1px solid var(--border-panel); }
.p2-day-cell, .p2-member-cell {
    border-bottom: 1px solid var(--border-panel);
    border-right:  1px solid var(--border-panel);
}
.p2-grid-head .p2-col-day { border-right: 1px solid var(--border-panel); border-bottom: 1px solid var(--border-panel); }
.p2-grid-head .p2-col-member { border-right: 1px solid var(--border-panel); border-bottom: 1px solid var(--border-panel); }

/* Jour header : labels en toutes lettres (parité V1) */
.p2-day-label {
    font-size: 11px !important;
    font-weight: 700;
    text-transform: capitalize !important;
    letter-spacing: 0 !important;
    color: var(--text-muted);
}
.p2-day-date-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
}
.p2-day-date-full {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.p2-day-date-full.today {
    background: var(--accent, #3B82F6);
    color: #fff;
}
/* Ligne de remplissage pour prolonger la grille en bas du viewport */
.p2-grid-filler-cell {
    padding: 0;
    height: 100%;
    border-right: 1px solid var(--border-panel);
    background: transparent;
}
.p2-grid-filler-cell.member {
    background: var(--bg-card);
    position: sticky;
    left: 0;
    z-index: 4;
}
.p2-grid-area { display: flex; flex-direction: column; }
.p2-grid { flex: 1; }
.p2-grid tbody { min-height: 100%; }
.p2-grid-filler-row { height: 100%; }

/* ── Colonne membre améliorée ─────────────────────────────────────────────────── */
.p2-member-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.p2-member-lastname {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    display: block;
    margin-top: -1px;
}

.p2-member-avatar-img,
.p2-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.p2-member-avatar-wrap { flex-shrink: 0; display: flex; align-items: center; }

/* ── Layout V1 du membre : avatar | [nom+note / role+copy+hours] ─────────────── */
.p2-member-info-v1 {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.p2-member-details-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}
.p2-member-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.p2-member-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.p2-member-bottom-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.p2-member-actions-right {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.p2-member-actions-bottom-right {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}


.p2-member-drag-handle {
    cursor: grab;
    flex-shrink: 0;
    transition: transform var(--trans-fast);
}
.p2-member-drag-handle:active {
    cursor: grabbing;
    transform: scale(0.92);
}

.p2-row-dragging {
    opacity: 0.4;
    background: var(--bg-body) !important;
}


.p2-note-icon {
    font-size: 12px;
    cursor: pointer;
    transition: opacity var(--trans-fast), color var(--trans-fast);
}
.p2-note-icon.has-note { color: #F59E0B; opacity: 1; }
.p2-note-icon.note-hover-icon { color: var(--text-muted); opacity: 0; }
.p2-member-cell:hover .p2-note-icon.note-hover-icon { opacity: .7; }
.p2-note-icon.note-hover-icon:hover { color: var(--accent); opacity: 1; }

.p2-copy-btn {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    border-radius: 3px;
    transition: all var(--trans-fast);
    padding: 0;
    opacity: 0;
}
.p2-member-cell:hover .p2-copy-btn { opacity: .85; }
.p2-copy-btn:hover { color: var(--accent, #3B82F6); background: var(--bg-body); opacity: 1; }

/* Shifts+ toolbar button (visible pour tous) */
.p2-tb-btn.shift-plus-btn {
    color: var(--text-main);
    border-color: rgba(139,92,246,.35);
    background: rgba(139,92,246,.07);
}
.p2-tb-btn.shift-plus-btn:hover { background: rgba(139,92,246,.15); border-color: #8B5CF6; }

/* Le signe "+" de Shift+ : superscript coloré (style V1) */
.p2-shifts-plus-sign {
    color: #8B5CF6;
    font-weight: 900;
    font-size: 13px;
    margin-left: -1px;
    line-height: 1;
    vertical-align: baseline;
}
.p2-member-hours {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}
.p2-member-hours.is-over {
    color: #d40000;
}
.p2-off-warning {
    color: #F59E0B;
    font-size: 12px;
    cursor: help;
}
.p2-birthday-icon {
    color: #EC4899;
    font-size: 12px;
}
.p2-day-cell.is-birthday::before {
    content: '🎂';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: .55;
    pointer-events: none;
}
.p2-day-cell.is-paint-target {
    cursor: crosshair;
}
.p2-day-cell.is-paint-target:hover {
    outline: 2px dashed var(--accent, #3B82F6);
    outline-offset: -2px;
}

/* ── Mode peinture : blocage sélection de texte et drag natif ─────────────── */
.paint-cursor {
    user-select: none;
    -webkit-user-select: none;
}
.paint-cursor * {
    cursor: crosshair !important;
    user-select: none;
    -webkit-user-select: none;
}
/* Empêche le drag natif sur le shift card de voler les mouseenter */
.paint-cursor .p2-cell-shift {
    pointer-events: none;
}
.paint-cursor .p2-day-cell {
    pointer-events: all;
}
.p2-member-note-btn {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    border-radius: 3px;
    transition: all var(--trans-fast);
    padding: 0;
    opacity: 0;
}
.p2-member-cell:hover .p2-member-note-btn { opacity: 1; }
.p2-member-note-btn:hover { color: var(--accent); }
.p2-member-note-btn.has-note { opacity: 1; color: #F59E0B; }

/* ── Rotation modal V1 : split slots / library ──────────────────────────────── */
.p2-rotation-split {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    align-items: flex-start;
}
.p2-rotation-panel,
.p2-rotation-library {
    background: var(--bg-body);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-md);
    padding: 12px;
}
.p2-rotation-slot-v1 {
    display: grid;
    grid-template-columns: 100px 1fr 28px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1.5px dashed var(--border-panel);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    transition: all var(--trans-fast);
    margin-bottom: 6px;
}
.p2-rotation-slot-v1.drag-over {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb, 59,130,246),.08);
}
.p2-rotation-slot-v1.assigned { border-style: solid; }
.p2-rotation-slot-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    color: var(--text-muted);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.02);
}
.p2-rotation-slot-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-body);
}
.p2-rotation-slot-chip-name {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-main);
}
.p2-rotation-tpl-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 340px;
    overflow-y: auto;
}
.p2-rotation-tpl-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: all var(--trans-fast);
    user-select: none;
}
.p2-rotation-tpl-card:hover {
    background: var(--bg-body);
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}
.p2-rotation-tpl-card:active { cursor: grabbing; }
.p2-rotation-tpl-grip { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }
.p2-rotation-tpl-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Rotation modal (ancien layout) ──────────────────────────────────────────── */
.p2-rotation-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.p2-rotation-section-title {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.p2-rotation-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.p2-rotation-slot {
    display: flex;
    align-items: center;
    gap: 8px;
}
.p2-rotation-slot-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    width: 24px;
    flex-shrink: 0;
}
.p2-rotation-slot-picker {
    flex: 1;
    position: relative;
}
.p2-rotation-slot-empty {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px dashed var(--border-panel);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--trans-fast);
}
.p2-rotation-slot-empty:hover { border-color: var(--accent); color: var(--accent); }
.p2-rotation-slot-assigned {
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-sm);
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}
.p2-rotation-slot-clear {
    background: rgba(0,0,0,.25);
    border: none;
    border-radius: 4px;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
}
.p2-rotation-slot-clear:hover { background: rgba(220,38,38,.5); color: #fff; }
.p2-rotation-slot-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--trans-fast);
}
.p2-rotation-slot-remove:hover { color: #ef4444; background: rgba(220,38,38,.1); }
.p2-rotation-add-slot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-panel);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--trans-fast);
    width: 100%;
    justify-content: center;
}
.p2-rotation-add-slot:hover { border-color: var(--accent); color: var(--accent); }
.p2-rotation-tpl-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    overflow: hidden;
}
.p2-rotation-tpl-list { max-height: 200px; overflow-y: auto; }
.p2-rotation-tpl-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: var(--text-sm);
    cursor: pointer;
    text-align: left;
    transition: background var(--trans-fast);
}
.p2-rotation-tpl-item:hover { background: var(--bg-body); }
.p2-rotation-tpl-cancel {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-body);
    border: none;
    border-top: 1px solid var(--border-panel);
    color: var(--text-muted);
    font-size: var(--text-xs);
    cursor: pointer;
}
.p2-rotation-repeat { }
.p2-rotation-repeat-control {
    display: flex;
    align-items: center;
    gap: 8px;
}
.p2-rotation-repeat-btn {
    width: 28px;
    height: 28px;
    background: var(--bg-body);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.p2-rotation-repeat-input {
    width: 60px;
    text-align: center;
    padding: 5px 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: var(--text-sm);
}
.p2-rotation-preview-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 150px;
    overflow-y: auto;
    padding: 4px;
}
.p2-rotation-preview-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--text-xs);
}
.p2-rotation-preview-week {
    color: var(--text-muted);
    width: 110px;
    flex-shrink: 0;
}
.p2-rotation-preview-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}
.p2-rotation-target-all {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: 10px;
}
.p2-rotation-member-picker { margin-top: 8px; }
.p2-rotation-member-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}
.p2-rotation-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--trans-fast);
}
.p2-rotation-member-row:hover { background: var(--bg-body); }

/* ── Week template modal ──────────────────────────────────────────────────────── */
.p2-wt-list { display: flex; flex-direction: column; gap: 8px; }
.p2-wt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-panel);
    background: var(--bg-body);
}
.p2-wt-item-info { flex: 1; min-width: 0; }
.p2-wt-item-name { font-size: var(--text-sm); font-weight: 700; color: var(--text-main); }
.p2-wt-item-meta { font-size: var(--text-xs); margin-top: 2px; }
.p2-wt-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Drag-to-reorder row ────────────────────────────────────────────────────── */
.p2-grid tbody tr { cursor: default; }
.p2-row-drag-over { background: transparent !important; }

/* Le handle est maintenant l'avatar lui-même, géré plus haut */

/* ── Alertes colonne (flottantes : ne repoussent plus la date) ───────────────── */
.p2-col-day { position: relative; }
.p2-day-alerts-wrap {
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
    width: max-content;
}
.p2-day-alert {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: auto;
}
.p2-day-alert-danger {
    background: rgba(220,38,38,.18);
    color: #ef4444;
}
.p2-day-alert-warning {
    background: rgba(245,158,11,.18);
    color: #F59E0B;
}

/* ── Indicateur volontariat dans l'en-tête ─────────────────────────────────── */
.p2-vol-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 700;
    background: rgba(139,92,246,.12);
    color: #8B5CF6;
    border: none;
    border-radius: 3px;
    padding: 2px 5px;
    cursor: pointer;
    margin-top: 2px;
    transition: background var(--trans-fast);
}
.p2-vol-indicator:hover { background: rgba(139,92,246,.22); }

/* ── Congé overlay dans cellule ─────────────────────────────────────────────── */
.p2-cell-leave {
    position: absolute;
    inset: 2px;
    border-radius: var(--radius-sm);
    background: rgba(16,185,129,.12);
    border: 1.5px dashed rgba(16,185,129,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #10b981;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
}
.p2-cell-leave i { font-size: 12px; }

/* ── Google Calendar button ─────────────────────────────────────────────────── */
.p2-tb-btn.gcal-btn { color: #4285F4; border-color: rgba(66,133,244,.3); }
.p2-tb-btn.gcal-btn:hover { background: rgba(66,133,244,.08); }

/* ── Rules modal ─────────────────────────────────────────────────────────────── */
.p2-rules-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.p2-rules-section + .p2-rules-section {
    border-top: 1px solid var(--border-panel);
    padding-top: 16px;
    margin-top: 0;
}
.p2-rules-section-title {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}
.p2-rules-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}
.p2-rules-toggles { display: flex; flex-direction: column; gap: 8px; }
.p2-rules-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-panel);
    cursor: pointer;
    transition: background var(--trans-fast);
}
.p2-rules-toggle:hover { background: var(--bg-body); }
.p2-rules-toggle input { margin-top: 3px; flex-shrink: 0; }
.p2-rules-toggle-info { display: flex; flex-direction: column; gap: 2px; }
.p2-rules-toggle-info span { font-size: var(--text-sm); font-weight: 600; color: var(--text-main); }
.p2-rules-toggle-info small { font-size: 11px; color: var(--text-muted); }

/* ── Rules : grille 3 colonnes membres côte à côte ─────────────────────────── */
.p2-rules-member-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: start;
}
.p2-rules-member-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.p2-rules-member-col-title {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: .4px;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
}
.p2-rules-member-col-title i { font-size: 13px; color: var(--accent, #3B82F6); }

.p2-rules-member-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-md);
    background: var(--bg-body);
}
.p2-rules-member-list::-webkit-scrollbar { width: 4px; }
.p2-rules-member-list::-webkit-scrollbar-thumb { background: var(--border-panel); border-radius: 4px; }

.p2-rules-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--trans-fast);
    user-select: none;
}
.p2-rules-member-row:hover { background: var(--bg-card); }
.p2-rules-member-row input[type=checkbox] { flex-shrink: 0; }

.p2-rules-member-empty {
    padding: 8px;
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* compat ancien picker (si utilisé ailleurs) */
.p2-rules-member-picker {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-md);
    background: var(--bg-body);
}

/* ── Volontariat modal ───────────────────────────────────────────────────────── */
.p2-vol-list { display: flex; flex-direction: column; gap: 8px; }
.p2-vol-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-panel);
    background: var(--bg-body);
}
.p2-vol-entry-info { flex: 1; min-width: 0; }
.p2-vol-name { font-size: var(--text-sm); font-weight: 700; color: var(--text-main); display: block; }
.p2-vol-shift { font-size: var(--text-xs); font-weight: 600; }
.p2-vol-entry-actions { display: flex; align-items: center; gap: 6px; }
.p2-vol-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: .3px;
}
.p2-vol-status-pending  { background: rgba(245,158,11,.12); color: #F59E0B; }
.p2-vol-status-validated{ background: rgba(16,185,129,.12); color: #10b981; }
.p2-vol-status-cancelled{ background: rgba(100,100,100,.1); color: var(--text-muted); }

/* ── Copy week modal ─────────────────────────────────────────────────────────── */
.p2-copy-mode { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.p2-copy-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-panel);
    cursor: pointer;
    transition: all var(--trans-fast);
}
.p2-copy-mode-option:hover { background: var(--bg-body); }
.p2-copy-mode-option.active { border-color: var(--accent); background: rgba(var(--accent-rgb,59,130,246),.05); }
.p2-copy-mode-option input { margin-top: 3px; flex-shrink: 0; }
.p2-copy-mode-label { font-size: var(--text-sm); font-weight: 700; color: var(--text-main); }
.p2-copy-mode-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.p2-copy-member-picker { margin-top: 8px; }
.p2-copy-member-header { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.p2-copy-member-header .p2-form-input { flex: 1; }
.p2-copy-member-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-panel);
    border-radius: var(--radius-md);
    padding: 4px;
}
.p2-copy-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--trans-fast);
}
.p2-copy-member-row:hover { background: var(--bg-body); }
.p2-copy-count {
    font-size: 11px;
    margin-top: 6px;
    text-align: right;
}

/* ── Vue 4 semaines ───────────────────────────────────────────────────────────── */
.p2-fw-grid-area { flex: 1; overflow: auto; background: var(--bg-body); }
/* table-layout: auto pour que les colonnes jour s'étendent jusqu'à 100% */
.p2-fw-grid { width: 100%; min-width: 900px; table-layout: fixed; height: max-content; }
.p2-fw-grid .p2-col-member {
    width: var(--p2-member-col);
    min-width: var(--p2-member-col);
    max-width: var(--p2-member-col);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.p2-fw-grid .p2-member-cell {
    width: var(--p2-member-col);
    min-width: var(--p2-member-col);
    max-width: var(--p2-member-col);
}
.p2-fw-col-day {
    /* Les 28 colonnes jour + 3 séparateurs se partagent l'espace restant */
    width: calc((100% - var(--p2-member-col) - 18px) / 28);
    min-width: 28px;
    padding: 4px 2px;
    text-align: center;
    border-right: 1px solid var(--border-panel);
    vertical-align: middle;
}
.p2-fw-week-sep { width: 6px !important; min-width: 6px !important; max-width: 6px !important; background: var(--border-panel); padding: 0; }
.p2-fw-week-labels-row th { padding: 3px; }
.p2-fw-week-label-cell {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    border-right: 1px solid var(--border-panel);
}
.p2-fw-cell {
    padding: 2px;
    border-right: 1px solid var(--border-panel);
    vertical-align: middle;
    cursor: pointer;
}
.p2-fw-cell.weekend { background: rgba(0,0,0,.02); }
.p2-fw-shift {
    height: 100%;
    border-radius: 3px;
    min-height: 28px;
    transition: opacity var(--trans-fast);
}
.p2-fw-shift:hover { opacity: .8; }

@keyframes pm-pulse-v1 {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 2px rgba(217, 119, 6, 0.3)); }
    50% { opacity: 0.7; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.8)); }
}

.sh-plus {
    display: inline-block;
    color: #fbbf24;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    font-size: 1.1em;
    transform: rotate(8deg) skew(-5deg);
    margin-left: 2px;
    filter: drop-shadow(0 0 2px rgba(217, 119, 6, 0.3));
    font-family: 'Inter', sans-serif;
    animation: pm-pulse-v1 2s infinite ease-in-out;
}

/* Icône (i) flottante comme en V1 */
.p2-day-alerts-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    color: #f59e0b;
    font-size: 14px;
    cursor: pointer;
    z-index: 10;
    background: rgba(245, 158, 11, 0.1);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.p2-day-alerts-icon:hover {
    background: rgba(245, 158, 11, 0.2);
    transform: scale(1.1);
}

/* ── Hub static label (pour les users simples) ────────────────────────────── */
.p2-hub-static {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: var(--text-sm);
    color: var(--text-main);
    font-weight: 500;
    white-space: nowrap;
}
.p2-hub-static i { color: var(--accent); font-size: 14px; }

/* ── 4 semaines : styles de grille ────────────────────────────────────────── */
.p2-fw-cell {
    padding: 2px;
    border-right: 1px solid var(--border-panel);
    vertical-align: middle;
    cursor: pointer;
}

.p2-fw-shift {
    height: 100%;
    border-radius: 3px;
    transition: opacity var(--trans-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    overflow: hidden;
}

.p2-fw-shift-name {
    font-size: 8px;
    font-weight: 800;
    text-align: center;
    line-height: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-all;
    text-transform: uppercase;
}

.p2-fw-shift {
    min-height: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Laptop (≤ 1200px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .p2-toolbar {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 6px 8px;
        min-height: auto;
    }
    .p2-toolbar-left,
    .p2-toolbar-center,
    .p2-toolbar-right {
        justify-content: center;
        flex-wrap: wrap;
    }
    .p2-tb-btn-label { display: none; }
    .p2-tb-btn { padding: 5px 7px; }
    .p2-week-label { min-width: 120px; font-size: 12px; }
    .p2-version-badge { display: none; }

    /* Panel plus étroit */
    .p2-panel { min-width: 160px !important; max-width: 160px !important; }
    .p2-shift-card, .p2-fixed-card { font-size: 11px; }

    /* Colonne membre réduite */
    .p2-col-member,
    .p2-member-cell {
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;
    }
    .p2-member-avatar, .p2-member-avatar-img {
        width: 28px !important;
        height: 28px !important;
    }
    .p2-member-name { font-size: 11px !important; }

    /* 4 semaines compact */
    .p2-fw-grid .p2-col-member,
    .p2-fw-grid .p2-member-cell {
        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;
    }
    .p2-fw-col-day { width: 30px !important; min-width: 30px !important; }
    .p2-fw-grid { min-width: 1000px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 900px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    /* Masquer le panel dans le layout normal */
    .p2-panel { display: none !important; }

    /* Toolbar empilée */
    .p2-toolbar { padding: 4px 6px; }
    .p2-toolbar-left { order: 1; }
    .p2-toolbar-center { order: 2; }
    .p2-toolbar-right { order: 3; overflow-x: auto; }

    /* Grille : colonne membre petite */
    .p2-col-member,
    .p2-member-cell {
        width: 110px !important;
        min-width: 110px !important;
        max-width: 110px !important;
        padding: 0 4px !important;
    }
    .p2-member-details-col { display: none; }
    .p2-member-avatar-wrap { margin: 0 auto; }

    /* Shift cells compact */
    .p2-cell-shift { padding: 2px 4px !important; }
    .p2-cell-shift-name { font-size: 10px !important; }
    .p2-cell-shift-hours { font-size: 9px !important; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Smartphone (≤ 600px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .p2-container { font-size: 12px; }

    .p2-toolbar {
        grid-template-columns: 1fr;
        padding: 4px;
        gap: 2px;
    }
    .p2-toolbar-left {
        flex-wrap: wrap;
        gap: 4px;
    }
    .p2-toolbar-center {
        flex-wrap: wrap;
        gap: 4px;
    }
    .p2-toolbar-right {
        flex-wrap: wrap;
        gap: 2px;
        justify-content: flex-start;
    }
    .p2-hub-selector,
    .p2-hub-static { max-width: 150px; font-size: 11px; }
    .p2-week-label { min-width: 100px; font-size: 11px; }
    .p2-today-btn { font-size: 10px; padding: 2px 6px; }
    .p2-tb-btn { padding: 4px 6px; font-size: 11px; }
    .p2-tb-btn i { font-size: 13px; }
    .shift-plus-btn .p2-tb-btn-label { display: none; }
    .gcal-btn .p2-tb-btn-label { display: none; }

    /* Layout : pas de panel, full width grid */
    .p2-layout { flex-direction: column !important; height: calc(100vh - 45px - 120px); }
    .p2-panel { display: none !important; }
    .p2-grid-area { min-height: 0; }
    .p2-grid { min-width: 500px; }

    /* Colonne membre minimale */
    .p2-col-member,
    .p2-member-cell {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
        padding: 0 2px !important;
    }
    .p2-member-details-col { display: none; }
    .p2-member-avatar, .p2-member-avatar-img {
        width: 24px !important;
        height: 24px !important;
    }

    /* Cellules shift */
    .p2-day-cell { padding: 1px !important; }
    .p2-cell-shift { padding: 2px !important; border-radius: 4px !important; }
    .p2-cell-shift-name { font-size: 9px !important; }
    .p2-cell-shift-hours { display: none !important; }
    .p2-cell-delete { display: none; }

    /* 4 semaines mobile */
    .p2-fw-grid { min-width: 600px; }
    .p2-fw-grid .p2-col-member,
    .p2-fw-grid .p2-member-cell {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
    }
    .p2-fw-col-day { width: 22px !important; min-width: 22px !important; padding: 2px 0 !important; }
    .p2-fw-day-label { font-size: 7px !important; }
    .p2-fw-day-num { font-size: 8px !important; }
    .p2-fw-week-sep { width: 3px !important; min-width: 3px !important; }
    .p2-fw-grid tbody tr { height: 30px; min-height: 30px; max-height: 30px; }
    .p2-fw-cell { height: 30px !important; }
    .p2-fw-shift { min-height: 18px; border-radius: 2px; }
}

/* =============================================================================
   Import CRM One : voie RDV, comparaison, bandeaux
   ============================================================================= */

/* RDV importés de CRM One : frise de pastilles à texte complet (✓ RDV, ✨ Libre, Logistique) posées à leur heure sur
   l'axe 8h–21h, jusqu'à 3 lignes centrées dans la hauteur normale de la cellule, sans fond coloré. */
.p2-cell-timeline {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}
.p2-slot-pill {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 3px;
    border-radius: 999px;
    font-size: 8.5px;
    font-weight: 800;
    line-height: 1;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    color: #fff;
}
/* Le texte se réduit pour tenir dans la pastille, qui est à l'échelle de la durée (cqw = largeur de la pastille) */
.p2-slot-pill { container-type: inline-size; }
.p2-slot-pill .p2-slot-label { font-size: 9px; line-height: 1; }
.p2-slot-pill.is-logi .p2-slot-label { font-size: clamp(5px, 17cqw, 9px); }
.p2-slot-pill.is-libre .p2-slot-label { font-size: clamp(5px, 24cqw, 9px); }
.p2-slot-pill.is-pose .p2-slot-label { font-size: clamp(5px, 38cqw, 9px); }
.p2-slot-pill.is-more .p2-slot-label { font-size: 9px; }
.p2-slot-pill.is-more {
    background: none;
    border: none;
    min-width: 0;
    justify-content: flex-start;
    padding-left: 2px;
    color: var(--text-muted);
}
.p2-slot-pill.is-pose { background: var(--seg-rdv); border: 1px solid var(--seg-rdv); }
.p2-slot-pill.is-logi { background: var(--seg-logistique, #14B8A6); border: 1px solid var(--seg-logistique, #14B8A6); }
.p2-slot-pill.is-libre {
    background: color-mix(in srgb, var(--bg-card) 80%, transparent);
    color: var(--seg-rdv);
    border: 1.5px dashed var(--seg-rdv);
}
.p2-popover-dot-rdv { background: var(--seg-rdv); }
.p2-popover-dot-rdv.is-free { background: transparent; border: 2px solid var(--seg-rdv); box-sizing: border-box; }

/* Comparaison : contour par statut + marqueur dans le coin */
.p2-day-cell.p2-cmp { outline: 2px solid transparent; outline-offset: -2px; }
.p2-day-cell.p2-cmp-diff     { outline-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.p2-day-cell.p2-cmp-crm_only { outline-color: var(--primary); }
.p2-day-cell.p2-cmp-pw_only  { outline-color: var(--seg-visite); }
.p2-day-cell.p2-cmp-conflict { outline-style: dashed; }
.p2-cmp-badge {
    position: absolute;
    top: 3px;
    right: 4px;
    font-size: 13px;
    pointer-events: none;
    color: var(--text-muted);
}
.p2-cmp-diff .p2-cmp-badge     { color: var(--danger); }
.p2-cmp-crm_only .p2-cmp-badge { color: var(--primary); }
.p2-cmp-pw_only .p2-cmp-badge  { color: var(--seg-visite); }
.p2-cmp-ghost {
    margin: 2px 4px;
    padding: 4px 6px;
    border: 1px dashed var(--primary);
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--primary);
    background: var(--primary-light);
    overflow: hidden;
    max-height: calc(100% - 8px);
}

/* Bandeau d'état de la semaine et barre de comparaison */
.p2-crm-banner,
.p2-crm-compare-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-panel);
    background: var(--bg-card);
    color: var(--text-main);
}
.p2-crm-banner i { font-size: 15px; }
.p2-crm-banner.is-info i { color: var(--primary); }
.p2-crm-banner.is-warn { background: color-mix(in srgb, var(--seg-reunion) 12%, var(--bg-card)); }
.p2-crm-banner.is-warn i { color: var(--seg-reunion); }
.p2-crm-banner.is-neutral { color: var(--text-muted); }
.p2-crm-compare-bar { background: var(--bg-hover); }
.p2-crm-pill {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.p2-crm-pill.is-diff     { border-color: var(--danger); }
.p2-crm-pill.is-crm      { border-color: var(--primary); }
.p2-crm-pill.is-pw       { border-color: var(--seg-visite); }
.p2-crm-pill.is-conflict { border-color: var(--danger); color: var(--danger); }
.p2-crm-spacer { flex: 1 1 auto; }
.p2-crm-switch { display: inline-flex; gap: 0; }
.p2-crm-switch .p2-tb-btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.p2-crm-switch .p2-tb-btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.p2-crm-banner .p2-tb-btn { flex-shrink: 0; }
.p2-crm-btn-label { display: inline; }
.p2-crm-rules-row { align-items: center; gap: 12px; }

@media (max-width: 768px) {
    .p2-crm-banner,
    .p2-crm-compare-bar { padding: 6px 10px; }
}

/* Badge « Semaine importée de CRM One » (barre d'outils, à gauche d'Aujourd'hui) */
.p2-crm-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
/* Le badge est posé à gauche du centre sans l'élargir : la navigation (Aujourd'hui, semaine, 4 sem.) reste centrée,
   qu'il soit affiché ou non. */
.p2-toolbar-center .p2-crm-badge {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin: 0 12px 0 0;
}
@media (max-width: 1400px) {
    .p2-toolbar-center .p2-crm-badge .p2-crm-badge-text { display: none; }
}
.p2-crm-badge.is-warn {
    color: var(--warning, #d97706);
    background: color-mix(in srgb, var(--warning, #d97706) 12%, transparent);
    border-color: color-mix(in srgb, var(--warning, #d97706) 40%, transparent);
}

/* Barre d'outils large : trois zones en grille (gauche / navigation / actions) pour qu'elles ne se chevauchent jamais,
   même avec le badge CRM One, Comparer et Contrôler. */
@media (min-width: 1201px) {
    /* !important : la barre porte un display:flex en style inline */
    .p2-toolbar { display: grid !important; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
    .p2-toolbar-center { position: relative; left: auto; transform: none; }
    .p2-toolbar-left { justify-self: start; min-width: 0; }
    .p2-toolbar-right { justify-self: end; max-width: 100%; }
}

/* La barre s'adapte à SA largeur (et non à celle de l'écran) : la navigation reste au milieu de la page, et les boutons
   de droite perdent d'abord leur libellé (infobulle au survol) avant de pouvoir passer sous elle. */
@media (min-width: 1201px) {
    .p2-toolbar { container-type: inline-size; container-name: p2tb; }
}
@container p2tb (max-width: 2400px) {
    .p2-toolbar-right .p2-tb-btn-label { display: none; }
    .p2-toolbar-right .p2-tb-btn { padding: 5px 8px; }
}
@container p2tb (max-width: 1480px) {
    .p2-toolbar-right .p2-crm-btn-label { display: none; }
}

/* Repères horaires verticaux (un par heure), comme dans CRM One : ils aident à lire les plages
   et les pastilles RDV, placées sur le même axe. Derrière le contenu, absents des journées fixes (OFF, congé...). */
.p2-day-cell.p2-axis::before {
    content: '';
    position: absolute;
    inset: 0 4px;
    pointer-events: none;
    /* Un trait pointillé par heure (9h à 20h) : 13 heures de 8h à 21h, donc un quadrillage régulier ; pas de trait à 8h
       (bord de la cellule). Pâles et pointillés, ils ne se confondent pas avec les séparateurs de jours, qui restent pleins. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cg stroke='rgba(120,130,150,0.14)' stroke-width='1' stroke-dasharray='2 3' shape-rendering='crispEdges'%3E%3Cline x1='7.692%25' y1='0' x2='7.692%25' y2='100%25'/%3E%3Cline x1='15.385%25' y1='0' x2='15.385%25' y2='100%25'/%3E%3Cline x1='23.077%25' y1='0' x2='23.077%25' y2='100%25'/%3E%3Cline x1='30.769%25' y1='0' x2='30.769%25' y2='100%25'/%3E%3Cline x1='38.462%25' y1='0' x2='38.462%25' y2='100%25'/%3E%3Cline x1='46.154%25' y1='0' x2='46.154%25' y2='100%25'/%3E%3Cline x1='53.846%25' y1='0' x2='53.846%25' y2='100%25'/%3E%3Cline x1='61.538%25' y1='0' x2='61.538%25' y2='100%25'/%3E%3Cline x1='69.231%25' y1='0' x2='69.231%25' y2='100%25'/%3E%3Cline x1='76.923%25' y1='0' x2='76.923%25' y2='100%25'/%3E%3Cline x1='84.615%25' y1='0' x2='84.615%25' y2='100%25'/%3E%3Cline x1='92.308%25' y1='0' x2='92.308%25' y2='100%25'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* Séparateur de jour : plein et un peu plus marqué que les repères horaires pointillés */
.p2-grid .p2-day-cell {
    border-right: 1px solid color-mix(in srgb, var(--text-muted) 30%, var(--border-panel));
}

/* Infobulle d'une journée avec RDV : la liste passe sur deux colonnes, plus large */
.p2-cell-shift.has-timeline .p2-shift-popover { width: 400px; }
.p2-popover-line { display: block; }
.p2-popover-cell:empty { display: none; }
.p2-cell-shift.has-timeline .p2-popover-line {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
}
.p2-cell-shift.has-timeline .p2-popover-cell:empty { display: block; }

/* Infobulles des boutons de la barre d'outils et de la bande CRM One : instantanées (pas le délai du navigateur) et
   stylisées. Posées sous le bouton ; alignées à droite pour les boutons de droite, à gauche pour ceux de gauche. */
.p2-toolbar [data-tip]:not(.p2-crm-badge),
.p2-crm-banner [data-tip] { position: relative; }
.p2-toolbar [data-tip]::after,
.p2-crm-banner [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 9px);
    left: 50%;
    transform: translate(-50%, -3px);
    z-index: 3000;
    width: max-content;
    max-width: 300px;
    padding: 7px 11px;
    border-radius: 9px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    text-align: left;
    white-space: normal;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .07s ease, transform .07s ease;
}
.p2-toolbar [data-tip]::before,
.p2-crm-banner [data-tip]::before {
    content: '';
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    width: 9px;
    height: 9px;
    background: #0f172a;
    transform: translate(-50%, -3px) rotate(45deg);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .07s ease, transform .07s ease;
}
.p2-toolbar [data-tip]:hover::after,
.p2-toolbar [data-tip]:focus-visible::after,
.p2-crm-banner [data-tip]:hover::after,
.p2-crm-banner [data-tip]:focus-visible::after { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.p2-toolbar [data-tip]:hover::before,
.p2-toolbar [data-tip]:focus-visible::before,
.p2-crm-banner [data-tip]:hover::before,
.p2-crm-banner [data-tip]:focus-visible::before { opacity: 1; visibility: visible; transform: translate(-50%, 0) rotate(45deg); }
/* Boutons de droite : la bulle s'aligne sur leur bord droit pour ne pas sortir de la page */
.p2-toolbar-right [data-tip]::after { left: auto; right: 0; transform: translate(0, -3px); }
.p2-toolbar-right [data-tip]:hover::after,
.p2-toolbar-right [data-tip]:focus-visible::after { transform: translate(0, 0); }
.p2-toolbar-right [data-tip]::before { left: auto; right: 14px; transform: translate(0, -3px) rotate(45deg); }
.p2-toolbar-right [data-tip]:hover::before,
.p2-toolbar-right [data-tip]:focus-visible::before { transform: translate(0, 0) rotate(45deg); }
/* Boutons de gauche : bulle alignée sur leur bord gauche */
.p2-toolbar-left [data-tip]::after { left: 0; transform: translate(0, -3px); }
.p2-toolbar-left [data-tip]:hover::after,
.p2-toolbar-left [data-tip]:focus-visible::after { transform: translate(0, 0); }
.p2-toolbar-left [data-tip]::before { left: 14px; transform: translate(0, -3px) rotate(45deg); }
.p2-toolbar-left [data-tip]:hover::before,
.p2-toolbar-left [data-tip]:focus-visible::before { transform: translate(0, 0) rotate(45deg); }
/* Les bulles ne doivent pas être rognées : plus de défilement horizontal sur la barre large */
@media (min-width: 1201px) {
    .p2-toolbar-right { overflow: visible; }
}

.p2-cell-shift.has-timeline .p2-shift-popover.is-map { width: 540px; }

/* Carte des communes d'une journée */
.p2-day-map { position: relative; margin-top: 10px; }
.p2-day-map-canvas { height: 300px; border-radius: 10px; overflow: hidden; background: #e2e8f0; }
.p2-day-map-state {
    position: absolute;
    inset: 0 0 auto 0;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background: rgba(226, 232, 240, .75);
    border-radius: 10px;
}
.p2-day-map-state.is-error { color: #b91c1c; }
.p2-day-map-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.p2-day-map-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; }
.p2-day-map-chip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.p2-day-map-unlocated { margin-top: 6px; font-size: 11px; color: #64748b; }
/* Étiquette d'une commune : son nom, puis une pastille par RDV (numéro d'ordre + horaires) */
.p2-map-tagwrap { background: none; border: none; }
.p2-map-tag {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
    transition: transform .12s ease;
}
.p2-map-tag.is-active { transform: translate(-50%, -50%) scale(1.12); z-index: 5; }
/* Nom de la commune : seulement si la zone est assez grande, ou quand on la survole */
.p2-map-tag:not(.has-name) .p2-map-tag-name { display: none; }
.p2-map-tag.is-active .p2-map-tag-name { display: block; }
.p2-map-tag-name {
    font: 700 10px/1.2 system-ui, sans-serif;
    color: #0f172a;
    white-space: nowrap;
    text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
}
.p2-map-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 5px 0 1px;
    border-radius: 8px;
    color: #fff;
    font: 700 9.5px/1.45 system-ui, sans-serif;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.p2-map-pill b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #0f172a;
    font-size: 8.5px;
}
/* Liste des RDV sous la carte : numéro d'ordre, horaires, commune ; liée au survol des zones */
.p2-day-map-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.p2-day-map-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 11px;
    cursor: default;
}
.p2-day-map-row.is-active { background: rgba(15, 23, 42, .07); }
.p2-day-map-n {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    flex: none;
}
.p2-day-map-hours { font-weight: 800; flex: none; }
.p2-day-map-city { color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="dark"] .p2-day-map-row.is-active { background: rgba(255, 255, 255, .08); }
[data-theme="dark"] .p2-day-map-city { color: #94a3b8; }

/* En mode carte, la bulle réagit à la souris (survol des zones) : un pont invisible couvre l'espace entre le bloc et la bulle
   pour que le survol ne se perde pas en y allant. */
/* Seulement quand la bulle est affichée (survol du bloc ou de la bulle) : masquée, elle ne capte rien */
.p2-cell-shift:hover .p2-shift-popover.is-map { pointer-events: auto; }
.p2-shift-popover.is-map::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -16px;
    width: 16px;
}
.p2-shift-popover.is-map.is-left::after { left: auto; right: -16px; }

/* Autres plages (traitement, pause, logistique...) : dans la même suite d'heures que les RDV, avec une pastille carrée */
.p2-day-map-row.is-detail { color: #475569; }
.p2-day-map-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; margin: 0 3.5px; }
[data-theme="dark"] .p2-day-map-row.is-detail { color: #94a3b8; }

/* Journée en pastilles : le bloc est transparent, il ne doit rien rogner. Avec son coin arrondi et overflow:hidden, il coupait
   le coin des pastilles collées au bord (8h) ; la bulle de détail est masquée par visibility, pas par ce rognage. */
.p2-cell-shift.has-timeline { overflow: visible; }
