/* ================================================================
   DRILL FAKTORY BOARD — CSS WEBAPP STANDALONE
   Fusion de drill_board.css + drill_board_fullscreen.css
   + styles panneau annotations + modal bibliothèque
   ================================================================ */

:root {
    --df-brand:     #2563c5;
    --df-brand-d:   #1a4ba8;
    --df-brand-l:   #dbeafe;
    --df-brand-xs:  #eff6ff;

    --df-team-a:    #2563c5;
    --df-team-b:    #e5383b;
    --df-cone:      #f97316;
    --df-ball:      #f59e0b;

    --df-bg:        #f5f5f7;
    --df-surface:   #ffffff;
    --df-border:    rgba(0,0,0,0.10);
    --df-border-md: rgba(0,0,0,0.14);
    --df-text-1:    #1d1d1f;
    --df-text-2:    #6e6e73;
    --df-text-3:    #aeaeb2;

    --df-toolbar-w: 64px;
    --df-panel-w:   220px;
    --df-topbar-h:  48px;

    --df-r-sm:   6px;
    --df-r-md:   10px;
    --df-r-lg:   14px;
    --df-r-full: 999px;

    --df-shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --df-shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
    --df-shadow-lg: 0 8px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
}

/* ─── Base ───────────────────────────────────────────────── */
html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    background: var(--df-bg);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    color: #1d1d1f;
    -webkit-font-smoothing: antialiased;
}

#df-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative; /* pour les modals/toasts en position:absolute */
}

/* ─── Top bar ────────────────────────────────────────────── */
.df-topbar {
    height: var(--df-topbar-h);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--df-border);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    flex-shrink: 0;
    z-index: 100;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
}

.df-hsep { width: 1px; height: 24px; background: var(--df-border-md); flex-shrink: 0; }
.df-hspacer { flex: 1; }

.df-terrain-select {
    appearance: none;
    background: var(--df-surface);
    border: 1px solid var(--df-border-md);
    border-radius: var(--df-r-md);
    padding: 5px 26px 5px 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--df-text-1);
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236e6e73'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    box-shadow: var(--df-shadow-sm);
    transition: border-color .15s;
}
.df-terrain-select:focus { border-color: var(--df-brand); }

.df-undo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--df-surface);
    border: 1px solid var(--df-border-md);
    border-radius: var(--df-r-full);
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 500;
    color: var(--df-text-2);
    box-shadow: var(--df-shadow-sm);
    flex-shrink: 0;
}
.df-uv { color: var(--df-brand); font-weight: 700; }

.df-hbtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: var(--df-r-md);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background .13s, opacity .13s;
    white-space: nowrap;
    flex-shrink: 0;
}
.df-hbtn svg { width: 13px; height: 13px; flex-shrink: 0; }
.df-hbtn-ghost {
    background: var(--df-surface);
    color: var(--df-text-1);
    border: 1px solid var(--df-border-md);
    box-shadow: var(--df-shadow-sm);
}
.df-hbtn-ghost:hover { background: var(--df-bg); }
.df-hbtn-ghost:disabled { opacity: .4; cursor: default; pointer-events: none; }
.df-hbtn-primary { background: var(--df-brand); color: #fff; box-shadow: var(--df-shadow-sm); }
.df-hbtn-primary:hover { background: var(--df-brand-d); }
.df-hbtn-danger {
    background: var(--df-surface);
    color: #e5383b;
    border: 1px solid rgba(229,56,59,.25);
    box-shadow: var(--df-shadow-sm);
}
.df-hbtn-danger:hover { background: #fff0f0; }
.df-hbtn-success {
    background: #16a34a;
    color: #fff;
    border-color: transparent;
}
.df-hbtn-success:hover:not(:disabled) { background: #15803d; }

.df-status-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--df-text-2);
    flex-shrink: 0;
}
.df-sep { color: var(--df-border-md); }
.df-status-inline strong { color: var(--df-text-1); font-weight: 600; }
#df-status-x,
#df-status-y {
    display: inline-block;
    min-width: 2.8em;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
#df-status-tool {
    display: inline-block;
    min-width: 6em;
}

/* Statut de sauvegarde */
.df-save-status {
    font-size: 11px;
    color: var(--df-text-2, #6e6e73);
    min-width: 80px;
    text-align: right;
    white-space: nowrap;
}
.df-save-status.df-saved  { color: #16a34a; }
.df-save-status.df-dirty  { color: #f59e0b; }
.df-save-status.df-saving { color: var(--df-text-2, #6e6e73); font-style: italic; }

/* ─── Main layout ────────────────────────────────────────── */
.df-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* Pas de toolbar verticale gauche */
.df-toolbar { display: none; }

/* ─── Canvas area ────────────────────────────────────────── */
.df-canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--df-bg);
    overflow: hidden;
    position: relative;
    min-width: 0;
}

.df-canvas-wrapper {
    position: relative;
    box-shadow: var(--df-shadow-lg), 0 0 0 1px rgba(0,0,0,0.06);
    border-radius: 4px;
    overflow: hidden;
}

.df-canvas-wrapper canvas:first-child { display: block; }
.df-canvas-wrapper canvas:last-child  { position: absolute; top: 0; left: 0; display: block; }

.df-cur-select  .df-canvas-wrapper canvas:last-child { cursor: default; }
.df-cur-draw    .df-canvas-wrapper canvas:last-child { cursor: crosshair; }
.df-cur-move    .df-canvas-wrapper canvas:last-child { cursor: grab; }
.df-cur-erase   .df-canvas-wrapper canvas:last-child { cursor: cell; }
.df-cur-place   .df-canvas-wrapper canvas:last-child { cursor: copy; }

/* Curve indicator */
.df-curve-ind {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.95);
    border: 1px solid var(--df-border-md);
    border-radius: var(--df-r-full);
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--df-brand);
    pointer-events: none;
    z-index: 200;
    white-space: nowrap;
    box-shadow: var(--df-shadow-md);
    backdrop-filter: blur(10px);
}

/* ─── Palette swatches (color popup) ─────────────────────── */
.df-pswatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .12s, box-shadow .12s;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.df-pswatch:hover { transform: scale(1.15); }
.df-pswatch.df-sel { box-shadow: 0 0 0 2px white, 0 0 0 3.5px var(--df-brand); }
.df-custom-label { font-size: 11px; color: var(--df-text-2); font-weight: 500; }

/* ─── Modal (11 joueurs) ─────────────────────────────────── */
.df-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: df-fadeIn .2s;
}
@keyframes df-fadeIn { from{opacity:0} to{opacity:1} }

.df-modal {
    background: var(--df-surface);
    border-radius: var(--df-r-lg);
    padding: 24px;
    width: 320px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.df-modal h2 { font-size: 17px; font-weight: 700; margin-bottom: 5px; color: var(--df-text-1); margin-top: 0; }
.df-modal p  { font-size: 12px; color: var(--df-text-2); margin-bottom: 16px; line-height: 1.5; }

.df-modal-team-row { display: flex; gap: 8px; margin-bottom: 16px; }
.df-modal-team-btn {
    flex: 1;
    padding: 9px;
    border-radius: var(--df-r-md);
    border: 1.5px solid var(--df-border-md);
    background: var(--df-bg);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all .12s;
}
.df-modal-team-btn.df-clr-a { color: var(--df-team-a); }
.df-modal-team-btn.df-clr-b { color: var(--df-team-b); }
.df-modal-team-btn.df-sel-a { background: var(--df-team-a); color: #fff !important; border-color: var(--df-team-a); }
.df-modal-team-btn.df-sel-b { background: var(--df-team-b); color: #fff !important; border-color: var(--df-team-b); }

.df-modal-formation { display: grid; gap: 7px; margin-bottom: 18px; }
.df-frow { display: flex; gap: 6px; }
.df-fopt {
    flex: 1;
    padding: 7px 4px;
    border-radius: var(--df-r-sm);
    border: 1.5px solid var(--df-border-md);
    background: var(--df-bg);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--df-text-1);
    cursor: pointer;
    text-align: center;
    transition: all .12s;
}
.df-fopt:hover { border-color: var(--df-brand); color: var(--df-brand); background: var(--df-brand-xs); }
.df-fopt.df-sel { border-color: var(--df-brand); background: var(--df-brand); color: #fff; }

.df-modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.df-mbtn {
    padding: 8px 16px;
    border-radius: var(--df-r-md);
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .13s;
}
.df-mbtn-cancel  { background: var(--df-bg); color: var(--df-text-2); }
.df-mbtn-cancel:hover { background: #e8e8ed; }
.df-mbtn-confirm { background: var(--df-brand); color: #fff; }
.df-mbtn-confirm:hover { background: var(--df-brand-d); }

/* ─── Toasts ─────────────────────────────────────────────── */
.df-toasts {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    pointer-events: none;
}
.df-toast {
    background: rgba(29,29,31,0.88);
    color: white;
    backdrop-filter: blur(20px);
    padding: 7px 16px;
    border-radius: var(--df-r-full);
    font-size: 12px;
    font-weight: 500;
    box-shadow: var(--df-shadow-md);
    animation: df-tIn .2s cubic-bezier(0.34,1.56,0.64,1), df-tOut .2s ease 2.3s forwards;
    pointer-events: none;
}
@keyframes df-tIn  { from{opacity:0;transform:translateY(6px) scale(.95)} to{opacity:1;transform:none} }
@keyframes df-tOut { to{opacity:0;transform:translateY(3px)} }

/* ─── Shortcuts ──────────────────────────────────────────── */
.df-shortcuts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 8px;
    font-size: 10px;
    color: var(--df-text-2);
    line-height: 1.7;
}
.df-shortcuts kbd {
    font-family: -apple-system, monospace;
    font-size: 9px;
    font-weight: 600;
    color: var(--df-text-1);
    background: var(--df-bg);
    border: 1px solid var(--df-border-md);
    border-radius: 4px;
    padding: 1px 4px;
    white-space: nowrap;
    display: inline-block;
}

/* ═══════════════════════════════════════════════════════════
   TOOLBAR FLOTTANTE
   ═══════════════════════════════════════════════════════════ */

#df-float-bar {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 18px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.07);
    transition: opacity 0.2s ease, transform 0.25s ease;
    white-space: nowrap;
}

#df-float-bar.df-float-bar--hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}
#df-seq-picker.df-float-bar--hidden {
    opacity: 0;
    pointer-events: none;
}

.df-fbtn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6e6e73;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    position: relative;
}
.df-fbtn svg { width: 18px; height: 18px; pointer-events: none; }
.df-fbtn:hover { background: rgba(0, 0, 0, 0.07); color: #1d1d1f; }
.df-fbtn.df-on {
    background: #eff6ff;
    color: #2563c5;
    box-shadow: inset 0 0 0 1.5px rgba(37, 99, 197, 0.3);
}
.df-fbtn.df-on-a {
    background: #eff6ff;
    color: #2563c5;
    box-shadow: inset 0 0 0 1.5px rgba(37, 99, 197, 0.35);
}
.df-fbtn.df-on-b {
    background: #fff0f0;
    color: #e5383b;
    box-shadow: inset 0 0 0 1.5px rgba(229, 56, 59, 0.35);
}

.df-fbtn.df-fbtn-a { color: #2563c5; }
.df-fbtn.df-fbtn-b { color: #e5383b; }
.df-fbtn.df-fbtn-cone { color: #f97316; }

.df-fbtn[title]::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(29, 29, 31, 0.88);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 100;
}
.df-fbtn:hover[title]::after { opacity: 1; }

.df-fsep {
    width: 1px;
    height: 22px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 3px;
    flex-shrink: 0;
}

/* ─── Sélecteur séquence ─────────────────────────────────── */
#df-seq-picker {
    position: fixed;
    bottom: 62px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 201;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

.df-seq-label {
    font-size: 11px;
    font-weight: 600;
    color: #6e6e73;
    margin-right: 4px;
    white-space: nowrap;
}

.df-seq-num {
    width: 28px;
    height: 28px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: #3d3d3d;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.12s;
}
.df-seq-num:hover { background: #f0f4ff; border-color: #2563c5; color: #2563c5; }
.df-seq-num.df-sel { background: #2563c5; border-color: #2563c5; color: #fff; box-shadow: 0 2px 6px rgba(37, 99, 197, 0.35); }

/* ─── Groupes dropdown ───────────────────────────────────── */
.df-fgroup {
    position: relative;
    display: flex;
    flex-shrink: 0;
}
.df-fgroup-btn { width: 46px !important; gap: 0 !important; }
.df-fgroup-caret { width: 6px !important; height: 6px !important; opacity: 0.45; flex-shrink: 0; margin-left: 1px; pointer-events: none; }

.df-fdropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.07);
    padding: 5px;
    flex-direction: row;
    gap: 2px;
    z-index: 300;
    white-space: nowrap;
    animation: df-dropIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.df-fdropdown.df-open { display: flex; }

@keyframes df-dropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px) scale(0.95); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.df-fgroup.df-group-active > .df-fgroup-btn {
    background: #eff6ff;
    color: #2563c5;
    box-shadow: inset 0 0 0 1.5px rgba(37, 99, 197, 0.3);
}

/* ─── Badges joueurs ─────────────────────────────────────── */
.df-player-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    line-height: 1;
    border: 1.5px solid rgba(255,255,255,0.9);
}
.df-badge-a { background: #2563c5; color: #fff; }
.df-badge-b { background: #e5383b; color: #fff; }
.df-player-badge[data-zero="1"] { display: none; }

/* ─── Bouton couleur + popup ─────────────────────────────── */
.df-fbtn-color { width: 36px; height: 36px; }

.df-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 0 0 1.5px rgba(0,0,0,0.15), inset 0 1px 2px rgba(0,0,0,0.1);
    display: block;
    pointer-events: none;
    flex-shrink: 0;
}

.df-color-popup {
    position: fixed;
    bottom: 62px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 202;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
    padding: 10px 12px;
    animation: df-dropIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.df-color-popup-palette { display: flex; gap: 7px; flex-wrap: wrap; max-width: 170px; }

.df-color-popup-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid rgba(0,0,0,0.07);
}

/* ─── Fill mode inline ───────────────────────────────────── */
.df-fill-inline {
    display: flex;
    gap: 1px;
    align-items: center;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 2px;
}

.df-fill-ibtn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #6e6e73;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.12s, color 0.12s;
    line-height: 1;
}
.df-fill-ibtn:hover { background: rgba(0,0,0,0.08); color: #1d1d1f; }
.df-fill-ibtn.df-sel { background: #fff; color: #2563c5; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* ─── Popup raccourcis ───────────────────────────────────── */
.df-shortcuts-popup {
    position: fixed;
    top: 58px;
    right: 12px;
    z-index: 500;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
    padding: 12px 14px;
    animation: df-dropDown 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 180px;
}

@keyframes df-dropDown {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.df-shortcuts-popup-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #6e6e73;
    margin-bottom: 9px;
}

/* ─── Export dropdown ────────────────────────────────────── */
.df-export-wrap { position: relative; }
.df-export-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0,0,0,0.09);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.14), 0 1px 4px rgba(0,0,0,0.07);
    padding: 5px;
    flex-direction: column;
    gap: 2px;
    z-index: 500;
    min-width: 140px;
    animation: df-exportMenuIn 0.15s cubic-bezier(0.34,1.56,0.64,1);
}
.df-export-menu.df-open { display: flex; }
@keyframes df-exportMenuIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.df-export-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: #1d1d1f;
    white-space: nowrap;
    width: 100%;
    text-align: left;
}
.df-export-item:hover { background: rgba(37,99,197,0.08); color: #2563c5; }
.df-export-item svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   PANNEAU ANNOTATIONS (côté droit)
   ═══════════════════════════════════════════════════════════ */

#df-annot-panel {
    width: 300px;
    display: none;
    flex-direction: column;
    background: var(--df-surface);
    border-left: 1px solid var(--df-border);
    flex-shrink: 0;
    overflow: hidden;
}

#df-annot-panel.df-open {
    display: flex;
    overflow-y: auto;
}

.df-annot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--df-border);
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--df-text-1);
    letter-spacing: 0.3px;
    background: var(--df-bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.df-annot-close-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--df-text-2);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.12s;
}
.df-annot-close-btn:hover { background: rgba(0,0,0,0.08); color: var(--df-text-1); }

.df-annot-body {
    padding: 14px 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.df-annot-field { display: flex; flex-direction: column; gap: 4px; }

.df-annot-body label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--df-text-2);
}

.df-annot-body input[type="text"],
.df-annot-body select,
.df-annot-body textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--df-border-md);
    border-radius: var(--df-r-md);
    padding: 7px 9px;
    font-family: inherit;
    font-size: 12px;
    color: var(--df-text-1);
    background: var(--df-surface);
    outline: none;
    resize: vertical;
    transition: border-color 0.15s;
}

.df-annot-body input[type="text"]:focus,
.df-annot-body select:focus,
.df-annot-body textarea:focus {
    border-color: var(--df-brand);
    box-shadow: 0 0 0 3px rgba(37,99,197,0.08);
}

.df-annot-body textarea {
    min-height: 64px;
    line-height: 1.5;
}

.df-annot-body select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236e6e73'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}

.df-annot-divider {
    height: 1px;
    background: var(--df-border);
    margin: 2px 0;
}

/* ═══════════════════════════════════════════════════════════
   MODAL BIBLIOTHÈQUE
   ═══════════════════════════════════════════════════════════ */

.df-lib-modal {
    width: 520px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#df-lib-list {
    flex: 1;
    overflow-y: auto;
    min-height: 60px;
    max-height: 50vh;
    margin-bottom: 14px;
    border: 1px solid var(--df-border);
    border-radius: var(--df-r-md);
}

#df-lib-list::-webkit-scrollbar { width: 4px; }
#df-lib-list::-webkit-scrollbar-track { background: transparent; }
#df-lib-list::-webkit-scrollbar-thumb { background: var(--df-border-md); border-radius: 4px; }

.df-lib-empty {
    padding: 32px 24px;
    text-align: center;
    color: var(--df-text-3);
    font-size: 12px;
    line-height: 1.8;
}

.df-lib-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--df-border);
    gap: 10px;
}
.df-lib-item:last-child { border-bottom: none; }

.df-lib-item-info { flex: 1; min-width: 0; }

.df-lib-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--df-text-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.df-lib-item-meta {
    font-size: 10px;
    color: var(--df-text-3);
    margin-top: 2px;
}

.df-lib-item-open {
    padding: 5px 12px;
    border-radius: var(--df-r-md);
    border: 1.5px solid var(--df-brand);
    background: transparent;
    color: var(--df-brand);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
    flex-shrink: 0;
}
.df-lib-item-open:hover { background: var(--df-brand-xs); }

.df-lib-item-del {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(229,56,59,.25);
    background: transparent;
    color: #e5383b;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    flex-shrink: 0;
    line-height: 1;
}
.df-lib-item-del:hover { background: #fff0f0; }

/* Scrollbar panel annot */
#df-annot-panel::-webkit-scrollbar { width: 4px; }
#df-annot-panel::-webkit-scrollbar-track { background: transparent; }
#df-annot-panel::-webkit-scrollbar-thumb { background: var(--df-border-md); border-radius: 4px; }
