/* 28JoursBox — interface web (téléphone d'abord, PC ensuite). Aucune dépendance. */

:root {
  --bg: #f6f6f9;
  --surface: #ffffff;
  --surface-2: #f0f0f5;
  --surface-3: #e6e6ee;
  --border: #e2e2ea;
  --text: #17171f;
  --text-2: #5d5d6e;
  --text-3: #8b8b9b;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #ebeafd;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --shadow-1: 0 1px 2px rgb(20 20 40 / 0.06), 0 1px 3px rgb(20 20 40 / 0.08);
  --shadow-2: 0 8px 30px rgb(20 20 40 / 0.16);
  --radius: 14px;
  --radius-s: 10px;
  --tap: 48px;
  --header-h: 56px;
  --nav-h: 60px;
  --player-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f15;
    --surface: #18181f;
    --surface-2: #202029;
    --surface-3: #2a2a35;
    --border: #2c2c38;
    --text: #ececf3;
    --text-2: #a7a7b8;
    --text-3: #777789;
    --accent: #8b85ff;
    --accent-2: #a879ff;
    --accent-soft: #26244a;
    --accent-text: #0f0f15;
    --danger: #f87171;
    --danger-soft: #3a1c1f;
    --warn: #fbbf24;
    --warn-soft: #3a2e14;
    --ok: #4ade80;
    --ok-soft: #15301f;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 10px 40px rgb(0 0 0 / 0.55);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
img, svg, video, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.noscript { padding: 24px; text-align: center; }

svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.s { width: 18px; height: 18px; }
svg.i.l { width: 28px; height: 28px; }

/* ---------- Démarrage ---------- */
.boot-splash { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text-2); font-weight: 600; }
.boot-splash img { border-radius: 18px; box-shadow: var(--shadow-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.94); opacity: 0.8; } }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
  transition: background 0.15s, transform 0.05s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn.danger.filled { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 999px; border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn.active { color: var(--accent); }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--text-3); font-size: 13px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface); font-size: 16px; /* 16px : évite le zoom auto d'iOS */
}
.input:focus, .field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-s); padding: 10px 12px; margin: 0 0 14px; font-size: 14px; }
.form-error:empty { display: none; }

/* ---------- Écrans d'authentification ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b));
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow-2); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand img { width: 48px; height: 48px; border-radius: 12px; }
.auth-brand h1 { margin: 0; font-size: 22px; }
.auth-brand p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.auth-card h2 { font-size: 18px; margin: 0 0 6px; }
.auth-card .lead { margin: 0 0 18px; color: var(--text-2); font-size: 14px; }
.auth-card .btn.primary { width: 100%; margin-top: 6px; min-height: 50px; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 13px; color: var(--text-3); }

/* ---------- Coque de l'application ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  min-height: calc(var(--header-h) + var(--safe-t)); padding: var(--safe-t) 6px 0 12px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; font-weight: 700; font-size: 18px; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.topbar .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .actions { display: flex; align-items: center; }

.sidenav { display: none; }
.main { padding: 0 0 calc(var(--nav-h) + var(--player-h) + var(--safe-b) + 96px); min-width: 0; }
.view { max-width: 1100px; margin: 0 auto; }
.view-head { padding: 14px 16px 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.view-head h1 { font-size: 22px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-head .sub { width: 100%; margin: 0; color: var(--text-2); font-size: 14px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--border);
}
.bottomnav a, .sidenav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); text-decoration: none; font-size: 11px; font-weight: 600;
}
.bottomnav a[aria-current="page"], .sidenav a[aria-current="page"] { color: var(--accent); }

/* ---------- Bandeau réseau ---------- */
.netbanner {
  position: sticky; top: calc(var(--header-h) + var(--safe-t)); z-index: 19;
  background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 600;
  padding: 8px 16px; display: flex; align-items: center; gap: 8px;
}

/* ---------- Fil d'Ariane ---------- */
.crumbs { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 10px 12px 0; white-space: nowrap; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs a, .crumbs span { padding: 6px 8px; border-radius: 8px; font-size: 14px; color: var(--text-2); text-decoration: none; }
.crumbs a:hover { background: var(--surface-2); }
.crumbs .sep { padding: 0; color: var(--text-3); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }

/* ---------- Liste de fichiers ---------- */
.list { list-style: none; margin: 0; padding: 4px 8px; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 8px 4px 8px 10px; border-radius: var(--radius);
  cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.row:hover { background: var(--surface-2); }
.row.pressed { background: var(--surface-3); }
.row.playing .name { color: var(--accent); }
.row .main-hit { position: absolute; inset: 0; border-radius: inherit; background: none; border: 0; cursor: pointer; }
.thumb {
  width: 44px; height: 44px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); overflow: hidden; position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.k-folder { background: var(--accent-soft); color: var(--accent); }
.thumb.k-audio { background: #fde8f1; color: #db2777; }
.thumb.k-image { background: #e5f6ee; color: #059669; }
.thumb.k-video { background: #fdeee4; color: #ea580c; }
.thumb.k-pdf { background: #fde9e9; color: #dc2626; }
.thumb.k-text { background: #e8f1fd; color: #2563eb; }
.thumb.k-project { background: #f1eafe; color: #7c3aed; }
.thumb.k-archive { background: #f4f0e6; color: #a16207; }
@media (prefers-color-scheme: dark) {
  .thumb.k-audio { background: #3b1c2c; color: #f472b6; }
  .thumb.k-image { background: #13302a; color: #34d399; }
  .thumb.k-video { background: #3a2417; color: #fb923c; }
  .thumb.k-pdf { background: #3a1b1b; color: #f87171; }
  .thumb.k-text { background: #172a44; color: #60a5fa; }
  .thumb.k-project { background: #2c1f4a; color: #a78bfa; }
  .thumb.k-archive { background: #352d18; color: #facc15; }
}
.row .meta { flex: 1; min-width: 0; pointer-events: none; }
.row .name { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .info { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.row .info .path { color: var(--text-3); }
.row .more { position: relative; z-index: 1; }
.row .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.row .row-actions { position: relative; z-index: 1; display: flex; gap: 4px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.lock { background: var(--warn-soft); color: var(--warn); }
.badge.mine { background: var(--ok-soft); color: var(--ok); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.empty { text-align: center; color: var(--text-2); padding: 56px 24px; }
.empty > svg.i { width: 56px; height: 56px; margin: 0 auto 12px; color: var(--text-3); stroke-width: 1.4; }
.empty h2 { font-size: 18px; color: var(--text); margin: 0 0 6px; }
.empty p { margin: 0 0 16px; }
.loading { display: grid; place-items: center; padding: 48px; color: var(--text-3); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 64px; margin: 4px 8px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Recherche ---------- */
.searchbar { position: relative; padding: 12px 16px 4px; }
.searchbar svg.i { position: absolute; left: 30px; top: 50%; margin-top: 4px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.searchbar input { width: 100%; min-height: 48px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); padding: 0 16px 0 46px; font-size: 16px; }
.searchbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- Bouton flottant ---------- */
.fab {
  position: fixed; right: 18px; z-index: 25;
  bottom: calc(var(--nav-h) + var(--player-h) + var(--safe-b) + 18px);
  width: 60px; height: 60px; border-radius: 20px; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform 0.15s, bottom 0.2s;
}
.fab:active { transform: scale(0.94); }
.fab svg.i { width: 28px; height: 28px; stroke-width: 2.4; }

/* ---------- Lecteur audio ---------- */
.player {
  position: fixed; left: 8px; right: 8px; z-index: 28;
  bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-2);
  padding: 8px 10px 6px; display: grid; gap: 2px;
}
.player .p-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.player .p-art { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; flex: none; }
.player .p-title { flex: 1; min-width: 0; }
.player .p-title strong { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .p-title span { display: block; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .p-play { width: 48px; height: 48px; background: var(--accent); color: var(--accent-text); }
.player .p-play:hover { background: var(--accent); color: var(--accent-text); filter: brightness(1.08); }
.player .p-seek { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.player .p-seek input { flex: 1; min-width: 0; }
.player .p-src { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer; min-height: 28px; }
.player .p-src[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.player .p-src:disabled { opacity: 0.5; cursor: default; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 28px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--surface-3) var(--pct, 0%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: var(--shadow-1); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; z-index: 10000; bottom: calc(var(--nav-h) + var(--player-h) + var(--safe-b) + 90px); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: max-content;
  background: #22222c; color: #f4f4f8; padding: 10px 10px 10px 16px; border-radius: 14px; box-shadow: var(--shadow-2);
  font-size: 14.5px; animation: toast-in 0.2s ease-out;
}
.toast.error { background: #7f1d1d; }
.toast .t-msg { flex: 1; min-width: 0; padding: 4px 0; }
.toast button { background: transparent; border: 0; color: #a5b4fc; font-weight: 700; padding: 8px 10px; min-height: 36px; border-radius: 8px; cursor: pointer; }
.toast button:hover { background: rgb(255 255 255 / 0.08); }
@media (prefers-color-scheme: dark) { .toast { background: #2e2e3a; } }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Feuilles et dialogues ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgb(10 10 20 / 0.45); }
dialog.sheet, dialog.dlg {
  border: 0; padding: 0; background: var(--surface); box-shadow: var(--shadow-2);
  max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain;
}
dialog.sheet {
  width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0;
  padding: 8px 8px calc(12px + var(--safe-b)); animation: sheet-in 0.22s cubic-bezier(.2,.8,.2,1);
}
dialog.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 2px auto 8px; }
@keyframes sheet-in { from { transform: translateY(100%); } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.sheet-head .thumb { width: 40px; height: 40px; }
.sheet-head .t { min-width: 0; flex: 1; }
.sheet-head strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head span { display: block; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { list-style: none; margin: 0; padding: 0; }
.menu button {
  width: 100%; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 14px;
  border: 0; background: transparent; border-radius: 12px; font-size: 16px; text-align: left; cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu button svg.i { color: var(--text-2); }
.menu button.danger, .menu button.danger svg.i { color: var(--danger); }
.menu button:disabled { opacity: 0.45; cursor: default; }
.menu button .hint { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 8px; }

dialog.dlg { width: calc(100% - 24px); max-width: 480px; border-radius: 20px; animation: dlg-in 0.18s ease-out; }
@keyframes dlg-in { from { transform: scale(0.96); opacity: 0; } }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 14px 8px 4px 20px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlg-head h2 { flex: 1; margin: 0; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body { padding: 8px 20px 4px; }
.dlg-body p { margin: 0 0 12px; color: var(--text-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); }
.dlg.wide { max-width: 640px; }

/* Sélecteur de dossier */
.picker-crumbs { padding: 0 0 6px; }
.picker-list { list-style: none; margin: 0 -8px; padding: 0; max-height: 46vh; overflow: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.picker-list button { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 10px; }
.picker-list button:hover { background: var(--surface-2); }
.picker-list button:disabled { opacity: 0.4; cursor: default; }
.picker-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lien copiable */
.copyline { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.copyline input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface-2); font-size: 14px; font-family: var(--mono); }

/* Listes dans les dialogues et réglages */
.items { list-style: none; margin: 0; padding: 0; }
.items > li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.items > li:last-child { border-bottom: 0; }
.items .grow { flex: 1; min-width: 150px; }
.items .grow strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items .grow > span { display: block; font-size: 13px; color: var(--text-2); }
.items .acts { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- Réglages ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; margin: 12px 16px; padding: 16px; }
.card h2 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.card > p.desc { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 13px; color: var(--text-2); }
.meter { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.meter > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- Visionneuse plein écran ---------- */
.viewer { position: fixed; inset: 0; z-index: 900; background: #0b0b10; color: #f3f3f7; display: flex; flex-direction: column; animation: fade-in 0.15s; }
@keyframes fade-in { from { opacity: 0; } }
.viewer .v-bar { display: flex; align-items: center; gap: 4px; padding: calc(6px + var(--safe-t)) 6px 6px 8px; background: rgb(0 0 0 / 0.55); z-index: 2; }
.viewer .v-bar .icon-btn { color: #e7e7ee; }
.viewer .v-bar .icon-btn:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
.viewer .v-title { flex: 1; min-width: 0; padding: 0 6px; }
.viewer .v-title strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .v-title span { display: block; font-size: 12px; color: #a9a9b8; }
.viewer .v-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; }
.viewer .v-stage > img, .viewer .v-stage > video { max-width: 100%; max-height: 100%; object-fit: contain; touch-action: pinch-zoom; }
.viewer .v-stage > video { width: 100%; height: 100%; background: #000; }
.viewer .v-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; background: rgb(0 0 0 / 0.45); color: #fff; width: 44px; height: 44px; }
.viewer .v-nav:hover { background: rgb(0 0 0 / 0.7); color: #fff; }
.viewer .v-nav.prev { left: 8px; }
.viewer .v-nav.next { right: 8px; }
.viewer .v-text { width: 100%; height: 100%; overflow: auto; margin: 0; padding: 16px 16px calc(16px + var(--safe-b)); background: #111118; color: #e8e8ef; font: 13.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; tab-size: 4; }
.viewer .v-info { text-align: center; padding: 24px; display: grid; justify-items: center; gap: 10px; max-width: 420px; }
.viewer .v-info .thumb { width: 88px; height: 88px; border-radius: 22px; display: grid; place-items: center; }
.viewer .v-info .thumb svg.i { width: 44px; height: 44px; }
.viewer .v-info h2 { margin: 0; font-size: 18px; word-break: break-word; }
.viewer .v-info p { margin: 0; color: #a9a9b8; }
.viewer .v-audio { width: min(520px, 92%); display: grid; gap: 16px; justify-items: center; }
.viewer .v-audio audio { width: 100%; }
.viewer .v-audio .p-art { width: 160px; height: 160px; border-radius: 28px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.viewer .v-audio .p-art svg.i { width: 72px; height: 72px; }
.viewer .v-msg { color: #c9c9d6; padding: 24px; text-align: center; }
.viewer .spinner { border-color: #33333f; border-top-color: #a5b4fc; }

/* PDF */
.pdf { position: absolute; inset: 0; overflow: auto; background: #2a2a33; -webkit-overflow-scrolling: touch; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; width: max-content; min-width: 100%; gap: 12px; padding: 12px 8px calc(72px + var(--safe-b)); }
.pdf-page { flex: none; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / 0.4); position: relative; }
.pdf-page canvas { width: 100%; height: 100%; }
.pdf-tools {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); z-index: 3;
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: rgb(20 20 28 / 0.85); color: #fff;
  font-size: 14px; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-2);
}
.pdf-tools .icon-btn { color: #fff; }
.pdf-tools .icon-btn:hover { background: rgb(255 255 255 / 0.12); color: #fff; }
.pdf-tools span { padding: 0 8px; min-width: 64px; text-align: center; }

/* ---------- Page publique de partage ---------- */
.share-body { background: var(--bg); }
.share-page { max-width: 900px; margin: 0 auto; padding: 0 0 calc(40px + var(--safe-b)); }
.share-top { display: flex; align-items: center; gap: 10px; padding: calc(14px + var(--safe-t)) 16px 14px; border-bottom: 1px solid var(--border); }
.share-top img { width: 32px; height: 32px; border-radius: 8px; }
.share-top b { font-size: 17px; }
.share-top span { color: var(--text-3); font-size: 13px; margin-left: auto; }
.share-hero { margin: 16px; padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); display: grid; gap: 14px; justify-items: center; text-align: center; }
.share-hero .thumb { width: 72px; height: 72px; border-radius: 18px; display: grid; place-items: center; }
.share-hero .thumb svg.i { width: 36px; height: 36px; }
.share-hero h1 { margin: 0; font-size: 20px; word-break: break-word; }
.share-hero p { margin: 0; color: var(--text-2); font-size: 14px; }
.share-hero .preview-img { max-height: 60vh; border-radius: 12px; cursor: zoom-in; }
.share-hero audio { width: 100%; max-width: 520px; }
.share-hero .btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }


/* ---------- Recherche du haut + suggestions ---------- */
.topsearch { display: none; position: relative; align-items: center; gap: 4px; min-width: 0; }
.topsearch input {
  width: 100%; min-height: 42px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  padding: 0 14px 0 38px; font-size: 16px;
}
.topsearch input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.topsearch input::-webkit-search-cancel-button { cursor: pointer; }
.topsearch-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; display: flex; }
.topsearch .search-back { display: none; }
.topbar.searching .topsearch {
  display: flex; position: absolute; left: 0; right: 0; bottom: 0; height: var(--header-h);
  padding: 0 10px 0 4px; background: var(--bg); z-index: 2;
}
.topbar.searching .topsearch .search-back { display: inline-grid; }
.topbar.searching .topsearch-ico { left: 62px; }
.suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-2);
  max-height: min(70vh, 520px); overflow: auto; overscroll-behavior: contain;
}
.topbar.searching .suggest { left: 8px; right: 8px; top: calc(100% + 2px); }
.suggest-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: 12px; cursor: pointer; }
.suggest-item:hover, .suggest-item[aria-selected="true"] { background: var(--surface-2); }
.thumb.sm { width: 36px; height: 36px; border-radius: 9px; }
.thumb.sm svg.i { width: 18px; height: 18px; }
.sg-text { min-width: 0; flex: 1; display: grid; }
.sg-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-path { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-all { display: flex; align-items: center; gap: 10px; color: var(--accent); font-weight: 600; font-size: 14.5px; }
.suggest-empty { padding: 12px 10px; color: var(--text-2); font-size: 14px; }
mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Tri, invitation ---------- */
.sub-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sort-btn { min-height: 36px; padding: 0 10px; color: var(--text-2); font-weight: 600; }
.side-invite {
  display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 0 14px; margin-top: 8px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text-2); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left;
}
.side-invite:hover { background: var(--surface-2); }
.group-hint { font-weight: 600; color: var(--text) !important; background: var(--accent-soft); padding: 10px 12px; border-radius: 12px; }
.group-pw { font-size: 15px !important; font-weight: 700; color: var(--text); }

/* ---------- Grand écran : barre latérale ---------- */
@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  .bottomnav { display: none; }
  .shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; padding-left: 20px; }
  .sidenav {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 10px;
    position: sticky; top: calc(var(--header-h) + var(--safe-t)); align-self: start;
    height: calc(100vh - var(--header-h)); border-right: 1px solid var(--border);
  }
  .sidenav a { flex-direction: row; justify-content: flex-start; gap: 14px; font-size: 15px; padding: 0 14px; min-height: 46px; border-radius: 12px; color: var(--text-2); }
  .sidenav a:hover { background: var(--surface-2); }
  .sidenav a[aria-current="page"] { background: var(--accent-soft); }
  .sidenav .upload-side { margin: 0 0 12px; }
  .main { padding-bottom: calc(var(--player-h) + 40px); }
  .view-head { padding: 22px 24px 8px; }
  .crumbs { padding: 14px 18px 0; }
  .list { padding: 4px 16px; }
  .row { min-height: 60px; }
  .row .info { font-size: 13.5px; }
  .fab { display: none; }
  .topsearch { display: flex; flex: 0 1 460px; margin: 0 12px; }
  .search-toggle { display: none; }
  .player { left: 260px; right: 20px; bottom: 16px; max-width: 900px; margin: 0 auto; grid-template-columns: minmax(330px, 1fr) minmax(240px, 1.2fr); align-items: center; column-gap: 16px; }
  .player .p-seek { order: 0; }
  .toasts { bottom: calc(var(--player-h) + 30px); }
  dialog.sheet { width: 380px; max-width: calc(100% - 24px); margin: auto; border-radius: 20px; padding: 8px; animation: dlg-in 0.18s ease-out; }
  dialog.sheet::before { display: none; }
  .searchbar { padding: 16px 24px 4px; }
  .searchbar svg.i { left: 38px; }
  .card { margin: 14px 24px; }
}
@media (max-width: 899px) {
  .desktop-only { display: none !important; }
}
@media (max-width: 380px) {
  .bottomnav a { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .spinner, .skeleton { animation-duration: 1.5s !important; animation-iteration-count: infinite !important; }
}

/* ---------- Uppy : intégration ---------- */
.uppy-Dashboard--modal .uppy-Dashboard-inner { border-radius: 20px; }
.uppy-Root { font-family: var(--font); }
@media (max-width: 899px) {
  .uppy-Dashboard--modal .uppy-Dashboard-inner { border-radius: 20px 20px 0 0; }
}
