/* ============================================================ Thème */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --surface-hover: #f2f4f9;
  --border: #e2e5ee;
  --text: #1a1e29;
  --muted: #697186;
  --accent: #4a63f5;
  --accent-hover: #3a52e0;
  --accent-soft: #e7ebff;
  --accent-text: #ffffff;
  --danger: #dc3c45;
  --danger-soft: #fdecec;
  --success: #1f9d63;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 48px rgba(16, 24, 40, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --k-folder: #f0a020;
  --k-video: #e5484d;
  --k-image: #12a594;
  --k-audio: #8e4ec6;
  --k-pdf: #d6409f;
  --k-archive: #a18072;
  --k-doc: #3e63dd;
  --k-file: #8b93a7;
  --thumb-bg: #eef0f6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1e222b;
    --surface-hover: #1c2029;
    --border: #2a2f3a;
    --text: #e7e9ef;
    --muted: #8f97aa;
    --accent: #7b8cff;
    --accent-hover: #93a1ff;
    --accent-soft: #232a4d;
    --accent-text: #0e1015;
    --danger: #ff6b70;
    --danger-soft: #3a1d20;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --thumb-bg: #1e222b;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1015;
  --surface: #161920;
  --surface-2: #1e222b;
  --surface-hover: #1c2029;
  --border: #2a2f3a;
  --text: #e7e9ef;
  --muted: #8f97aa;
  --accent: #7b8cff;
  --accent-hover: #93a1ff;
  --accent-soft: #232a4d;
  --accent-text: #0e1015;
  --danger: #ff6b70;
  --danger-soft: #3a1d20;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --thumb-bg: #1e222b;
  color-scheme: dark;
}

/* ============================================================ Base */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; }
p { margin: 0; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 16px; }
.spacer { flex: 1; }
.form-error { color: var(--danger); min-height: 1.2em; font-size: 13px; }
.danger-text { color: var(--danger) !important; }

.ic { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ic svg { width: 100%; height: 100%; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.logo {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff;
}
.logo .ic { width: 20px; height: 20px; }

/* ============================================================ Contrôles */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 550; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.block { width: 100%; }
.btn .ic { width: 17px; height: 17px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn.small .ic { width: 15px; height: 15px; }

.input, .select {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { width: auto; padding-right: 8px; cursor: pointer; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================ Connexion */

.login {
  min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px;
  padding: 32px 28px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow);
}
.brand-lg { font-size: 22px; margin-bottom: 4px; }
.login-card .btn { height: 42px; margin-top: 4px; }

/* ============================================================ Mise en page */

.app { display: grid; grid-template-columns: 252px 1fr; height: 100vh; height: 100dvh; }

.sidebar {
  display: flex; flex-direction: column; gap: 18px; padding: 18px 14px;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto;
}
.sidebar .brand { padding: 2px 6px; }
.new-btn { height: 46px; justify-content: flex-start; padding: 0 18px; border-radius: 14px; box-shadow: var(--shadow-sm); font-size: 15px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.nav-item .ic { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active .ic { color: var(--accent); }
body:not(.is-admin) .admin-only { display: none; }

.storage { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.storage-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.bar { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s; }
.bar.warn .fill { background: var(--danger); }

.sidebar-backdrop { display: none; }

.main { overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.menu-btn { display: none; }
.search {
  flex: 1; max-width: 640px; display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 16px; border-radius: 99px; background: var(--surface-2);
  color: var(--muted); border: 1px solid transparent; transition: border-color .15s, background .15s;
}
.search:focus-within { background: var(--surface); border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6); color: #fff; font-weight: 700;
}
.avatar.static { cursor: default; }

.view { padding: 4px 24px 120px; }
.toolbar { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.title { font-size: 22px; font-weight: 650; }

.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 18px; min-width: 0; }
.crumb {
  border: 0; background: transparent; padding: 4px 10px; border-radius: 9px;
  color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb.drop-hover { background: var(--accent-soft); color: var(--accent); }
.sep { width: 16px; height: 16px; color: var(--muted); }

.selection-bar {
  position: sticky; top: 68px; z-index: 15;
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin-bottom: 12px;
  background: var(--accent-soft); color: var(--accent); border-radius: 12px; font-weight: 600;
}
.selection-bar .icon-btn { color: var(--accent); }
.selection-bar .btn { height: 34px; padding: 0 12px; color: var(--accent); }

/* ============================================================ Fichiers */

.files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }

.item {
  position: relative; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; user-select: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.item:hover { box-shadow: var(--shadow); border-color: transparent; }
.item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.item.drop-hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: scale(1.02); }
.item.dragging { opacity: .45; }

.thumb {
  position: relative; display: grid; place-items: center; overflow: hidden;
  aspect-ratio: 16 / 10; margin: 6px 6px 0; border-radius: 10px; background: var(--thumb-bg);
}
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kind-ic { width: 44px; height: 44px; }
.kind-ic svg { stroke-width: 1.6; }
.thumb.has-media .kind-ic { visibility: hidden; }
.play-badge {
  position: absolute; z-index: 1; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(4px); transition: transform .15s;
}
.play-badge .ic { width: 18px; height: 18px; margin-left: 2px; }
.item:hover .play-badge { transform: scale(1.1); }
.thumb:not(.has-media) .play-badge { display: none; }

.k-folder .kind-ic, .k-folder .row-ic, .k-folder-ic { color: var(--k-folder); }
.k-video .kind-ic, .k-video .row-ic { color: var(--k-video); }
.k-image .kind-ic, .k-image .row-ic { color: var(--k-image); }
.k-audio .kind-ic, .k-audio .row-ic { color: var(--k-audio); }
.k-pdf .kind-ic, .k-pdf .row-ic { color: var(--k-pdf); }
.k-archive .kind-ic, .k-archive .row-ic { color: var(--k-archive); }
.k-doc .kind-ic, .k-text .kind-ic, .k-doc .row-ic, .k-text .row-ic { color: var(--k-doc); }
.k-file .kind-ic, .k-file .row-ic { color: var(--k-file); }
.k-folder .thumb { background: color-mix(in srgb, var(--k-folder) 12%, var(--thumb-bg)); }

.info { padding: 10px 40px 12px 12px; min-width: 0; }
.name { display: flex; align-items: center; gap: 6px; font-weight: 550; min-width: 0; }
.name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-ic { width: 14px; height: 14px; color: var(--accent); }
.sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-date, .col-size { display: none; color: var(--muted); font-size: 13px; }

.item .more { position: absolute; right: 6px; bottom: 10px; width: 32px; height: 32px; }

.check {
  position: absolute; z-index: 2; top: 12px; left: 12px; display: grid; place-items: center;
  width: 24px; height: 24px; padding: 0; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, .25); color: transparent;
  opacity: 0; transition: opacity .15s, background .15s;
}
.check .ic { width: 14px; height: 14px; }
.check .ic svg { stroke-width: 3; }
.item:hover .check, .selecting .check { opacity: 1; }
.item.selected .check { opacity: 1; background: var(--accent); border-color: var(--accent); color: #fff; }

/* Vue liste */
.files.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.files.list .item, .list-head {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 140px 100px 40px; align-items: center; gap: 12px;
  padding: 6px 12px;
}
.list-head { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.files.list .item { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); }
.files.list .item:last-child { border-bottom: 0; }
.files.list .item:hover { box-shadow: none; background: var(--surface-hover); }
.files.list .item.selected { box-shadow: none; background: var(--accent-soft); }
.files.list .thumb { width: 44px; height: 44px; margin: 0; aspect-ratio: auto; border-radius: 8px; }
.files.list .kind-ic { width: 22px; height: 22px; }
.files.list .play-badge { width: 22px; height: 22px; }
.files.list .play-badge .ic { width: 10px; height: 10px; }
.files.list .info { padding: 0; }
.files.list .sub { display: none; }
.files.list .col-date, .files.list .col-size, .list-head .col-date, .list-head .col-size { display: block; }
.files.list .more { position: static; }
.files.list .check { top: 50%; left: 24px; transform: translateY(-50%); width: 22px; height: 22px; }

.empty { text-align: center; padding: 64px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty > div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty strong { font-size: 16px; }
.empty .btn { margin-top: 12px; }
.empty-ic { width: 56px; height: 56px; color: var(--accent); padding: 14px; border-radius: 50%; background: var(--accent-soft); margin-bottom: 4px; }

/* ============================================================ Lignes (partages, utilisateurs) */

.rows { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.row-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); flex: none; }
.row-main { flex: 1; min-width: 0; }
.row-main .name { gap: 8px; }
.row-actions { display: flex; gap: 2px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-text); }
.badge.soft { background: var(--surface-2); color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin-bottom: 12px; }
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-row .input { flex: 1; min-width: 160px; }

/* ============================================================ Menu contextuel */

.ctx-menu {
  position: fixed; z-index: 60; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: pop .12s ease-out;
}
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px;
  border: 0; border-radius: 8px; background: transparent; text-align: left;
}
.menu-item .ic { color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-header { padding: 8px 12px 10px; font-weight: 600; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ctx-menu .sep { height: 1px; margin: 6px 4px; background: var(--border); }

@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ============================================================ Fenêtres */

.modal {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 12, 18, .5); backdrop-filter: blur(2px);
}
.dialog {
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto;
  padding: 22px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .15s ease-out;
}
.dialog h2 { font-size: 18px; margin-bottom: 14px; word-break: break-word; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-body .btn.ghost { align-self: flex-start; padding: 0 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .btn { flex: none; }

.picker-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 14px; }
.picker-list { display: flex; flex-direction: column; height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.picker-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; text-align: left;
}
.picker-item span:not(.ic) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item:hover { background: var(--surface-2); }

/* ============================================================ Visionneuse */

.viewer { position: fixed; inset: 0; z-index: 70; background: #07080b; color: #fff; display: flex; flex-direction: column; }
.viewer-head {
  display: flex; align-items: center; gap: 4px; padding: 10px 14px;
  background: linear-gradient(rgba(0, 0, 0, .6), transparent);
}
.viewer-head .icon-btn { color: #d5d8e0; }
.viewer-head .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.viewer-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 6px; }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 16px 16px; }
.viewer-stage video, .viewer-stage img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #000; }
.viewer-stage video { width: 100%; height: 100%; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center;
  width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff;
}
.viewer-nav:hover { background: rgba(255, 255, 255, .2); }
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }
.viewer-nav .ic { width: 24px; height: 24px; }
.audio-box, .unsupported {
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; max-width: 480px;
  padding: 32px; border-radius: 20px; background: rgba(255, 255, 255, .06);
}
.audio-box audio { width: min(420px, 80vw); }
.audio-ic { width: 64px; height: 64px; color: #9aa6ff; }
.audio-name { font-weight: 600; word-break: break-word; }
.unsupported p { color: #b6bccb; }

/* ============================================================ Envois */

.drop-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 18%, transparent); border: 3px dashed var(--accent);
}
.drop-box {
  display: flex; align-items: center; gap: 12px; padding: 18px 26px; border-radius: 16px;
  background: var(--accent); color: var(--accent-text); font-size: 17px; font-weight: 600; box-shadow: var(--shadow-lg);
}
.drop-box .ic { width: 24px; height: 24px; }

.uploads {
  position: fixed; z-index: 50; right: 20px; bottom: 20px; width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.uploads-head { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 16px; font-weight: 600; }
.uploads-head span:first-child { flex: 1; }
.uploads.collapsed #uploadsToggle .ic { transform: rotate(180deg); }
.uploads.collapsed .uploads-list { display: none; }
.uploads-total { height: 3px; background: var(--surface-2); }
.uploads-total .fill { height: 100%; background: var(--accent); transition: width .3s; }
.uploads:not(.running) .uploads-total .fill { background: var(--success); }
.uploads-list { max-height: 300px; overflow-y: auto; padding: 4px 0; }
.up-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 16px; }
.up-ic { color: var(--muted); }
.up-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.up-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-bar { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.up-bar .fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-status { font-size: 12px; color: var(--muted); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.up-row.done .up-bar .fill { background: var(--success); }
.up-row.done .icon-btn { color: var(--success); opacity: 1; }
.up-row.error .up-status { color: var(--danger); }
.up-row.error .up-bar .fill { background: var(--danger); }
.up-row.cancelled { opacity: .55; }

/* ============================================================ Notifications */

.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: min(520px, calc(100vw - 32px));
  border-radius: 12px; background: #1f2330; color: #fff; box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease-out; transition: opacity .3s, transform .3s;
}
.toast .ic { color: #6ee7a8; }
.toast.error .ic { color: #ff8a8f; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================ Page de partage public */

.share-page { min-height: 100%; display: flex; justify-content: center; padding: 24px 16px; }
.share-wrap { width: 100%; max-width: 960px; display: flex; flex-direction: column; gap: 20px; }
.share-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.share-media { background: #000; display: grid; place-items: center; }
.share-media video, .share-media img { display: block; width: 100%; max-height: 72vh; object-fit: contain; }
.share-media audio { width: 100%; margin: 24px; }
.share-info { display: flex; align-items: center; gap: 16px; padding: 18px 20px; flex-wrap: wrap; }
.share-info .row-ic { width: 48px; height: 48px; }
.share-info h1 { font-size: 18px; word-break: break-word; }
.share-info .btn { margin-left: auto; }
.share-msg { padding: 48px 24px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }

/* ============================================================ Mobile */

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: 272px;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar-open .sidebar { transform: none; }
  .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .4); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .search { height: 40px; padding: 0 12px; }
  .view { padding: 0 16px 120px; }
  .breadcrumb { font-size: 16px; }
  .crumb { max-width: 160px; padding: 4px 6px; }
  .files.grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .files.list .item, .list-head { grid-template-columns: 40px minmax(0, 1fr) 36px; }
  .files.list .thumb { width: 40px; height: 40px; }
  .files.list .col-date, .files.list .col-size, .list-head .col-date, .list-head .col-size { display: none; }
  .files.list .sub { display: block; }
  .files.list .check { left: 22px; }
  .check { opacity: 1; background: rgba(0, 0, 0, .18); width: 22px; height: 22px; top: 10px; left: 10px; }
  .selection-bar { top: 60px; }
  .selection-bar .lbl { display: none; }
  .uploads { right: 16px; bottom: 16px; }
  .viewer-nav { width: 40px; height: 40px; }
  .viewer-nav.prev { left: 8px; }
  .viewer-nav.next { right: 8px; }
  .viewer-stage { padding: 0 0 8px; }
}

@media (hover: none) {
  .check { opacity: 1; }
}
