:root {
    --bg:      #0e1117;
    --bg2:     #171c26;
    --border:  #262d3d;
    --gold:    #c9a96e;
    --text:    #e4eaf4;
    --muted:   #7a8799;
    --radius:  10px;
}

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

html, body { height: 100%; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

button, a { outline: none; text-decoration: none; color: inherit; cursor: pointer; touch-action: manipulation; }
button { -webkit-appearance: none; appearance: none; background: transparent; border: none; font-family: inherit; font-size: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
}
.login-page > .login-box {
    margin: auto;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-align: center;
}

.login-hero {
    width: 100%;
    height: 130px;
    overflow: hidden;
    display: block;
}
.login-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    display: block;
}

.login-logo { display: none; }

.login-body {
    padding: 1.75rem 2rem 1.75rem;
}

.login-box h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: .4rem;
}

.subtitle {
    color: var(--muted);
    font-size: .87rem;
    margin-bottom: 1.4rem;
}

.field { margin-bottom: .85rem; }

.field input {
    width: 100%;
    padding: .7rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .95rem;
    transition: border-color .18s;
}
.field input:focus { outline: none; border-color: var(--gold); }

.login-body button[type="submit"] {
    width: 100%;
    padding: .7rem 1rem;
    background: var(--gold);
    color: #0e1117;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .18s;
    margin-top: .2rem;
}
.login-body button[type="submit"]:hover { opacity: .85; }

.alert {
    background: rgba(224,85,85,.12);
    border: 1px solid rgba(224,85,85,.35);
    color: #f08080;
    padding: .6rem .9rem;
    border-radius: 8px;
    margin-bottom: .85rem;
    font-size: .87rem;
    text-align: left;
}
.alert-ok {
    background: rgba(76,175,125,.12);
    border-color: rgba(76,175,125,.35);
    color: #6fcf97;
}

.uploader-link {
    display: block;
    margin-top: 1.2rem;
    color: var(--muted);
    font-size: .82rem;
    transition: color .18s;
}
.uploader-link:hover { color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════════════ */
.site-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(14,17,23,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: .7rem 0;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.site-title { font-size: 1.05rem; font-weight: 700; color: var(--gold); }
.site-title em { color: var(--muted); font-style: normal; font-weight: 400; font-size: .88rem; }

.header-actions, .header-select { display: flex; align-items: center; gap: .45rem; }
.header-actions.hidden { display: none !important; }
.header-select { display: none; }
.header-select.visible { display: flex; }

/* Boutons header — base commune */
.btn-upload, .btn-logout, .btn-select, .sel-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .38rem .85rem;
    border-radius: 8px;
    font-size: .83rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    transition: opacity .18s, border-color .18s, color .18s;
    text-decoration: none;
}
.btn-upload svg, .btn-logout svg, .btn-select svg, .sel-btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-upload, .sel-btn-zip { background: var(--gold); color: #0e1117; border-color: var(--gold); }
.btn-upload:hover, .sel-btn-zip:hover { opacity: .82; }
.sel-btn-zip:disabled { opacity: .38; cursor: not-allowed; }

.btn-logout { padding: .38rem .55rem; background: transparent; border-color: transparent; color: var(--muted); }
.btn-logout:hover { border-color: var(--border); color: var(--text); }

.sel-btn-cancel { background: transparent; border-color: transparent; color: var(--muted); padding: .38rem .5rem; }
.sel-btn-cancel:hover { color: var(--text); }

/* Bouton filtre sans-album */
.btn-filter-unclassified {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .38rem .75rem;
    border-radius: 8px;
    font-size: .83rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--muted);
    transition: border-color .18s, color .18s, background .18s;
    cursor: pointer;
}
.btn-filter-unclassified svg { width: 12px; height: 14px; flex-shrink: 0; }
.btn-filter-unclassified:hover { border-color: #dc2626; color: #dc2626; }
.btn-filter-unclassified.active {
    background: rgba(220, 38, 38, .12);
    border-color: #dc2626;
    color: #dc2626;
}
.btn-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    font-size: .72rem;
    font-weight: 700;
    background: #dc2626;
    color: #fff;
    line-height: 1;
}

.sel-btn-del { background: transparent; border-color: #e03c3c; color: #e03c3c; }
.sel-btn-del:hover { background: #e03c3c; color: #fff; }
.sel-btn-del:disabled { opacity: .38; cursor: not-allowed; }

.sel-count { font-size: .83rem; font-weight: 600; color: var(--gold); padding-right: .15rem; }

/* ═══════════════════════════════════════════════════════════
   GALLERY
═══════════════════════════════════════════════════════════ */
.gallery-page main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.gallery-stats { color: var(--muted); font-size: .85rem; margin-bottom: 1.25rem; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

/* Carte photo */
.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    background: var(--bg2);
    cursor: pointer;
    transition: box-shadow .2s;
}
.gallery-item a.glightbox { display: block; width: 100%; height: 100%; }
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease, opacity .3s;
    opacity: 0;
}
.gallery-item img.loaded { opacity: 1; }
.gallery-item:hover img  { transform: scale(1.05); }

/* Overlay survol */
.item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 55%);
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    border-radius: 6px;
    z-index: 1;
}
.gallery-item:hover .item-overlay { opacity: 1; }
.overlay-dl { pointer-events: auto; }

/* Bouton téléchargement */
.overlay-dl {
    position: absolute;
    bottom: 9px;
    right: 9px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: none;
    transition: background .18s, transform .18s;
    text-decoration: none;
}
.overlay-dl:hover  { background: var(--gold); color: #0e1117; transform: scale(1.1); }
.overlay-dl:visited { color: #fff; }
.overlay-dl svg    { width: 16px; height: 16px; }

/* Bouton suppression */
.overlay-del {
    position: absolute;
    bottom: 9px;
    right: 49px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background .18s, transform .18s;
    pointer-events: auto;
}
.overlay-del:hover { background: #e03c3c; transform: scale(1.1); }
.overlay-del svg   { width: 16px; height: 16px; }

/* Checkbox sélection */
.item-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.65);
    background: rgba(0,0,0,.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s, background .18s, border-color .18s;
    color: transparent;
    padding: 0;
}
.item-check svg { width: 12px; height: 12px; }
.gallery-item:hover .item-check { opacity: 1; }
.item-check.checked { opacity: 1; background: var(--gold); border-color: var(--gold); color: #0e1117; }
.select-mode .item-check { opacity: 1; }
.select-mode .gallery-item.selected { box-shadow: 0 0 0 3px var(--gold); }

/* Loader */
.loader { display: flex; justify-content: center; gap: 6px; padding: 2.5rem 0; }
.loader span {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gold);
    animation: bounce .8s infinite alternate;
}
.loader span:nth-child(2) { animation-delay: .2s; }
.loader span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { from { opacity:.3; transform:scaleY(.7); } to { opacity:1; transform:scaleY(1); } }

.end-msg { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 0; }

/* Drapeau photo sans sous-album */
.item-flag {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    z-index: 4;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 20px !important;
    height: 20px !important;
    background: #dc2626 !important;
    border-radius: 3px;
    color: #fff;
    pointer-events: none;
    flex-shrink: 0;
}
.item-flag svg { width: 10px; height: 12px; display: block; }

/* Lightbox */
.lb-name { display: block; font-weight: 600; margin-bottom: .2rem; }
.lb-meta { display: block; color: var(--muted); font-size: .85rem; }
.lb-dl-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    margin-top: .5rem;
    padding: .25rem .6rem;
    background: transparent; color: var(--gold);
    border: 1px solid var(--gold);
    border-radius: 4px; font-size: .75rem; font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.lb-dl-btn:hover { background: var(--gold); color: #0a0d12; }
.lb-dl-btn svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════
   UPLOAD
═══════════════════════════════════════════════════════════ */
.upload-main {
    max-width: 720px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}
.upload-main h2 { font-size: 1.35rem; color: var(--gold); margin-bottom: 1.5rem; }

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--gold); background: rgba(201,169,110,.05); }
.drop-zone svg { width: 48px; height: 48px; color: var(--muted); margin-bottom: 1rem; }
.drop-zone p { color: var(--muted); font-size: .95rem; }
.drop-zone small { font-size: .8rem; }
.drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.file-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 1.25rem; }
.preview-item { display: flex; flex-direction: column; align-items: center; gap: .35rem; background: var(--bg2); border-radius: 6px; padding: .5rem; overflow: hidden; }
.preview-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.preview-item span { font-size: .7rem; color: var(--muted); word-break: break-all; text-align: center; }

.btn-submit {
    display: block;
    margin: 1.25rem 0;
    padding: .7rem 2rem;
    background: var(--gold);
    color: #0e1117;
    border: none;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .18s;
}
.btn-submit:hover { opacity: .85; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (min-width: 500px) and (max-width: 800px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}
@media (max-width: 499px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
    .gallery-page main { padding: 1rem .75rem; }
}

/* ── SHARE BOX ───────────────────────────────────────────── */
.share-box {
    margin-top: 2.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.share-box-header {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: .9rem;
}
.share-box-header svg { width: 16px; height: 16px; color: var(--gold); flex-shrink: 0; }

.share-url-row {
    display: flex;
    gap: .5rem;
}
.share-url-input {
    flex: 1;
    padding: .5rem .8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: .82rem;
    font-family: monospace;
    min-width: 0;
}

.share-hint {
    margin-top: .7rem;
    font-size: .8rem;
    color: var(--muted);
    line-height: 1.45;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: .5rem .9rem;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    transition: opacity .18s, border-color .18s;
    white-space: nowrap;
}
.share-btn:hover { opacity: .8; }

.share-btn-copy, .share-btn-generate { background: var(--gold); color: #0e1117; border-color: var(--gold); }
.share-btn-regen { background: var(--bg); color: var(--muted); font-size: .78rem; }
.share-btn-revoke { background: transparent; color: var(--muted); border-color: transparent; font-size: .78rem; padding: .4rem .6rem; }
.share-btn-revoke:hover { color: #e05555; border-color: transparent; opacity: 1; }

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 1.25rem 1.5rem;
    color: var(--muted);
    font-size: .78rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    background: rgba(14,17,23,.6);
    backdrop-filter: blur(8px);
    letter-spacing: .02em;
}
.site-footer span {
    color: var(--gold);
    font-style: italic;
}
.site-footer a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
    transition: opacity .18s;
}
.site-footer a:hover { opacity: .75; }
.site-footer br { display: block; margin-top: .35rem; }

/* ═══════════════════════════════════════════════════════════
   SOUS-GALERIES — barre d'onglets (gallery.php)
═══════════════════════════════════════════════════════════ */
.header-inner {
    flex-wrap: wrap;
    row-gap: .5rem;
}

.subcat-nav {
    display: flex;
    align-items: center;
    gap: .35rem;
    order: 3;          /* passe sous le titre et les actions */
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: .1rem;
}
.subcat-nav::-webkit-scrollbar { display: none; }

.subcat-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .8rem;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--muted);
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s;
    flex-shrink: 0;
}
.subcat-btn:hover { color: var(--text); border-color: var(--gold); }
.subcat-btn.active {
    background: var(--gold);
    color: #0e1117;
    border-color: var(--gold);
}
.subcat-count {
    background: rgba(255,255,255,.15);
    border-radius: 10px;
    padding: .05rem .4rem;
    font-size: .72rem;
    font-weight: 700;
}
.subcat-btn.active .subcat-count {
    background: rgba(0,0,0,.2);
}

/* ═══════════════════════════════════════════════════════════
   FILTRE PAR DATE — barre sous les onglets
═══════════════════════════════════════════════════════════ */
.date-nav {
    display: flex;
    align-items: center;
    gap: .3rem;
    order: 4;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: .1rem;
    -webkit-mask-image: linear-gradient(to right, black 82%, transparent 100%);
    mask-image:         linear-gradient(to right, black 82%, transparent 100%);
}
.date-nav::-webkit-scrollbar { display: none; }

.date-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .65rem;
    border-radius: 20px;
    font-size: .74rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--muted);
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s;
    flex-shrink: 0;
}
.date-btn:hover { color: var(--text); border-color: var(--gold); }
.date-btn.active {
    background: rgba(201,169,110,.12);
    color: var(--gold);
    border-color: var(--gold);
}

.date-count {
    background: rgba(255,255,255,.12);
    border-radius: 10px;
    padding: .05rem .35rem;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.3;
}
.date-btn.active .date-count { background: rgba(201,169,110,.2); }

/* ═══════════════════════════════════════════════════════════
   SOUS-GALERIES — select upload (upload.php)
═══════════════════════════════════════════════════════════ */
.subcat-select-wrap {
    margin-bottom: 1.2rem;
}
.subcat-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.subcat-select {
    width: 100%;
    padding: .65rem 1rem;
    padding-right: 2.2rem;
    background-color: var(--bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8799' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
    background-size: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: .95rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .18s;
    -webkit-appearance: none;
    appearance: none;
}
.subcat-select:focus { outline: none; border-color: var(--gold); }
.subcat-select option { background-color: var(--bg2); color: var(--text); }

/* ═══════════════════════════════════════════════════════════
   BOUTON DÉPLACER (barre de sélection)
═══════════════════════════════════════════════════════════ */
.sel-btn-move {
    border-color: var(--gold);
    color: var(--gold);
}
.sel-btn-move:hover { background: var(--gold); color: #0e1117; }

/* ═══════════════════════════════════════════════════════════
   MODALE — déplacement vers sous-galerie
═══════════════════════════════════════════════════════════ */
.move-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.move-overlay.visible { display: flex; }

.move-modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 400px;
    overflow: hidden;
    animation: modal-in .18s ease;
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(.95) translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.move-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem .9rem;
    border-bottom: 1px solid var(--border);
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
}
.move-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--muted);
    transition: background .15s, color .15s;
}
.move-close:hover { background: rgba(255,255,255,.07); color: var(--text); }
.move-close svg { width: 14px; height: 14px; }

.move-modal-body {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: .9rem 1.2rem 1.2rem;
}

.move-target-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: .92rem;
    font-weight: 500;
    transition: border-color .15s, background .15s, color .15s;
    text-align: left;
}
.move-target-btn:hover:not(:disabled) {
    border-color: var(--gold);
    background: rgba(201,169,110,.08);
    color: var(--gold);
}
.move-target-btn:disabled,
.move-target-btn.move-target-current {
    opacity: .35;
    cursor: not-allowed;
}
.move-target-arrow { width: 16px; height: 16px; flex-shrink: 0; opacity: .5; }
.move-target-btn:hover:not(:disabled) .move-target-arrow { opacity: 1; }

/* ── Toast notification ──────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    background: var(--bg2);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: 8px;
    padding: .65rem 1.3rem;
    font-size: .88rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, transform .3s;
    z-index: 600;
    white-space: nowrap;
}
.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — améliorations UX
═══════════════════════════════════════════════════════════ */

/* Prevent iOS auto-zoom on input focus */
@media (max-width: 768px) {
    input, select, textarea { font-size: 16px !important; }
}

/* Touch devices: boutons d'action photo toujours visibles */
@media (hover: none) {
    .item-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,.52) 0%, transparent 48%);
    }
    .overlay-dl  { pointer-events: auto; }
    .overlay-del { pointer-events: auto; }
    /* Pas de scale au "hover" sur touch */
    .gallery-item:hover img { transform: none; }
    /* Checkbox légèrement visible sans select-mode */
    .item-check { opacity: .35; }
}

/* Onglets sous-galeries : fade visuel sur le bord droit */
.subcat-nav {
    -webkit-mask-image: linear-gradient(to right, black 82%, transparent 100%);
    mask-image:         linear-gradient(to right, black 82%, transparent 100%);
}

/* Toast : pas de débordement sur petits écrans */
@media (max-width: 540px) {
    .toast {
        white-space: normal;
        max-width: calc(100vw - 2rem);
        text-align: center;
        bottom: 1rem;
    }
}

/* ── Header mobile (≤640px) ──────────────────────────────── */
@media (max-width: 640px) {
    .header-inner { padding: 0 .75rem; gap: .4rem; }

    /* Zones tactiles ≥44px */
    .btn-upload, .btn-select, .btn-filter-unclassified, .btn-logout {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Date-nav : boutons un peu plus grands en mobile */
    .date-btn { min-height: 36px; padding: 0 .65rem; }

    /* Icônes seules — masquer les libellés texte */
    .btn-upload, .btn-select {
        font-size: 0;
        padding: 0 .75rem;
        gap: 0;
    }
    .btn-upload svg, .btn-select svg { width: 18px; height: 18px; }

    .btn-filter-unclassified {
        font-size: 0;
        padding: 0 .55rem;
        gap: .25rem;
    }
    .btn-filter-unclassified svg { width: 14px; height: 16px; }
    .btn-filter-badge { font-size: 11px; } /* px pour ne pas hériter du font-size: 0 */

    .btn-logout { padding: 0 .65rem; }
    .btn-logout svg { width: 18px; height: 18px; }

    /* Overlay buttons plus grands */
    .overlay-dl, .overlay-del { width: 40px; height: 40px; }
    .overlay-dl svg, .overlay-del svg { width: 18px; height: 18px; }
    .overlay-del { right: 56px; }

    /* ── Barre de sélection : 2 lignes ───────────────────── */
    .header-select {
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
        row-gap: .3rem;
        column-gap: .4rem;
    }
    /* Ligne 1 : compteur (flex:1) + bouton Annuler */
    .sel-count { flex: 1 1 auto; padding-right: 0; }
    .header-select > .sel-btn-cancel {
        flex-shrink: 0;
        min-height: 40px;
        padding: 0 .65rem;
    }
    /* Ligne 2 : actions scrollables */
    .sel-actions {
        width: 100%;
        display: flex;
        gap: .3rem;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .sel-actions::-webkit-scrollbar { display: none; }
    .sel-btn {
        flex-shrink: 0;
        min-height: 40px;
        padding: 0 .75rem;
        font-size: .8rem;
    }
    .sel-btn svg { width: 14px; height: 14px; }

    /* Upload page */
    .upload-main { margin: 1.5rem auto; }
    .drop-zone   { padding: 2rem 1.25rem; }
}
