/* ==========================================================================
   Cloud Acti-Informatique — charte graphique
   Reprend l'identité du site : vert #3e9172 (primary) / #0f2a20 (ink),
   cartes arrondies, « hébergé en France ». Interface sobre et lisible.
   ========================================================================== */

:root {
    /* Marque */
    --brand:        #3e9172;
    --brand-600:    #35805f;
    --brand-700:    #2b6b50;
    --brand-ink:    #0f2a20;
    --brand-soft:   #eaf4ef;
    --brand-soft-2: #dcecE4;

    /* Neutres */
    --ink:      #14201b;
    --text:     #253029;
    --muted:    #6b7a72;
    --line:     #e4eae6;
    --line-2:   #eef2f0;
    --bg:       #f5f8f6;
    --card:     #ffffff;
    --white:    #ffffff;

    /* États */
    --danger:   #d64545;
    --danger-soft: #fdecec;
    --warn:     #b5871f;
    --info:     #2f74c0;

    /* Système */
    --radius:   14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --shadow:   0 1px 2px rgba(15, 42, 32, .04), 0 8px 24px rgba(15, 42, 32, .06);
    --shadow-lg: 0 12px 40px rgba(15, 42, 32, .14);
    --ring:     0 0 0 3px rgba(62, 145, 114, .22);

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sidebar-w: 256px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-600); }

h1, h2, h3, h4 { color: var(--ink); font-weight: 700; letter-spacing: -.01em; margin: 0; }

img { max-width: 100%; display: block; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* -------------------------------------------------------------------------
   Boutons
   ------------------------------------------------------------------------- */
.btn {
    --_bg: var(--brand);
    --_fg: #fff;
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .62rem 1.05rem;
    font: inherit; font-weight: 600; font-size: .92rem;
    color: var(--_fg); background: var(--_bg);
    border: 1px solid transparent; border-radius: var(--radius-sm);
    cursor: pointer; transition: transform .06s ease, background .15s ease, box-shadow .15s ease;
    white-space: nowrap; line-height: 1;
}
.btn:hover { background: var(--brand-600); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }

.btn--ghost { --_bg: transparent; --_fg: var(--text); border-color: var(--line); }
.btn--ghost:hover { --_bg: var(--brand-soft); color: var(--brand-700); border-color: var(--brand-soft-2); }

.btn--soft { --_bg: var(--brand-soft); --_fg: var(--brand-700); }
.btn--soft:hover { --_bg: var(--brand-soft-2); color: var(--brand-700); }

.btn--danger { --_bg: var(--danger); }
.btn--danger:hover { background: #bf3a3a; }

.btn--block { width: 100%; }
.btn--sm { padding: .45rem .75rem; font-size: .85rem; }
.btn--lg { padding: .8rem 1.4rem; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Bouton icône seul */
.iconbtn {
    width: 36px; height: 36px; display: inline-grid; place-items: center;
    border: 1px solid transparent; border-radius: 9px; background: transparent;
    color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--brand-soft); color: var(--brand-700); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn.is-active { color: var(--brand); }

/* -------------------------------------------------------------------------
   Formulaires
   ------------------------------------------------------------------------- */
.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 600; font-size: .86rem; color: var(--ink); margin-bottom: .35rem; }
.input, .select, textarea.input {
    width: 100%; padding: .7rem .85rem; font: inherit; font-size: .95rem;
    color: var(--ink); background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder { color: #9aa8a0; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .35rem; }

.input-group { position: relative; }
.input-group .input { padding-right: 2.6rem; }
.input-group .reveal {
    position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: var(--muted); cursor: pointer; padding: .4rem;
}

/* -------------------------------------------------------------------------
   Alertes / flash
   ------------------------------------------------------------------------- */
.alert {
    display: flex; gap: .6rem; align-items: flex-start;
    padding: .7rem .9rem; border-radius: var(--radius-sm);
    font-size: .9rem; border: 1px solid;
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert--success { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-700); }
.alert--error   { background: var(--danger-soft); border-color: #f4cccc; color: #a53232; }
.alert--info    { background: #eaf1fb; border-color: #d3e2f7; color: #235694; }

/* -------------------------------------------------------------------------
   Écran d'authentification (login / register)
   ------------------------------------------------------------------------- */
.auth {
    min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
    background: var(--bg);
}
.auth__aside {
    position: relative; overflow: hidden; color: #eaf6f0;
    background: radial-gradient(120% 120% at 0% 0%, #17493a 0%, var(--brand-ink) 55%, #0a1f18 100%);
    padding: 3rem 3.4rem; display: flex; flex-direction: column; justify-content: center;
}
.auth__aside::after {
    content: ""; position: absolute; inset: auto -80px -120px auto; width: 420px; height: 420px;
    background: radial-gradient(circle, rgba(62,145,114,.55), transparent 62%); filter: blur(6px);
}
.auth__aside::before {
    content: ""; position: absolute; inset: -140px -120px auto auto; width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(246,135,31,.30), transparent 60%); filter: blur(10px);
}
.auth__brand { position: absolute; top: 3rem; left: 3.4rem; display: flex; align-items: center; gap: .7rem; z-index: 2; }
.auth__brand img { height: 40px; width: auto; }
.auth__pitch { position: relative; z-index: 1; max-width: 30rem; }
.auth__pitch h1 { color: #fff; font-size: 2.15rem; line-height: 1.14; letter-spacing: -.02em; }
.auth__pitch p { color: #cfe6db; margin: .9rem 0 1.6rem; max-width: 34ch; }
.auth__list { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.auth__list li { display: flex; align-items: center; gap: .7rem; color: #eaf6f0; font-size: .96rem; }
.auth__list svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.auth__foot { position: absolute; bottom: 2.2rem; left: 3.4rem; z-index: 1; color: #9fc3b4; font-size: .82rem; }

.auth__main { display: grid; place-items: center; padding: 2rem; }
.auth__card { width: 100%; max-width: 400px; }
.auth__card h2 { font-size: 1.5rem; }
.auth__card > p.sub { color: var(--muted); margin: .3rem 0 1.6rem; }
.auth__switch { margin-top: 1.3rem; text-align: center; color: var(--muted); font-size: .92rem; }
.auth__flash { display: grid; gap: .5rem; margin-bottom: 1.1rem; }

.badge-fr { display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem;
    color: var(--brand-700); background: var(--brand-soft); padding: .28rem .6rem; border-radius: 999px; font-weight: 600; }

@media (max-width: 880px) {
    .auth { grid-template-columns: 1fr; }
    .auth__aside { display: none; }
}

/* -------------------------------------------------------------------------
   Layout application (sidebar + contenu)
   ------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
    background: var(--brand-ink); color: #cfe0d8; padding: 1.1rem .8rem;
    display: flex; flex-direction: column; gap: .3rem; position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem 1.1rem; }
.sidebar__brand img { height: 30px; }
.sidebar__brand b { color: #fff; font-weight: 700; }
.sidebar__brand small { display: block; color: #7fa595; font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.sidebar__new { margin: 0 .3rem .9rem; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6f9384; padding: .9rem .8rem .3rem; font-weight: 700; }
.nav a {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: 10px;
    color: #cfe0d8; font-weight: 500; font-size: .92rem; transition: background .14s, color .14s;
}
.nav a svg { width: 19px; height: 19px; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.is-active { background: var(--brand); color: #fff; }
.nav a.is-active svg { opacity: 1; }
.nav .count { margin-left: auto; font-size: .74rem; background: rgba(255,255,255,.12); padding: .1rem .45rem; border-radius: 999px; }

.sidebar__quota { margin-top: auto; padding: .9rem .8rem .4rem; }
.quota__bar { height: 7px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; margin: .5rem 0 .4rem; }
.quota__fill { height: 100%; background: linear-gradient(90deg, #6fc39d, var(--brand)); border-radius: 999px; transition: width .4s ease; }
.quota__fill.is-high { background: linear-gradient(90deg, #e6a23c, var(--danger)); }
.quota__text { font-size: .78rem; color: #a9c6ba; }
.sidebar__upgrade { display:block; text-align:center; margin-top:.7rem; font-size:.82rem; color:#bfe0d1;
    border:1px dashed rgba(255,255,255,.2); border-radius:10px; padding:.5rem; }
.sidebar__upgrade:hover { background: rgba(255,255,255,.06); color:#fff; }

/* Contenu */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1rem;
    padding: .85rem 1.4rem; background: rgba(245,248,246,.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar__title { display: flex; flex-direction: column; min-width: 0; }
.topbar__title h1 { font-size: 1.15rem; }
.topbar__title span { color: var(--muted); font-size: .8rem; }
.topbar__search { flex: 1; max-width: 420px; margin-left: auto; position: relative; }
.topbar__search input {
    width: 100%; padding: .55rem .9rem .55rem 2.3rem; border: 1px solid var(--line);
    background: #fff; border-radius: 999px; font: inherit; font-size: .9rem;
}
.topbar__search input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.topbar__search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }

.usermenu { position: relative; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
    background: var(--brand); color: #fff; font-weight: 700; font-size: .85rem; cursor: pointer; border: 0;
}
.usermenu__pop {
    position: absolute; right: 0; top: calc(100% + .5rem); width: 220px; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: .5rem; display: none; z-index: 40;
}
.usermenu.open .usermenu__pop { display: block; }
.usermenu__pop .who { padding: .5rem .6rem .7rem; border-bottom: 1px solid var(--line-2); margin-bottom: .35rem; }
.usermenu__pop .who b { display: block; color: var(--ink); }
.usermenu__pop .who span { font-size: .8rem; color: var(--muted); }
.usermenu__pop a { display: flex; gap: .6rem; align-items: center; padding: .55rem .6rem; border-radius: 8px; color: var(--text); font-size: .9rem; }
.usermenu__pop a:hover { background: var(--brand-soft); color: var(--brand-700); }
.usermenu__pop a svg { width: 17px; height: 17px; }
.usermenu__pop a.danger { color: var(--danger); }
.usermenu__pop a.danger:hover { background: var(--danger-soft); }

.content { padding: 1.4rem; flex: 1; }

/* Barre d'actions */
.actionsbar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.actionsbar .spacer { flex: 1; }
.viewtoggle { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.viewtoggle button { border: 0; background: transparent; padding: .45rem .6rem; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.viewtoggle button.is-active { background: var(--brand-soft); color: var(--brand-700); }
.viewtoggle button svg { width: 18px; height: 18px; }

/* Fil d'Ariane */
.breadcrumb { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-size: .95rem; margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--brand-700); }
.breadcrumb .sep { color: #c3cec8; }
.breadcrumb .current { color: var(--ink); font-weight: 700; }

/* -------------------------------------------------------------------------
   Dropzone
   ------------------------------------------------------------------------- */
.dropzone.is-drag::after {
    content: "Déposez pour téléverser"; position: fixed; inset: 0; z-index: 60;
    display: grid; place-items: center; font-weight: 700; font-size: 1.3rem; color: var(--brand-700);
    background: rgba(62,145,114,.10); border: 3px dashed var(--brand); border-radius: 0;
    backdrop-filter: blur(2px);
}

/* -------------------------------------------------------------------------
   Grille de fichiers
   ------------------------------------------------------------------------- */
.filegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: .9rem; }

.card-file {
    position: relative; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem; cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .06s;
}
.card-file:hover { border-color: var(--brand-soft-2); box-shadow: var(--shadow); }
.card-file.is-selected { border-color: var(--brand); box-shadow: var(--ring); }
.card-file__thumb {
    width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin-bottom: .7rem;
    background: var(--brand-soft); overflow: hidden;
}
.card-file__thumb svg { width: 28px; height: 28px; }
.card-file__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-file__name { font-weight: 600; color: var(--ink); font-size: .92rem; word-break: break-word;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-file__meta { color: var(--muted); font-size: .78rem; margin-top: .25rem; }
.card-file__star { position: absolute; bottom: .55rem; right: .55rem; color: #d9c56b; opacity: 0;
    border: 0; background: transparent; padding: 3px; cursor: pointer; line-height: 0; border-radius: 8px; z-index: 2; }
.card-file__star:hover { background: rgba(0,0,0,.06); }
.card-file.is-starred .card-file__star, .card-file:hover .card-file__star { opacity: 1; }
.card-file__star.off { color: #cdd6d1; }
.card-file__menu { position: absolute; top: .5rem; right: .5rem; opacity: 0; transition: opacity .12s; }
.card-file:hover .card-file__menu { opacity: 1; }
.card-file.is-starred .card-file__star { color: #e0b93a; }

/* Mode liste : lignes horizontales compactes (flex, ordre explicite) */
#fileview[data-mode="list"] .filegrid { display: flex; flex-direction: column; gap: .3rem; }
#fileview[data-mode="list"] .card-file {
    display: flex; align-items: center; gap: .8rem; padding: .5rem .8rem;
}
#fileview[data-mode="list"] .card-file__check { position: static; opacity: 1; order: 1; flex: none; }
#fileview[data-mode="list"] .card-file__star  { position: static; opacity: 1; order: 2; flex: none; margin: 0; }
#fileview[data-mode="list"] .card-file__thumb { order: 3; width: 36px; height: 36px; margin: 0; border-radius: 9px; flex: none; }
#fileview[data-mode="list"] .card-file__thumb svg { width: 20px; height: 20px; }
#fileview[data-mode="list"] .card-file__name {
    order: 4; flex: 1 1 auto; min-width: 0; display: block; margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#fileview[data-mode="list"] .card-file__meta { order: 5; margin: 0; text-align: right; white-space: nowrap; flex: none; }
#fileview[data-mode="list"] .card-file__menu { order: 6; position: static; opacity: 1; flex: none; }
@media (max-width: 560px) {
    #fileview[data-mode="list"] .card-file__meta { display: none; }
}

/* Liste (tableau) */
.filetable { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.filetable thead th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.filetable tbody tr { border-bottom: 1px solid var(--line-2); cursor: pointer; }
.filetable tbody tr:last-child { border-bottom: 0; }
.filetable tbody tr:hover { background: var(--brand-soft); }
.filetable td { padding: .6rem 1rem; vertical-align: middle; }
.filetable .fname { display: flex; align-items: center; gap: .7rem; font-weight: 600; color: var(--ink); }
.filetable .ficon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); flex: none; }
.filetable .ficon svg { width: 20px; height: 20px; }
.filetable .col-actions { text-align: right; white-space: nowrap; }
.filetable .muted { color: var(--muted); font-size: .85rem; }
@media (max-width: 720px) { .filetable .hide-sm { display: none; } }

/* Menu contextuel */
.ctxmenu {
    position: fixed; z-index: 80; min-width: 200px; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; display: none;
}
.ctxmenu.open { display: block; }
.ctxmenu button { width: 100%; display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border: 0; background: none; border-radius: 8px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; text-align: left; }
.ctxmenu button:hover { background: var(--brand-soft); color: var(--brand-700); }
.ctxmenu button svg { width: 17px; height: 17px; color: var(--muted); }
.ctxmenu button:hover svg { color: var(--brand-700); }
.ctxmenu button.danger { color: var(--danger); }
.ctxmenu button.danger:hover { background: var(--danger-soft); }
.ctxmenu button.danger svg { color: var(--danger); }
.ctxmenu hr { border: 0; border-top: 1px solid var(--line-2); margin: .35rem .2rem; }

/* -------------------------------------------------------------------------
   État vide
   ------------------------------------------------------------------------- */
.empty { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty__icon { width: 76px; height: 76px; margin: 0 auto 1rem; border-radius: 20px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); }
.empty__icon svg { width: 38px; height: 38px; }
.empty h3 { color: var(--ink); margin-bottom: .3rem; }
.empty p { max-width: 40ch; margin: 0 auto 1.2rem; }

/* -------------------------------------------------------------------------
   Modales
   ------------------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,42,32,.42); z-index: 100; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .16s ease; }
.modal--wide { max-width: 560px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line-2); }
.modal__head h3 { font-size: 1.1rem; }
.modal__body { padding: 1.3rem; }
.modal__foot { padding: 1rem 1.3rem; border-top: 1px solid var(--line-2); display: flex; gap: .6rem; justify-content: flex-end; background: #fbfdfc; }
.modal__x { border: 0; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .1rem .4rem; border-radius: 8px; }
.modal__x:hover { background: var(--line-2); color: var(--text); }
.modal__body { line-height: 1.5; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { padding: .5rem .9rem; font-size: .88rem; cursor: pointer; color: var(--muted); }
.seg label:has(input:checked) { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.seg input { display: none; }

.copyrow { display: flex; gap: .5rem; }
.copyrow .input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .82rem; }

.sharelist { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .5rem; }
.sharelist li { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line-2); border-radius: 10px; font-size: .88rem; }
.sharelist .who { display: flex; flex-direction: column; min-width: 0; }
.sharelist .who b { color: var(--ink); font-size: .88rem; }
.sharelist .who small { color: var(--muted); }
.sharelist .perm { margin-left: auto; font-size: .74rem; color: var(--brand-700); background: var(--brand-soft); padding: .12rem .5rem; border-radius: 999px; }
.pill { font-size: .72rem; padding: .12rem .5rem; border-radius: 999px; background: var(--line-2); color: var(--muted); }
.pill--link { background: #eaf1fb; color: var(--info); }
.pill--user { background: var(--brand-soft); color: var(--brand-700); }

/* -------------------------------------------------------------------------
   Toasts
   ------------------------------------------------------------------------- */
.toasts { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 200; display: grid; gap: .55rem; }
.toast { display: flex; align-items: center; gap: .6rem; background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .9rem; animation: slidein .2s ease; max-width: 340px; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--success { background: var(--brand-700); }
.toast--error { background: #a53232; }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Barre de progression d'upload */
.uploadbar { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 190; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; display: none; }
.uploadbar.open { display: block; }
.uploadbar__head { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; font-weight: 600; color: var(--ink); font-size: .9rem; border-bottom: 1px solid var(--line-2); }
.uploadbar__item { padding: .6rem .9rem; font-size: .84rem; }
.uploadbar__item .row { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.uploadbar__item .name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploadbar__track { height: 5px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.uploadbar__prog { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.uploadbar__item.done .uploadbar__prog { background: var(--brand-600); }
.uploadbar__item.error .name { color: var(--danger); }

/* Utilitaires */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.text-muted { color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -100%; top: 0; width: 260px; z-index: 120; transition: left .2s; box-shadow: var(--shadow-lg); }
    .sidebar.open { left: 0; }
    .topbar__menu { display: inline-grid !important; }
    .scrim { position: fixed; inset: 0; background: rgba(15,42,32,.4); z-index: 110; display: none; }
    .scrim.open { display: block; }
}
.topbar__menu { display: none; }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Aperçu intégré (lightbox)
   ============================================================ */
.preview-backdrop{
    position:fixed; inset:0; z-index:1200;
    background:rgba(15,42,32,.72); backdrop-filter:blur(3px);
    display:none; align-items:center; justify-content:center; padding:2.2rem;
}
.preview-backdrop.open{ display:flex; }
.preview{
    background:#fff; border-radius:var(--radius);
    width:min(1040px,100%); max-height:92vh;
    display:flex; flex-direction:column; overflow:hidden;
    box-shadow:0 24px 60px rgba(0,0,0,.35);
}
.preview__bar{
    display:flex; align-items:center; justify-content:space-between;
    gap:1rem; padding:.7rem .9rem; border-bottom:1px solid var(--line);
}
.preview__title{
    font-weight:600; color:var(--ink);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.preview__actions{ display:flex; align-items:center; gap:.25rem; flex:none; }
.preview__stage{
    flex:1; min-height:0; overflow:auto;
    display:flex; align-items:center; justify-content:center;
    background:rgba(0,0,0,.03);
}
.preview__stage img{ max-width:100%; max-height:86vh; display:block; }
.preview__stage iframe{ width:100%; height:86vh; border:0; background:#fff; }
.preview__stage video{ max-width:100%; max-height:86vh; background:#000; }
.preview__stage audio{ width:min(560px,90%); }
.preview__stage pre{
    margin:0; padding:1.2rem; width:100%; max-height:86vh; overflow:auto;
    font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    color:var(--ink); white-space:pre-wrap; word-break:break-word;
}
.preview__empty{
    padding:3rem 2rem; text-align:center; color:var(--muted);
    display:flex; flex-direction:column; align-items:center; gap:1rem;
}
.preview__empty svg{ width:56px; height:56px; color:var(--brand-600); opacity:.7; }

/* ============================================================
   Sélection multiple + actions groupées
   ============================================================ */
.card-file__check {
    position: absolute; top: .5rem; left: .5rem; z-index: 2;
    opacity: 0; transition: opacity .12s;
}
.card-file:hover .card-file__check,
.card-file.is-selected .card-file__check { opacity: 1; }
.card-file__check input {
    width: 18px; height: 18px; accent-color: var(--brand-600); cursor: pointer; margin: 0;
}
.card-file.is-selected { outline: 2px solid var(--brand-600); outline-offset: 1px; }
#fileview[data-mode="list"] .card-file__check { position: static; opacity: 1; }

.selbar {
    position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
    display: flex; align-items: center; gap: .9rem; z-index: 1100;
    background: var(--ink); color: #fff;
    padding: .5rem .7rem .5rem .5rem; border-radius: 999px;
    box-shadow: 0 12px 34px rgba(0,0,0,.28);
}
.selbar[hidden] { display: none; }
.selbar__count { font-size: .9rem; white-space: nowrap; }
.selbar__actions { display: flex; gap: .4rem; }
.selbar .btn { padding: .42rem .75rem; font-size: .85rem; display: inline-flex; align-items: center; gap: .35rem; }
.selbar__close { color: #fff; }
.selbar__close:hover { color: #fff; opacity: .8; }

/* ============================================================
   Glisser / déposer + polish visuel
   ============================================================ */
/* Transition plus douce + léger relief au survol des cartes */
.card-file { transition: border-color .15s, box-shadow .18s, transform .12s; }
.card-file:hover { transform: translateY(-2px); }
.card-file[draggable="true"] { cursor: pointer; }
.card-file[draggable="true"]:active { cursor: grabbing; }

/* Élément en cours de déplacement */
.card-file.dragging { opacity: .45; transform: scale(.98); }
body.is-dragging { cursor: grabbing; }
body.is-dragging .card-file:not(.dragging) { transition: box-shadow .12s, outline-color .12s; }

/* Cible de dépôt : carte dossier */
.card-file.drop-target {
    outline: 2px dashed var(--brand-600); outline-offset: 2px;
    background: var(--brand-soft); border-color: var(--brand-600);
    transform: translateY(-2px);
}
.card-file.drop-target .card-file__thumb { transform: scale(1.06); transition: transform .12s; }

/* Cible de dépôt : fil d'Ariane */
.breadcrumb a { padding: .12rem .45rem; border-radius: 8px; transition: background .12s, color .12s; }
.breadcrumb a.drop-target {
    background: var(--brand-600); color: #fff;
    outline: 2px dashed var(--brand-600); outline-offset: 2px;
}

/* Indice discret quand on drague : on met en avant les dossiers déposables */
body.is-dragging .card-file[data-folder="1"]:not(.dragging) {
    border-color: var(--brand-soft-2); box-shadow: var(--shadow);
}

/* ============================================================
   Polish visuel v2 — profondeur, dégradés subtils, micro-détails
   (bloc additif : n'altère pas la structure existante)
   ============================================================ */

/* Barre latérale : léger dégradé vertical pour la profondeur */
.sidebar {
    background: linear-gradient(180deg, #143a2c 0%, var(--brand-ink) 55%, #0b2019 100%);
    border-right: 1px solid rgba(255,255,255,.04);
}
/* Élément de navigation actif : accent à gauche + halo doux */
.nav a.is-active {
    background: linear-gradient(90deg, var(--brand-600), var(--brand));
    box-shadow: inset 3px 0 0 #8fd3b6, 0 6px 16px rgba(53,128,95,.30);
}
.nav a { transition: background .14s, color .14s, box-shadow .14s, transform .12s; }
.nav a:active { transform: translateX(1px); }
.nav .count { font-variant-numeric: tabular-nums; }

/* Bouton principal (par défaut) : dégradé + ombre teintée + petit relief */
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--danger) {
    background: linear-gradient(180deg, var(--brand), var(--brand-600));
    box-shadow: 0 2px 6px rgba(53,128,95,.22);
}
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--danger):hover {
    background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
    transform: translateY(-1px); box-shadow: 0 7px 18px rgba(53,128,95,.28);
}
.btn:not(.btn--ghost):not(.btn--soft):not(.btn--danger):active { transform: translateY(0); }
.btn--danger { box-shadow: 0 2px 6px rgba(214,69,69,.22); }
.btn--danger:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(214,69,69,.28); }

/* Cartes fichiers : ombre douce au repos + vignette légèrement cerclée */
.card-file { box-shadow: 0 1px 2px rgba(15,42,32,.035); }
.card-file:hover { box-shadow: 0 8px 22px rgba(15,42,32,.09); }
.card-file__thumb { box-shadow: inset 0 0 0 1px rgba(15,42,32,.05); }

/* Recherche : légère ombre au repos, halo net au focus */
.topbar__search input { box-shadow: 0 1px 2px rgba(15,42,32,.03); transition: box-shadow .15s, border-color .15s; }
.topbar__title h1 { letter-spacing: -.01em; }

/* Avatar : dégradé + fin anneau */
.avatar {
    background: linear-gradient(135deg, var(--brand), var(--brand-700));
    box-shadow: 0 0 0 3px rgba(62,145,114,.16); transition: box-shadow .15s, transform .12s;
}
.avatar:hover { transform: translateY(-1px); box-shadow: 0 0 0 4px rgba(62,145,114,.20); }

/* État vide : icône avec ombre teintée */
.empty__icon { box-shadow: 0 10px 26px rgba(62,145,114,.16); }

/* Barre de sélection : petite entrée en fondu montant */
.selbar { animation: selbar-in .18s ease; }
@keyframes selbar-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Grille : apparition douce au chargement */
.filegrid { animation: grid-in .25s ease both; }
@keyframes grid-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Barres de défilement fines et discrètes */
* { scrollbar-width: thin; scrollbar-color: #c7d6ce transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd8d1; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b1c3ba; }
::-webkit-scrollbar-track { background: transparent; }

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .filegrid, .selbar { animation: none; }
    .card-file, .btn, .avatar, .nav a { transition: none; }
    .card-file:hover, .btn:hover, .avatar:hover { transform: none; }
}

/* ============================================================
   Tableau de bord « accueil » (refonte maquette) + accent orange
   ============================================================ */
:root {
    --accent:      #f6871f;
    --accent-600:  #e5750f;
    --accent-700:  #cc6708;
    --accent-soft: #fff2e6;
}

/* --- Barre latérale : logo, bouton orange, nav secondaire, promo --- */
.sidebar { overflow-y: auto; }
.sidebar__brand { padding: .2rem .4rem 1.2rem; justify-content: center; }
.sidebar__brand img { height: 44px; }

.btn--accent { background: linear-gradient(180deg, var(--accent), var(--accent-600)) !important; color: #fff !important; box-shadow: 0 4px 12px rgba(246,135,31,.30) !important; }
.btn--accent:hover { background: linear-gradient(180deg, var(--accent-600), var(--accent-700)) !important; transform: translateY(-1px); }

.nav--sec { margin-top: .3rem; padding-top: .5rem; border-top: 1px solid rgba(255,255,255,.08); }

/* « Gérer mon offre » en orange (contour) */
.sidebar__upgrade { color: #ffd9b0; border-color: rgba(246,135,31,.55); font-weight: 600; }
.sidebar__upgrade:hover { background: rgba(246,135,31,.14); color: #fff; }

/* Carte promo Pro */
.promo { margin: .8rem .3rem .2rem; padding: 1rem 1rem .95rem; border-radius: 16px; position: relative; overflow: hidden;
    background: linear-gradient(155deg, rgba(246,135,31,.20), rgba(246,135,31,.05) 60%, rgba(255,255,255,.02));
    border: 1px solid rgba(246,135,31,.32); box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.promo::before { content: ""; position: absolute; inset: -40px -30px auto auto; width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(246,135,31,.45), transparent 65%); filter: blur(6px); }
.promo__tag { display: inline-block; position: relative; z-index: 1; font-size: .64rem; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase; color: #ffd9b0;
    background: rgba(246,135,31,.18); border: 1px solid rgba(246,135,31,.35);
    padding: .18rem .5rem; border-radius: 999px; margin-bottom: .55rem; }
.promo b { display: block; color: #fff; font-size: 1rem; position: relative; z-index: 1; }
.promo p { color: #cfe0d8; font-size: .78rem; margin: .3rem 0 .8rem; position: relative; z-index: 1; }
.promo .btn { position: relative; z-index: 1; }
.promo__rocket { position: absolute; right: .7rem; top: .8rem; font-size: 1.3rem; z-index: 1; }

/* Badge générique (états, étiquettes) */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600;
    padding: .2rem .55rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-700);
    border: 1px solid var(--brand-soft-2); line-height: 1.4; }
.badge--accent { background: var(--accent-soft); color: var(--accent-700); border-color: rgba(246,135,31,.3); }
.badge--muted { background: var(--line-2); color: var(--muted); border-color: var(--line); }

/* --- Barre du haut : recherche centrée, cloche, avatar nommé --- */
.topbar__title h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.topbar__title span { font-size: .88rem; }
.topbar__search { flex: 1; max-width: 460px; margin: 0 auto; }
.topbar__search input { padding-top: .62rem; padding-bottom: .62rem; }

.bell { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    color: var(--text); background: #fff; border: 1px solid var(--line); flex: none; transition: background .15s, box-shadow .15s; }
.bell:hover { background: var(--brand-soft); color: var(--brand-700); }
.bell svg { width: 20px; height: 20px; }

.usermenu__btn { display: flex; align-items: center; gap: .55rem; background: #fff; border: 1px solid var(--line);
    border-radius: 999px; padding: .3rem .7rem .3rem .3rem; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.usermenu__btn:hover { border-color: var(--brand-soft-2); box-shadow: var(--shadow); }
.usermenu__name { font-weight: 600; font-size: .9rem; color: var(--ink); }
.usermenu__chev { width: 16px; height: 16px; color: var(--muted); }
@media (max-width: 720px) { .usermenu__name, .usermenu__chev { display: none; } .usermenu__btn { padding: .25rem; border: 0; } }

/* --- Cartes de statistiques --- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; margin-bottom: 1.4rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem;
    box-shadow: 0 1px 2px rgba(15,42,32,.04), 0 10px 26px rgba(15,42,32,.05); }
.stat__icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 1rem; color: #fff; }
.stat__icon svg { width: 26px; height: 26px; }
.stat__icon--green  { background: var(--brand-600); }
.stat__icon--dark   { background: var(--brand-ink); }
.stat__icon--orange { background: var(--accent); }
.stat__label { text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.stat__value { font-size: 2rem; font-weight: 800; color: var(--ink); margin: .15rem 0; line-height: 1.1; }
.stat__value--sm { font-size: 1.35rem; } .stat__value--sm span { color: var(--muted); font-weight: 600; font-size: .95rem; }
.stat__value--text { font-size: 1.05rem; font-weight: 600; } .stat__value--text b { color: var(--accent-600); font-weight: 800; }
.stat__hint { color: var(--muted); font-size: .85rem; }
.stat__bar { height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; margin: .55rem 0 .4rem; }
.stat__bar span { display: block; height: 100%; background: linear-gradient(90deg, #6fc39d, var(--brand)); border-radius: 999px; }
.stat__link { display: inline-block; margin-top: .9rem; color: var(--brand-700); font-weight: 600; font-size: .85rem; }
.stat__link span { transition: transform .12s; display: inline-block; }
.stat__link:hover span { transform: translateX(3px); }
.stat__link--orange { color: var(--accent-600); }

/* --- Deux colonnes --- */
.dash-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 1.2rem; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem 1.4rem;
    box-shadow: 0 1px 2px rgba(15,42,32,.04), 0 10px 26px rgba(15,42,32,.05); margin-bottom: 1.2rem; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel__head h2 { font-size: 1.08rem; display: flex; align-items: center; gap: .4rem; }
.panel__pulse { color: var(--brand); }
.panel__link { color: var(--brand-700); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.panel__link:hover { color: var(--brand-600); }
.panel__empty { color: var(--muted); font-size: .9rem; padding: 1.4rem 0; text-align: center; }

/* --- Table des fichiers récents --- */
.ftable { width: 100%; border-collapse: collapse; }
.ftable th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em;
    color: var(--muted); font-weight: 700; padding: .5rem .5rem; border-bottom: 1px solid var(--line); }
.ftable td { padding: .65rem .5rem; border-bottom: 1px solid var(--line-2); font-size: .9rem; vertical-align: middle; }
.ftable tr:last-child td { border-bottom: 0; }
.ftable .ta-r { text-align: right; }
.ftable__name { display: flex; align-items: center; gap: .7rem; color: var(--ink); font-weight: 600; }
.ftable__glyph { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: rgba(0,0,0,.03); flex: none; }
.ftable__glyph svg { width: 20px; height: 20px; }
.ftable__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.ftable__star { color: #e0b93a; }
.ftable tbody tr { transition: background .12s; }
.ftable tbody tr:hover { background: var(--brand-soft); }
.ftable__more { display: inline-block; margin-top: 1rem; color: var(--brand-700); font-weight: 600; font-size: .88rem; }
.owner { display: inline-flex; align-items: center; gap: .45rem; color: var(--text); font-size: .85rem; }
.owner__av { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-600); color: #fff; display: grid; place-items: center; font-size: .66rem; font-weight: 700; }

/* --- Activité récente --- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity__item { display: flex; align-items: center; gap: .7rem; padding: .6rem .1rem; border-bottom: 1px solid var(--line-2); }
.activity__item:last-child { border-bottom: 0; }
.activity__glyph { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,.03); flex: none; }
.activity__glyph svg { width: 20px; height: 20px; }
.activity__text { display: flex; flex-direction: column; min-width: 0; }
.activity__text b { font-size: .88rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity__text span { font-size: .78rem; color: var(--muted); }

/* --- Anneau de stockage --- */
.storage { display: flex; align-items: center; gap: 1.3rem; padding: .3rem 0 1.1rem; }
.donut { position: relative; width: 118px; height: 118px; flex: none; }
.donut svg { width: 118px; height: 118px; }
.donut__track { fill: none; stroke: var(--line-2); stroke-width: 14; }
.donut__val { fill: none; stroke: var(--brand); stroke-width: 14; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.donut__pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 1.35rem; color: var(--ink); }
.storage__legend { display: flex; flex-direction: column; gap: .7rem; font-size: .86rem; color: var(--muted); }
.storage__legend b { color: var(--ink); margin-left: .2rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; }
.dot--green { background: var(--brand); } .dot--grey { background: var(--line); }
.secure-box { display: flex; align-items: center; gap: .8rem; background: var(--brand-soft); border: 1px solid var(--brand-soft-2); border-radius: 12px; padding: .85rem 1rem; }
.secure-box svg { width: 24px; height: 24px; color: var(--brand-600); flex: none; }
.secure-box b { display: block; color: var(--brand-700); font-size: .88rem; }
.secure-box span { font-size: .78rem; color: var(--brand-700); opacity: .82; }

/* --- Pied de page --- */
.dash-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.dash-foot nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.dash-foot a { color: var(--muted); } .dash-foot a:hover { color: var(--brand-700); }

/* --- Responsive --- */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } .dash-foot { flex-direction: column; align-items: flex-start; gap: .6rem; } }

/* Menu « Nouveau » (barre latérale) */
.newmenu { position: relative; }
.newmenu .btn { position: relative; }
.newmenu__caret { width: 15px; height: 15px; margin-left: .1rem; opacity: .95; }
.newmenu__pop {
    position: absolute; left: .1rem; right: .1rem; top: calc(100% + .4rem); z-index: 60;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: .35rem; display: none;
}
.newmenu.open .newmenu__pop { display: block; animation: pop-in .14s ease; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.newmenu__pop button {
    display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; background: transparent;
    padding: .55rem .6rem; border-radius: 8px; cursor: pointer; color: var(--text);
    font: inherit; font-size: .9rem; text-align: left;
}
.newmenu__pop button:hover { background: var(--brand-soft); color: var(--brand-700); }
.newmenu__pop button svg { width: 18px; height: 18px; flex: none; }

/* Fiche des raccourcis clavier */
.shortcuts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; }
.shortcuts li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem .2rem; border-bottom: 1px solid var(--line-2); }
.shortcuts li:last-child { border-bottom: 0; }
.shortcuts span { color: var(--text); font-size: .92rem; }
.shortcuts kbd { font: 600 .8rem var(--font); background: var(--brand-soft); color: var(--brand-700);
    border: 1px solid var(--brand-soft-2); border-bottom-width: 2px; border-radius: 6px; padding: .15rem .5rem; min-width: 1.4rem; text-align: center; }

/* Filtre par type (select compact dans la barre d'actions) */
.select--sm { width: auto; min-width: 160px; padding: .5rem 2rem .5rem .8rem; font-size: .88rem; }

/* Notifications (cloche) */
.bellmenu { position: relative; }
.bell__badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px;
    background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px;
    display: grid; place-items: center; border: 2px solid var(--bg); }
.bellmenu__pop { position: absolute; right: 0; top: calc(100% + .5rem); width: 330px; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; display: none; z-index: 50; }
.bellmenu.open .bellmenu__pop { display: block; animation: pop-in .14s ease; }
.bellmenu__head { font-weight: 700; color: var(--ink); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: .5rem .6rem; }
.bellmenu__empty { color: var(--muted); font-size: .88rem; padding: 1.1rem .6rem; text-align: center; }
.bellmenu__item { display: flex; gap: .6rem; align-items: center; padding: .55rem .6rem; border-radius: 10px; }
.bellmenu__item:hover { background: var(--brand-soft); }
.bellmenu__glyph { width: 34px; height: 34px; border-radius: 9px; background: rgba(0,0,0,.03); display: grid; place-items: center; flex: none; }
.bellmenu__glyph svg { width: 18px; height: 18px; }
.bellmenu__text { display: flex; flex-direction: column; min-width: 0; }
.bellmenu__text b { font-size: .88rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bellmenu__text span { font-size: .76rem; color: var(--muted); }
.bellmenu__all { display: block; text-align: center; padding: .55rem; margin-top: .2rem; border-top: 1px solid var(--line-2); color: var(--brand-700); font-weight: 600; font-size: .85rem; }
.bellmenu__all:hover { background: var(--brand-soft); }

/* Notification non lue : point + léger fond */
.bellmenu__item.is-new { background: rgba(246,135,31,.06); }
.bellmenu__item.is-new::before { content: ""; position: absolute; left: .2rem; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.bellmenu__item { position: relative; padding-left: .9rem; }

/* Flèches de navigation de la lightbox */
.preview { position: relative; }
.preview__nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(255,255,255,.92); border: 1px solid var(--line); color: var(--ink);
    cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.18); transition: background .12s, transform .12s; }
.preview__nav:hover { background: #fff; }
.preview__nav:active { transform: translateY(-50%) scale(.94); }
.preview__nav[disabled] { opacity: .35; cursor: default; }
.preview__nav[hidden] { display: none; }
.preview__nav--prev { left: .8rem; }
.preview__nav--next { right: .8rem; }
.preview__nav svg { width: 22px; height: 22px; }

/* ============================================================
   Thème sombre — activé via <html data-theme="dark">
   Bloc additif : n'affecte pas le thème clair.
   ============================================================ */
[data-theme="dark"] {
    --brand-soft:   rgba(62,145,114,.15);
    --brand-soft-2: rgba(62,145,114,.28);
    --ink:    #eaf1ed;
    --text:   #c3d0c9;
    --muted:  #8ba298;
    --line:   #29332e;
    --line-2: #1f2a25;
    --bg:     #0f1512;
    --card:   #171f1b;
    --white:  #171f1b;
    --danger-soft: rgba(214,69,69,.16);
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
    --shadow-lg: 0 14px 40px rgba(0,0,0,.6);
    color-scheme: dark;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }

/* Surfaces qui étaient blanches en dur -> surface sombre */
[data-theme="dark"] .topbar,
[data-theme="dark"] .stat,
[data-theme="dark"] .panel,
[data-theme="dark"] .card-file,
[data-theme="dark"] .modal,
[data-theme="dark"] .bell,
[data-theme="dark"] .usermenu__btn,
[data-theme="dark"] .usermenu__menu,
[data-theme="dark"] .newmenu__pop,
[data-theme="dark"] .bellmenu__pop,
[data-theme="dark"] .ctxmenu,
[data-theme="dark"] .preview,
[data-theme="dark"] .select,
[data-theme="dark"] .topbar__search input,
[data-theme="dark"] .input,
[data-theme="dark"] .modal input,
[data-theme="dark"] .modal textarea,
[data-theme="dark"] .modal select {
    background: var(--card);
    border-color: var(--line);
    color: var(--text);
}
[data-theme="dark"] .topbar { border-color: var(--line); }
[data-theme="dark"] .card-file__label,
[data-theme="dark"] .stat__value,
[data-theme="dark"] .panel__head h2,
[data-theme="dark"] .ftable__name,
[data-theme="dark"] .modal__head h3 { color: var(--ink); }

/* Fonds de vignettes/glyphes (étaient rgba(0,0,0,.03)) */
[data-theme="dark"] .card-file__thumb,
[data-theme="dark"] .ftable__glyph,
[data-theme="dark"] .activity__glyph,
[data-theme="dark"] .bellmenu__glyph,
[data-theme="dark"] .preview__stage { background: rgba(255,255,255,.05); }

/* Barre de sélection : garder un fond sombre (utilisait --ink, désormais clair) */
[data-theme="dark"] .selbar { background: #222e28; }

/* Flèches de la lightbox : pastille sombre */
[data-theme="dark"] .preview__nav { background: rgba(20,28,24,.92); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .preview__nav:hover { background: #1c2621; }

/* Champs de saisie : couleur du texte */
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { color: var(--text); }
[data-theme="dark"] ::placeholder { color: var(--muted); }

/* Scrollbars sombres */
[data-theme="dark"] * { scrollbar-color: #33413a transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #33413a; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #445349; }

/* Répartition du stockage par type (tableau de bord) */
.breakdown { margin-top: .4rem; padding-top: 1rem; border-top: 1px solid var(--line-2); }
.breakdown__title { font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .7rem; }
.breakdown__row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: .6rem; margin-bottom: .55rem; font-size: .85rem; }
.breakdown__name { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); white-space: nowrap; }
.breakdown__bar { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.breakdown__bar span { display: block; height: 100%; border-radius: 999px; }
.breakdown__val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Badge d'offre (barre latérale, fond sombre) */
.planbadge { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700;
    letter-spacing: .02em; padding: .16rem .5rem; border-radius: 999px;
    background: rgba(255,255,255,.10); color: #dcece4; border: 1px solid rgba(255,255,255,.14); }
.planbadge svg { opacity: .8; }
.planbadge--pro { background: linear-gradient(180deg, var(--accent), var(--accent-600)); color: #fff; border-color: rgba(246,135,31,.5); box-shadow: 0 2px 8px rgba(246,135,31,.35); }
.planbadge--pro svg { opacity: 1; }

/* Lignes de l'historique des versions */
.versrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem .2rem; border-bottom: 1px solid var(--line-2); }
.versrow:last-child { border-bottom: 0; }
.versrow__info { display: flex; flex-direction: column; }
.versrow__info b { font-size: .92rem; color: var(--ink); }
.versrow__info span { font-size: .8rem; color: var(--muted); }
.versrow__act { display: flex; gap: .4rem; flex: none; }

/* Éditeur en ligne */
.modal--wide { max-width: 920px; width: 94vw; }
.editor { width: 100%; min-height: 56vh; box-sizing: border-box;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9rem; line-height: 1.5;
    border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; resize: vertical;
    white-space: pre; overflow: auto; tab-size: 4; background: var(--card); color: var(--ink); }
.editor:focus { outline: none; border-color: var(--brand-600); box-shadow: var(--ring); }

/* Graphique des rapports */
.chart { width: 100%; height: auto; display: block; margin: .3rem 0 .6rem; }

/* Page « Mes partages » */
.tablewrap { overflow-x: auto; }
.ftable--shares { width: 100%; }
.ftable--shares td, .ftable--shares th { white-space: nowrap; }
.ftable--shares .ellip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.rowacts { display: inline-flex; gap: .4rem; justify-content: flex-end; }

/* Aperçu enrichi : Markdown + code */
.mdview { max-width: 780px; margin: 0 auto; background: #fff; color: var(--ink);
    padding: 2rem 2.4rem; border-radius: 12px; line-height: 1.65; max-height: 78vh; overflow: auto; text-align: left; }
.mdview h1, .mdview h2, .mdview h3, .mdview h4 { line-height: 1.25; margin: 1.3em 0 .5em; font-weight: 700; }
.mdview h1 { font-size: 1.7rem; border-bottom: 1px solid var(--line); padding-bottom: .3em; }
.mdview h2 { font-size: 1.35rem; border-bottom: 1px solid var(--line-2); padding-bottom: .2em; }
.mdview h3 { font-size: 1.15rem; } .mdview h4 { font-size: 1rem; }
.mdview p { margin: .7em 0; }
.mdview ul, .mdview ol { margin: .6em 0 .6em 1.4em; } .mdview li { margin: .25em 0; }
.mdview a { color: var(--brand-700); text-decoration: underline; }
.mdview code { background: var(--line-2); padding: .1em .4em; border-radius: 5px; font-size: .9em;
    font-family: ui-monospace, Menlo, Consolas, monospace; }
.mdview pre.md-code { background: #0f2a20; color: #e6f2ec; padding: 1rem 1.2rem; border-radius: 10px;
    overflow: auto; margin: 1em 0; }
.mdview pre.md-code code { background: none; padding: 0; color: inherit; font-size: .86rem; line-height: 1.5; }
.mdview blockquote { border-left: 3px solid var(--brand); margin: .8em 0; padding: .2em 1em; color: var(--muted); background: var(--brand-soft); border-radius: 0 8px 8px 0; }
.mdview hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.codeview { max-width: 900px; margin: 0 auto; text-align: left; background: #0f2a20; color: #e6f2ec;
    padding: 1.2rem 1.4rem; border-radius: 12px; overflow: auto; max-height: 78vh;
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.55; white-space: pre; }
[data-theme="dark"] .mdview { background: #14201c; }

/* Étiquettes */
.tagdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tagrow { display: flex; align-items: center; gap: .55rem; padding: .35rem .2rem; }
.tagrow .tagchip { display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem; border-radius: 999px; border: 1px solid; font-size: .8rem; font-weight: 600; flex: 1; }
.tagrow .tagdel { margin-left: auto; color: var(--muted); font-size: .8rem; }
.card-file__tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: .25rem 0 0; }
.tagpill { display: inline-flex; align-items: center; gap: .28rem; padding: .06rem .45rem; border-radius: 999px;
    border: 1px solid; font-size: .68rem; font-weight: 600; text-decoration: none; line-height: 1.5; }
.sidebar__tags { padding: .5rem .5rem 0; }
.sidebar__tags-h { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .3rem .6rem; }
.sidetag { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .86rem; }
.sidetag:hover { background: var(--hover); }
.sidetag.is-active { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
.sidetag__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidetag__nb { color: var(--muted); font-size: .78rem; }

/* Corbeille : compte à rebours avant purge */
.card-file__purge { display: inline-flex; align-items: center; gap: .3rem; margin: .25rem 0 0;
    font-size: .72rem; font-weight: 600; color: var(--muted); }
.card-file__purge.is-soon { color: #c0392b; }

/* Doublons (rapports) */
.dupgroup { border: 1px solid var(--line-2); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .8rem; }
.dupgroup__head { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.duprow { display: flex; align-items: center; gap: .8rem; padding: .4rem 0; border-top: 1px solid var(--line-2); }
.duprow:first-of-type { border-top: 0; }
.duprow .ellip { flex: 1; display: flex; align-items: center; gap: .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Coloration syntaxique (jetons) */
.codeview code { font: inherit; }
.tok-com { color: #7fa88f; font-style: italic; }
.tok-str { color: #e6b673; }
.tok-num { color: #d98a7b; }
.tok-kw  { color: #83c8ff; font-weight: 600; }
.tok-lit { color: #c493e0; }
.mdview pre.md-code .tok-com { color: #8fb3a0; }
.mdview pre.md-code .tok-str { color: #e6b673; }
.mdview pre.md-code .tok-kw  { color: #83c8ff; }

/* Alerte d'avertissement (nouvel appareil, etc.) */
.alert--warn { background: #fff4e5; border: 1px solid #f6871f55; color: #8a4b00; display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-radius: 12px; }
.alert--warn svg { width: 22px; height: 22px; color: #e5750f; }
[data-theme="dark"] .alert--warn { background: #3a2a12; color: #ffd9a8; }

/* Panneau Détails */
.infohead { display: flex; align-items: center; gap: .7rem; padding: .2rem 0 1rem; border-bottom: 1px solid var(--line-2); margin-bottom: .8rem; }
.infohead__glyph { font-size: 1.6rem; }
.infohead b { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.infolist { display: flex; flex-direction: column; gap: .1rem; }
.inforow { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .2rem; border-bottom: 1px solid var(--line-2); font-size: .88rem; }
.inforow:last-child { border-bottom: 0; }
.inforow > span { color: var(--muted); flex: none; }
.inforow > b { text-align: right; word-break: break-word; font-weight: 600; }
.inforow .tagpill { font-weight: 600; }

/* Commentaires */
.comitem { padding: .6rem .2rem; border-bottom: 1px solid var(--line-2); }
.comitem:last-child { border-bottom: 0; }
.comitem__head { display: flex; align-items: center; gap: .6rem; font-size: .82rem; margin-bottom: .25rem; }
.comitem__head b { color: var(--ink); }
.comitem__head .muted { font-size: .75rem; }
.comitem__head .comdel { margin-left: auto; color: var(--muted); font-size: .8rem; }
.comitem__body { font-size: .9rem; color: var(--text); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

/* Aperçu CSV en tableau */
.csvwrap { overflow: auto; max-height: 72vh; }
.csvtable { border-collapse: collapse; width: 100%; font-size: .84rem; }
.csvtable th, .csvtable td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; white-space: nowrap; }
.csvtable thead th { position: sticky; top: 0; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; z-index: 1; }
.csvtable tbody tr:nth-child(even) { background: var(--line-2); }
.csvmeta { margin-top: .6rem; color: var(--muted); font-size: .78rem; }
[data-theme="dark"] .csvtable thead th { background: #14241d; color: #eaf6f0; }

/* Pastille commentaires sur les cartes */
.card-file__com { display: inline-flex; align-items: center; gap: .2rem; margin-left: .5rem;
    color: var(--muted); font-size: .74rem; font-weight: 600; }
.card-file__com svg { color: #2f74c0; }

/* Suppression d'une recherche enregistrée */
.sidetag__del { margin-left: auto; color: var(--muted); font-size: .78rem; opacity: 0; transition: opacity .15s; }
.sidetag:hover .sidetag__del { opacity: 1; }

/* Présence live dans l'éditeur */
.editpresence { padding: .5rem .8rem; margin-bottom: .6rem; border-radius: 8px; font-size: .84rem;
    background: var(--brand-soft); color: var(--brand-ink); border: 1px solid var(--line-2); }
.editpresence--warn { background: #fff4e5; color: #8a4b00; border-color: #f6871f55; }

/* Lien de téléchargement dans un dossier partagé */
.sharedl { margin-left: .5rem; color: var(--brand-700); text-decoration: none; font-weight: 700; }
.sharedl:hover { color: var(--brand); }

/* Membres d'un partage */
.memberrow { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-top: 1px solid var(--line-2); }
.memberrow:first-of-type { border-top: 0; }
.memberrow__id { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.memberrow .memberperm { width: auto; padding: .2rem .5rem; font-size: .8rem; }
.memberrow .memberdel { color: var(--muted); }

/* Galerie photos */
.galmonth { margin-bottom: 1.6rem; }
.galmonth__title { font-size: .95rem; font-weight: 600; margin: 0 0 .7rem; color: var(--brand-ink); }
.galgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.galphoto { aspect-ratio: 1; border: 0; border-radius: 10px; background-size: cover; background-position: center;
    background-color: var(--line-2); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.galphoto:hover { transform: scale(1.02); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.gallb { position: fixed; inset: 0; z-index: 3000; background: rgba(10,20,16,.92);
    display: flex; align-items: center; justify-content: center; }
.gallb[hidden] { display: none; }
.gallb__stage { margin: 0; max-width: 92vw; max-height: 90vh; text-align: center; }
.gallb__stage img { max-width: 92vw; max-height: 82vh; border-radius: 8px; object-fit: contain; }
.gallb__cap { color: #eaf6f0; font-size: .85rem; margin-top: .6rem; }
.gallb__close { position: absolute; top: 1rem; right: 1.2rem; background: none; border: 0;
    color: #fff; font-size: 2rem; cursor: pointer; line-height: 1; }
.gallb__nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12);
    border: 0; color: #fff; font-size: 2.4rem; width: 3rem; height: 4rem; cursor: pointer; border-radius: 8px; }
.gallb__prev { left: 1rem; } .gallb__next { right: 1rem; }
.gallb__nav:hover { background: rgba(255,255,255,.25); }

/* En-tête de section dans le panneau Détails (EXIF) */
.inforow--head { border-top: 1px solid var(--line-2); margin-top: .4rem; padding-top: .5rem; }
.inforow--head span { font-weight: 600; color: var(--brand-ink); }

/* Centre de notifications */
.notiflist { display: flex; flex-direction: column; gap: .4rem; max-width: 720px; }
.notifcard { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border: 1px solid var(--line);
    border-radius: 10px; background: #fff; text-decoration: none; color: inherit; transition: background .12s; }
.notifcard:hover { background: var(--brand-soft); }
.notifcard.is-unread { border-left: 3px solid var(--brand); background: var(--brand-soft); }
.notifcard__glyph { font-size: 1.3rem; flex: none; }
.notifcard__body { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.notifcard__body b { font-size: .92rem; }
.notifcard__desc { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notifcard__time { font-size: .76rem; color: var(--muted); flex: none; }
[data-theme="dark"] .notifcard { background: #14241d; }

/* ---- Page Paramètres : grille + cartes homogènes ---- */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; max-width: 1080px; margin: 0 auto; align-items: start; }
@media (max-width: 820px) { .set-grid { grid-template-columns: 1fr; } }
.set-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 1px 2px rgba(15,42,32,.04); }
.set-card--full { grid-column: 1 / -1; }
.set-card > h2 { font-size: 1.02rem; font-weight: 700; color: var(--brand-ink); margin: 0 0 1.1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line-2); }
.set-card > h2:first-child { margin-top: 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: 0; }
[data-theme="dark"] .set-card { background: #14241d; }
