/* Tournages — interface sobre inspirée des apps Apple :
   police système, surfaces translucides, coins arrondis, mode sombre automatique. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Inter, Segoe UI, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --bg-sunken: #ececf0;
  --glass: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.16);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, 0.12);
  --success: #34c759;
  --warning: #ff9f0a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.08), 0 24px 64px rgba(0, 0, 0, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --sidebar-w: 260px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elev: #1c1c1e;
    --bg-sunken: #0d0d0f;
    --glass: rgba(28, 28, 30, 0.72);
    --text: #f5f5f7;
    --text-2: #98989d;
    --text-3: #5e5e63;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.2);
    --accent: #0a84ff;
    --accent-hover: #2b95ff;
    --accent-soft: rgba(10, 132, 255, 0.2);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, 0.18);
    --success: #30d158;
    --warning: #ffd60a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.5), 0 24px 64px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
.vbtns .tc { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; letter-spacing: -0.02em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 14px; height: 14px; }
.ico.lg { width: 28px; height: 28px; }
.ico.xl { width: 44px; height: 44px; stroke-width: 1.2; }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.wrap { flex-wrap: wrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; min-height: 32px;
  border-radius: 980px; border: 1px solid var(--line-strong);
  background: var(--bg-elev); color: var(--text);
  font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, transform 0.15s var(--ease), opacity 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--bg-sunken); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn-sm { padding: 4px 10px; min-height: 26px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; min-height: 44px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-2); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- Formulaires ---------- */
.input, .select, .textarea {
  width: 100%; padding: 8px 12px; min-height: 36px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-elev); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }
.textarea { resize: vertical; min-height: 72px; line-height: 1.4; }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.error-text { color: var(--danger); font-size: 13px; margin: 6px 0; }

/* Interrupteur style iOS */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 42px; height: 26px; border-radius: 13px; background: var(--line-strong); transition: background 0.2s; position: relative; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.25); transition: transform 0.2s var(--ease); }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Sélecteur segmenté */
.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--bg-sunken); }
.segmented button { padding: 4px 12px; border: none; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.active { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* ---------- Mise en page ---------- */
#app { height: 100%; display: flex; flex-direction: column; }
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column;
  background: var(--glass); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border-right: 1px solid var(--line); overflow-y: auto;
}
.sidebar-head { padding: 18px 16px 10px; display: flex; align-items: center; gap: 10px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #5e5ce6); color: #fff; }
.logo-mark .ico { width: 17px; height: 17px; }
.brand { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.side-section { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.side-nav { padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text); cursor: pointer; border: none; background: transparent; text-align: left; width: 100%; font-size: 13.5px;
  transition: background 0.12s;
}
.side-item:hover { background: rgba(127,127,127,0.12); text-decoration: none; }
.side-item.active { background: var(--accent); color: #fff; }
.side-item .ico { width: 17px; height: 17px; opacity: 0.85; }
.side-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .badge { font-size: 11px; opacity: 0.7; }
.sidebar-foot { margin-top: auto; padding: 10px 8px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.user-chip:hover { background: rgba(127,127,127,0.12); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #5e5ce6, #bf5af2); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 20px; min-height: 54px;
  background: var(--glass); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.toolbar h1 { font-size: 18px; }
.content { flex: 1; overflow: auto; padding: 20px; }
.content.narrow { max-width: 780px; width: 100%; margin: 0 auto; }
.page-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.page-title h1 { font-size: 28px; }

/* ---------- Cartes et listes ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.group { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.group-title { padding: 14px 16px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.group-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); min-height: 48px; }
.group-row:first-child, .group-title + .group-row { border-top: none; }
.group-row .label { flex: 1; min-width: 0; }
.group-row .label .sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-row.clickable { cursor: pointer; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-list { max-height: min(60vh, 520px); overflow-y: auto; }
.trash-list .group-row input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.trash-list .sub.right { text-align: right; font-size: 12px; color: var(--text-2); white-space: nowrap; flex: none; }
.trash-list .sub.right .warn { color: var(--warning); }
@media (max-width: 600px) { .trash-list .sub.right { display: none; } }
.group-row.clickable:hover { background: var(--bg-sunken); }
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty .ico { width: 44px; height: 44px; stroke-width: 1.2; color: var(--text-3); margin-bottom: 8px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--bg-sunken); color: var(--text-2); white-space: nowrap; }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-success { background: rgba(52,199,89,0.15); color: #1f9d48; }
.tag-warn { background: rgba(255,159,10,0.18); color: #b76a00; }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
@media (prefers-color-scheme: dark) { .tag-success { color: var(--success); } .tag-warn { color: var(--warning); } }

/* ---------- Projets ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.project-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.project-card h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card .meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); align-items: center; }
.project-card .date-chip { display: inline-flex; flex-direction: column; align-items: center; width: 46px; padding: 4px 0; border-radius: 9px; background: var(--bg-sunken); line-height: 1.1; }
.project-card .date-chip b { font-size: 18px; }
.project-card .date-chip span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }

/* ---------- Explorateur de fichiers ---------- */
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; font-size: 14px; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button { flex: none; border: none; background: transparent; padding: 4px 6px; border-radius: 6px; color: var(--text-2); cursor: pointer; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.crumbs .icon-btn { flex: none; }
.crumbs button:hover { background: var(--bg-sunken); color: var(--text); }
.crumbs button.current { color: var(--text); font-weight: 600; cursor: default; }
.crumbs .sep { color: var(--text-3); }
.dropzone { position: relative; min-height: 100%; border-radius: var(--radius); transition: background 0.15s; }
.dropzone.over { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.dropzone.over::after { content: "Déposer ici"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; color: var(--accent); pointer-events: none; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); transition: transform 0.15s var(--ease), box-shadow 0.15s;
  user-select: none;
}
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.tile.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile .thumb { position: relative; aspect-ratio: 16 / 9; background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; color: var(--text-3); overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .thumb .sprite { position: absolute; inset: 0; background-repeat: no-repeat; background-size: 1000% 100%; opacity: 0; transition: opacity 0.1s; }
.tile .thumb:hover .sprite.ready { opacity: 1; }
.tile .thumb .dur { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 5px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11px; font-family: var(--mono); }
.tile .thumb .status { position: absolute; left: 6px; top: 6px; }
.tile .thumb.folder { background: linear-gradient(180deg, var(--bg-sunken), var(--bg-elev)); color: var(--accent); }
.tile .thumb.folder .ico { width: 56px; height: 56px; stroke-width: 1.3; }
.tile .info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile .name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .sub { font-size: 11.5px; color: var(--text-2); display: flex; gap: 6px; }
.tile .check { position: absolute; left: 8px; top: 8px; width: 20px; height: 20px; padding: 0; z-index: 1; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.9); background: rgba(0,0,0,0.3); display: none; align-items: center; justify-content: center; color: #fff; }
.tile:hover .check, .tile.selected .check, .file-grid.selecting .tile .check { display: flex; }
.tile.selected .check { background: var(--accent); border-color: var(--accent); }
.tile .check .ico { width: 12px; height: 12px; stroke-width: 3; }

.file-list { display: flex; flex-direction: column; }
.file-list .frow {
  display: grid; grid-template-columns: 28px 44px 1fr 110px 90px 140px 32px; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.file-list .frow:hover { background: var(--bg-sunken); }
.file-list .frow.selected { background: var(--accent-soft); }
.file-list .frow .mini { width: 44px; height: 28px; border-radius: 4px; background: var(--bg-sunken); object-fit: cover; display: flex; align-items: center; justify-content: center; color: var(--text-3); overflow: hidden; }
.file-list .frow .mini img { width: 100%; height: 100%; object-fit: cover; }
.file-list .frow .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .frow .col { color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.file-list .frow .check { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1.5px solid var(--line-strong); display: flex; align-items: center; justify-content: center; color: #fff; }
.file-list .frow.selected .check { background: var(--accent); border-color: var(--accent); }
.file-list .frow .check .ico { width: 11px; height: 11px; stroke-width: 3; }
.file-list .head { display: grid; grid-template-columns: 28px 44px 1fr 110px 90px 140px 32px; gap: 10px; padding: 4px 10px 8px; font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }

.selection-bar {
  position: sticky; bottom: 12px; margin: 16px auto 0; width: max-content; max-width: 100%;
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; border-radius: 980px;
  background: var(--glass); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 4;
  animation: popin 0.2s var(--ease);
}
@keyframes popin { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Lecteur ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; color: #f5f5f7; animation: fadein 0.2s; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.viewer .vtop { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(20,20,22,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,0.08); }
.viewer .vtop .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .vtop .icon-btn { color: #d0d0d5; }
.viewer .vtop .icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.viewer .vtop .btn { background: rgba(255,255,255,0.1); border-color: transparent; color: #fff; }
.viewer .vtop .btn:hover { background: rgba(255,255,255,0.18); }
.viewer .vbody { flex: 1; display: flex; min-height: 0; }
.viewer .stage { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; background: #000; position: relative; }
.viewer .media-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; position: relative; }
.viewer video, .viewer img.full { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; outline: none; }
.viewer img.full { object-fit: contain; }
.viewer .media-msg { color: #98989d; text-align: center; padding: 40px; }
.viewer .media-msg .ico { width: 44px; height: 44px; stroke-width: 1.2; margin-bottom: 10px; }
.vctrl { padding: 8px 16px 12px; background: rgba(20,20,22,0.92); border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 6px; }
.timeline { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.timeline .track { position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.2); top: 9px; }
.timeline .buffered { position: absolute; left: 0; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.3); top: 9px; }
.timeline .played { position: absolute; left: 0; height: 4px; border-radius: 2px; background: var(--accent); top: 9px; }
.timeline .knob { position: absolute; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.5); transform: translateX(-50%); pointer-events: none; }
.timeline .mark { position: absolute; top: 1px; width: 2px; height: 20px; border-radius: 1px; background: var(--warning); transform: translateX(-50%); cursor: pointer; }
.timeline .mark.resolved { background: var(--success); }
.timeline .mark.range { height: 4px; top: 9px; opacity: 0.6; }
.vbtns { display: flex; align-items: center; gap: 6px; }
.vbtns .icon-btn { color: #e5e5ea; }
.vbtns .icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.vbtns .tc { font-family: var(--mono); font-size: 13px; color: #e5e5ea; min-width: 92px; }
.vbtns .tc.dim { color: #8e8e93; }
.vbtns .vol { width: 90px; accent-color: #fff; }
.vbtns .speed { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #e5e5ea; border-radius: 6px; padding: 2px 6px; font-size: 12px; }
.vside { width: 360px; flex: none; display: flex; flex-direction: column; background: #1c1c1e; border-left: 1px solid rgba(255,255,255,0.08); }
.vside .tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,0.08); }
.vside .tabs button { flex: 1; padding: 12px; background: transparent; border: none; color: #98989d; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; }
.vside .tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.vside .pane { flex: 1; overflow-y: auto; padding: 12px; }
.vside .compose { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 8px; }
.vside .compose .textarea, .vside .compose .input { background: #2c2c2e; border-color: rgba(255,255,255,0.12); color: #fff; }
.vside .compose .tcchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,0.08); font-family: var(--mono); font-size: 12px; cursor: pointer; color: #e5e5ea; }
.vside .compose .tcchip.on { background: var(--accent-soft); color: var(--accent); }
.vside .compose .btn-sm.btn-ghost { color: #c7c7cc; }
.vside .compose .textarea { resize: none; transition: border-radius 0.15s; }
.vside .compose.collapsed > :not(.textarea) { display: none; }
.vside .compose.collapsed .textarea { border-radius: 20px; min-height: 0; padding: 9px 14px; line-height: 20px; }
.vside .compose input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #2c2c2e inset; -webkit-text-fill-color: #fff; caret-color: #fff; }
.cmt { padding: 10px 10px 8px; border-radius: 10px; margin-bottom: 6px; background: #2c2c2e; cursor: pointer; transition: background 0.12s; }
.cmt:hover { background: #343436; }
.cmt.reply { margin-left: 22px; }
.cmt.resolved { opacity: 0.6; }
.cmt .chead { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #98989d; margin-bottom: 4px; }
.cmt .chead b { color: #f5f5f7; font-weight: 600; }
.cmt .chead .tcl { font-family: var(--mono); color: var(--warning); }
.cmt .cbody { white-space: pre-wrap; word-break: break-word; color: #e5e5ea; }
.cmt .cacts { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity 0.15s; }
.cmt:hover .cacts { opacity: 1; }
.cmt .cacts .icon-btn { width: 26px; height: 26px; color: #98989d; }
.cmt .cacts .icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.vside .meta-table { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13px; }
.vside .meta-table dt { color: #98989d; }
.vside .meta-table dd { margin: 0; color: #f5f5f7; word-break: break-all; }
.cmt-count { display: inline-flex; align-items: center; gap: 3px; color: var(--text-2); font-size: 11.5px; }
.cmt-count .ico { width: 12px; height: 12px; }

/* ---------- Panneau d'envoi ---------- */
.upload-panel {
  position: fixed; right: 20px; bottom: 20px; width: 380px; max-height: 60vh; z-index: 40;
  display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--glass); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: popin 0.25s var(--ease);
}
.upload-panel .uhead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.upload-panel .uhead .title { font-weight: 600; flex: 1; }
.upload-panel .uhead .pct { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.upload-panel .ulist { overflow-y: auto; padding: 6px 0; }
.upload-panel .ulist.collapsed { display: none; }
.uitem { padding: 6px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; font-size: 12.5px; }
.uitem .uname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uitem .ustat { color: var(--text-2); font-size: 11.5px; white-space: nowrap; }
.uitem .bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.uitem .bar i { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.uitem.done .bar i { background: var(--success); }
.uitem.error .bar i { background: var(--danger); }
.uitem.error .ustat { color: var(--danger); }
.upload-panel .ufoot { padding: 8px 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }

/* ---------- Modales ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadein 0.15s; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--bg-elev); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: modalin 0.22s var(--ease); }
.modal-wide { max-width: 720px; }
@keyframes modalin { from { transform: scale(0.96) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-body { padding: 8px 18px 16px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }

/* ---------- Notifications ---------- */
/* Toute la largeur, toasts centrés : avec left: 50%, la pile ne pouvait occuper que la moitié
   de l'écran et les messages passaient sur deux lignes (surtout sur mobile). */
#toasts { position: fixed; top: 16px; left: 12px; right: 12px; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 980px; background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; animation: toastin 0.25s var(--ease); max-width: 90vw; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all 0.35s; }
.toast-success { color: #1f9d48; }
.toast-error { color: var(--danger); }
@media (prefers-color-scheme: dark) { .toast-success { color: var(--success); } }
@keyframes toastin { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Connexion ---------- */
.login-page { height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent), radial-gradient(900px 500px at 110% 110%, rgba(94,92,230,0.15), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; background: var(--bg-elev); border-radius: 22px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: modalin 0.3s var(--ease); }
.login-card .logo-mark { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px; }
.login-card .logo-mark .ico { width: 28px; height: 28px; }
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-2); margin-bottom: 22px; }

/* ---------- Page publique ---------- */
.public-top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.public-top .public-title { min-width: 0; flex: 1; }
.public-top .title { font-weight: 600; font-size: 16px; }
.public-top .sub { color: var(--text-2); font-size: 12.5px; }

/* ---------- Divers ---------- */
.kbd { display: inline-block; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line-strong); font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.stat .l { font-size: 12px; color: var(--text-2); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 8px 10px; font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--line); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-2); }
.search-box { position: relative; }
.search-box .input { padding-left: 32px; border-radius: 980px; background: var(--bg-sunken); border-color: transparent; }
.search-box .input:focus { background: var(--bg-elev); }
.search-box .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.menu { position: absolute; z-index: 90; min-width: 200px; padding: 5px; background: var(--glass); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); animation: modalin 0.15s var(--ease); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: none; border-radius: 7px; background: transparent; text-align: left; font-size: 13.5px; cursor: pointer; }
.menu button:hover { background: var(--accent); color: #fff; }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger); color: #fff; }
.menu hr { border: none; border-top: 1px solid var(--line); margin: 4px 6px; }
.qr { display: block; margin: 10px auto; image-rendering: pixelated; border-radius: 8px; }
.list-pick { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.list-pick .pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.list-pick .pick:first-child { border-top: none; }
.list-pick .pick:hover { background: var(--bg-sunken); }
.list-pick .pick.linked { opacity: 0.55; cursor: default; }
.list-pick .pick .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 12px; border-radius: 980px; border: 1px solid var(--line-strong); background: var(--bg-elev); font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.mobile-only { display: none !important; }
.viewer.embedded { position: static; flex: 1; min-height: 0; animation: none; }

@media (max-width: 1100px) {
  .toolbar .search-box { width: 130px !important; }
  .crumbs button { max-width: 160px; }
}

/* Menu « ⋯ » des vignettes : au survol sur ordinateur, toujours visible sur tactile. */
.tile .tile-menu { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 8px; background: rgba(0,0,0,0.45); color: #fff; opacity: 0; transition: opacity 0.15s; z-index: 1; }
.tile:hover .tile-menu { opacity: 1; }
.tile .tile-menu:hover { background: rgba(0,0,0,0.7); color: #fff; }
.file-list .frow .row-menu { width: 30px; height: 30px; }

@media (hover: none) {
  .tile .tile-menu { opacity: 1; }
  .tile .check { display: flex; }
  .kbd-hint { display: none !important; }
  .btn { min-height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .segmented button { padding: 7px 12px; }
  .cmt .cacts { opacity: 1; }
}

@media (max-width: 860px) {
  .mobile-only { display: inline-flex !important; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 82vw); z-index: 61; box-shadow: var(--shadow-lg); padding-top: env(safe-area-inset-top); }
  .backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadein 0.15s; }
  .toolbar { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 6px; }
  .toolbar h1 { font-size: 17px; }
  .content { padding: 12px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .page-title h1 { font-size: 24px; }
  .project-grid { grid-template-columns: 1fr; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .file-list .frow, .file-list .head { grid-template-columns: 28px 44px 1fr 72px 32px; }
  .file-list .frow .col:nth-child(5), .file-list .frow .col:nth-child(6), .file-list .head span:nth-child(5), .file-list .head span:nth-child(6) { display: none; }
  .selection-bar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); width: auto; margin: 0; flex-wrap: wrap; justify-content: center; padding: 8px 10px; border-radius: 16px; }
  .upload-panel { right: 10px; left: 10px; width: auto; bottom: calc(10px + env(safe-area-inset-bottom)); max-height: 50vh; }
  .form-grid { grid-template-columns: 1fr; }
  .input, .select, .textarea { font-size: 16px; } /* évite le zoom automatique d'iOS à la saisie */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; border-bottom: none; padding-bottom: env(safe-area-inset-bottom); animation: sheetin 0.25s var(--ease); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; min-height: 44px; }
  .modal-actions .spacer { flex-basis: 100%; height: 0; } /* action à part (Vider la corbeille) sur sa propre ligne */
  .menu { position: fixed !important; left: 10px !important; right: 10px; top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom)); min-width: 0; padding: 8px; border-radius: 16px; animation: sheetin 0.2s var(--ease); }
  .menu button { padding: 12px; font-size: 15px; }
  .group-row { flex-wrap: wrap; }
  .public-top { flex-wrap: wrap; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .public-top .search-box { order: 5; width: 100% !important; }
  /* Mobile : titre sur toute la ligne à côté du logo, boutons dessous à parts égales. */
  .public-top .public-title { flex: 1 1 calc(100% - 56px); }
  .public-top > .btn { flex: 1 1 auto; justify-content: center; }

  /* Lecteur : vidéo en haut, commentaires en dessous. */
  .viewer .vtop { padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 4px; }
  .viewer .vtop .size { display: none; }
  .viewer .vbody { flex-direction: column; }
  .viewer .stage { flex: none; }
  .viewer .media-wrap { height: min(42vh, 56.25vw); }
  .viewer .media-wrap video { height: 100%; }
  .vctrl { padding: 6px 10px 8px; }
  .timeline { height: 30px; }
  .timeline .track, .timeline .buffered, .timeline .played { top: 13px; }
  .timeline .knob { top: 8px; }
  .timeline .mark { top: 5px; }
  .vbtns .tc { min-width: 0; flex: none; white-space: nowrap; font-size: 12px; }
  .vbtns .tc.dim, .vbtns .vol, .vbtns .io { display: none; }
  .vside { display: flex; width: 100%; flex: 1; min-height: 0; border-left: none; border-top: 1px solid rgba(255,255,255,0.08); }
  .vside .compose { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@keyframes sheetin { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.vside .pane { min-height: 0; }

@media (max-width: 600px) {
  .toolbar-browser .search-box, .toolbar-browser .segmented { display: none; }
  .toolbar .btn-primary .label { display: none; }
  .toolbar .btn-primary { padding: 7px 11px; }
  .toolbar .icon-btn { width: 36px; height: 36px; }
  .crumbs { min-width: 60px; }
  .crumbs button { max-width: 120px; }
  .viewer .vtop .icon-btn { width: 34px; height: 34px; }
  .viewer .vtop .counter, .viewer .vtop .side-toggle { display: none; }
  .viewer .vtop .title { font-size: 14px; }
  .file-grid { grid-template-columns: repeat(2, 1fr); }
}

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

/* ---------- Suivi des livraisons de la régie ---------- */
.activity { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 340px; max-width: calc(100vw - 32px); background: var(--glass); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: fadein 0.2s; }
.activity-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; background: transparent; border: none; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; text-align: left; }
.activity-head .chev { display: inline-flex; transform: rotate(90deg); transition: transform 0.2s; }
.activity.collapsed .activity-head .chev { transform: rotate(-90deg); }
.activity-list { max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--line); }
.activity-row { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.activity-row:last-child { border-bottom: none; }
.activity-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.activity-title .name { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.activity-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3, #8e8e93); flex: none; }
.activity-row.run .dot { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.activity-row.ok .dot { background: var(--success, #30d158); }
.activity-row.err .dot { background: var(--danger, #ff453a); }
.activity-row.warn .dot { background: var(--warning, #ff9f0a); animation: pulse 1.4s ease-in-out infinite; }
.activity-row.pause .dot { background: var(--text-3, #aeaeb2); }
.activity-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; position: relative; }
.activity-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.6s var(--ease, ease); }
.activity-bar.indeterminate span { position: absolute; animation: slide 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes slide { 0% { left: -35%; } 100% { left: 100%; } }
@media (max-width: 600px) {
  .activity { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-width: none; }
}
.viewer ~ .activity, body:has(.viewer:not(.embedded)) .activity { display: none; }

/* ---------- Téléphones, tablettes et écrans tactiles ---------- */
/* Hauteurs : sur Safari et Chrome mobiles, 100vh compte la barre d'adresse (le bas des fenêtres
   et des panneaux passait dessous) ; dvh suit la zone vraiment visible. La valeur en vh reste
   au-dessus pour les navigateurs qui ne connaissent pas dvh. */
#app { height: 100dvh; }
.modal { max-height: calc(100dvh - 40px); }
.upload-panel { max-height: 60dvh; bottom: calc(20px + var(--activity-h, 0px)); } /* au-dessus du panneau Régie */
.activity-list { max-height: 50dvh; }
.trash-list { max-height: min(60dvh, 520px); }

/* Encoche et barre d'accueil en paysage : rien sous les bords arrondis de l'écran. */
#toasts { top: calc(16px + env(safe-area-inset-top)); }
#app, .viewer:not(.embedded) { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.content { padding-bottom: max(20px, env(safe-area-inset-bottom), var(--activity-h, 0px)); } /* panneau Régie : activity.js */
.modal-overlay { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }

/* Cartes de projet : un titre long (insécable) ne doit pas élargir la grille au-delà de l'écran. */
.project-grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.project-card { min-width: 0; }

/* Fil d'Ariane : le dossier courant occupe toute la largeur du fil avant d'être coupé (le fil
   défile jusqu'à lui) ; les parents prennent au plus 45 % du fil au lieu de 120 à 260 px fixes. */
.crumbs button.current { max-width: 100%; }
.crumbs button:not(.current) { max-width: min(260px, 45%); } /* parents : selon la place, plus de plafond fixe */

/* Date des commentaires jamais coupée en deux lignes. */
.cmt .chead > span:last-child { white-space: nowrap; }

/* Titre de page et ses boutons : les boutons passent dessous plutôt que de se chevaucher. */
.page-title { flex-wrap: wrap; row-gap: 10px; }
.toolbar > .icon-btn, .toolbar > .btn, .activity-title > .btn, .activity-title > .icon-btn { flex: none; }

/* Tactile : cibles d'au moins 44 px (recommandation Apple et Android) et champs en 16 px, faute
   de quoi Safari iOS zoome à la saisie (en paysage aussi, au-delà de 860 px). */
@media (hover: none), (pointer: coarse) {
  .btn, .btn-sm { min-height: 44px; min-width: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .input, .select, .textarea { min-height: 44px; font-size: 16px; }
  .vside .compose.collapsed .textarea { min-height: 44px; }
  .crumbs button { min-height: 44px; min-width: 44px; }
  .segmented button { min-height: 44px; }
  .side-item, .user-chip, .menu button, .activity-head { min-height: 44px; }
  label.check, label.switch { min-height: 44px; }
  .chip { min-height: 40px; padding: 8px 14px; }
  .list-pick .pick { min-height: 48px; }
  .vbtns .speed { font-size: 16px; min-height: 44px; padding: 4px 8px; }
  .cmt .cacts .icon-btn { width: 44px; height: 44px; }
  .viewer .vtop .icon-btn, .toolbar .icon-btn { width: 44px; height: 44px; }
  /* Pastilles des vignettes (sélection, menu ⋯) : zone de toucher agrandie, même dessin. */
  .tile .check::before, .tile .tile-menu::before { content: ""; position: absolute; inset: -10px; }
}

@media (max-width: 860px) {
  .content { padding-bottom: max(calc(80px + env(safe-area-inset-bottom)), var(--activity-h, 0px)); } /* barres flottantes */
  .sidebar.open { padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); }
  /* Lignes à boutons : le libellé garde de quoi se lire, les boutons passent à la ligne (les
     lignes à simple étiquette ou chevron restent sur une ligne). */
  .group-row:has(> .btn, > select) .label { flex: 1 1 140px; }
  /* Boutons des feuilles : largeur selon le libellé, sur deux lignes au besoin (« Supprimer
     définitivement » débordait de son bouton à 320 px). */
  .modal-actions .btn { flex: 1 1 auto; white-space: normal; line-height: 1.2; }
  .modal-overlay { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); } /* feuille pleine largeur */
  .modal { max-height: 92dvh; }
  .upload-panel { max-height: 50dvh; }
  /* Barres flottantes au-dessus du panneau Régie (même bas d'écran). */
  .selection-bar, .upload-panel { bottom: calc(10px + env(safe-area-inset-bottom) + var(--activity-h, 0px)); }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  /* Lecteur : la vidéo garde sa forme (une vidéo verticale ne repousse plus les commentaires
     hors de l'écran), au plus la moitié de la hauteur. */
  .viewer .media-wrap { flex: none; height: auto; min-height: 120px; }
  .viewer .media-wrap video, .viewer .media-wrap img.full { width: auto; height: auto; max-width: 100%; max-height: 48vh; max-height: 48svh; }
}

@media (max-width: 600px) {
  /* Onglets (Administration) : sur leur propre ligne, à parts égales, défilants au besoin. */
  .toolbar-tabs { flex-wrap: wrap; row-gap: 8px; }
  .toolbar-tabs > .segmented { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar-tabs > .segmented::-webkit-scrollbar { display: none; }
  .toolbar-tabs > .segmented button { flex: 1 0 auto; justify-content: center; }
  /* Barre de l'explorateur : Nouveau dossier, Actualiser, Filtrer et l'affichage passent dans
     le menu Options ; le filtre s'ouvre sous la barre. */
  .toolbar-browser .wide-only { display: none; }
  .toolbar-browser.filtering { padding-bottom: 60px; }
  .toolbar-browser.filtering .search-box { display: block; position: absolute; left: 12px; right: 12px; bottom: 8px; width: auto !important; }
  .activity-list { max-height: 40dvh; }
}

@media (max-width: 420px) {
  /* Lecteur : image par image réservé aux écrans plus larges, pour garder des boutons de 44 px. */
  .vbtns .step { display: none; }
  .vbtns { gap: 4px; }
}

/* Téléphone en paysage : vidéo et commentaires côte à côte (empilés, les commentaires et leur
   champ de saisie sortaient de l'écran). */
@media (orientation: landscape) and (max-height: 500px) {
  .viewer .vbody { flex-direction: row; }
  .viewer .stage { flex: 1; min-width: 0; }
  .viewer .media-wrap { flex: 1; height: auto; min-height: 0; }
  .viewer .media-wrap video, .viewer .media-wrap img.full { max-height: 100%; }
  .vside { width: min(340px, 42vw); flex: none; border-top: none; border-left: 1px solid rgba(255,255,255,0.08); }
  .viewer .vtop { padding-top: 6px; padding-bottom: 6px; }
}

/* ---------- Sessions de régie d'un projet (pages/sessions.js) ---------- */
.sess-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sess-count.err { background: var(--danger); }
.sess-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.sess-filters .search-box { flex: 0 1 240px; min-width: 160px; }
.sess-filters .select { width: auto; max-width: 280px; min-width: 0; }
.sess-day { margin-bottom: 26px; }
/* Jour collé en haut pendant le défilement : on sait toujours quelle journée on regarde. */
/* Jour collé en haut : il recouvre aussi la marge haute de la page (rien ne dépasse au-dessus). */
.sess-day-head { position: sticky; top: -20px; z-index: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px;
  padding: 28px 0 8px; margin: -20px 0 4px; background: var(--bg); }
.sess-day-head h2 { font-size: 19px; }
.sess-dayflow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px 14px; }
.sess-hour { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 100%; }
.sess-hour-label { padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sess-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.sess-card { display: flex; flex-direction: column; width: 280px; max-width: 100%; overflow: hidden; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); transition: box-shadow 0.15s var(--ease); }
.sess-card:hover { box-shadow: var(--shadow); }
.sess-thumb { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 16 / 9; padding: 0;
  border: none; background: var(--bg-sunken); color: var(--text-3); cursor: pointer; overflow: hidden; }
.sess-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sess-thumb .ico.lg { width: 34px; height: 34px; stroke-width: 1.3; }
/* Pastilles sur l'image : fond sombre, point de couleur selon l'état. */
.sess-thumb .tag { position: absolute; left: 8px; top: 8px; gap: 6px; background: rgba(0,0,0,0.62); color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.sess-thumb .tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.7); }
.sess-thumb .tag.tag-accent::before { background: var(--accent); }
.sess-thumb .tag.tag-success::before { background: var(--success); }
.sess-thumb .tag.tag-warn::before { background: var(--warning); }
.sess-thumb .tag.tag-danger::before { background: var(--danger); }
.sess-thumb .dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 5px; background: rgba(0,0,0,0.65); color: #fff;
  font-size: 11px; font-family: var(--mono); }
.sess-thumb .sess-play { position: absolute; inset: 0; margin: auto; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px;
  border-radius: 50%; background: rgba(0,0,0,0.5); color: #fff; opacity: 0; transition: opacity 0.15s; }
.sess-thumb:hover .sess-play, .sess-thumb:focus-visible .sess-play { opacity: 1; }
.sess-thumb .sess-play .ico { width: 20px; height: 20px; }
.sess-thumb .activity-bar { position: absolute; left: 0; right: 0; bottom: 0; display: block; height: 4px; border-radius: 0; background: rgba(0,0,0,0.35); }
.sess-body { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 12px 12px; }
.sess-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-prog { display: inline-block; margin-right: 6px; padding: 1px 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.sess-guests { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 13px; }
.sess-guests .ellipsis { min-width: 0; }
.sess-guests .ico { flex: none; width: 14px; height: 14px; color: var(--text-3); }
.sess-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-detail.err { color: var(--danger); }
.sess-angles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.sess-angles .tag { padding: 1px 6px; font-size: 10.5px; }
.sess-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
.sess-actions .spacer { flex: 1; min-width: 0; }
.sess-nle { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--bg-sunken); }
.sess-nle button { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border: none; border-radius: 6px; background: transparent;
  color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.sess-nle button:hover { background: var(--bg-elev); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.sess-soft { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--text-3); }
.sess-soft.fcp { background: #af52de; }
.sess-soft.premiere { background: #5e5ce6; }
.sess-soft.resolve { background: #ff9f0a; }
.btn-sessions .sess-count { margin-left: 2px; }
.menu button .ellipsis { min-width: 0; max-width: 320px; }

@media (hover: none) {
  .sess-thumb .sess-play { opacity: 0.85; width: 40px; height: 40px; }
}
@media (hover: none), (pointer: coarse) {
  .sess-nle button { min-height: 40px; padding: 4px 10px; }
}

@media (max-width: 600px) {
  .toolbar .btn-sessions .label { display: none; }
  .toolbar .btn-sessions { padding: 7px 11px; }
  .sess-filters .search-box { flex: 1 1 100%; }
  .sess-filters .select { flex: 1 1 40%; max-width: none; }
  .sess-filters .segmented { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .sess-filters .segmented::-webkit-scrollbar { display: none; }
  .sess-filters .segmented button { flex: 1 0 auto; justify-content: center; }
  /* Téléphone : liste compacte par jour, vignette à gauche ; l'image lance la lecture. */
  .sess-dayflow { display: block; }
  .sess-hour { gap: 6px; margin-bottom: 12px; }
  .sess-grid { flex-direction: column; gap: 8px; }
  .sess-card { flex-direction: row; align-items: flex-start; width: 100%; }
  .sess-thumb { flex: none; width: 128px; margin: 8px 0 8px 8px; border-radius: 8px; }
  .sess-thumb .tag { left: 4px; top: 4px; padding: 1px 6px; font-size: 10.5px; }
  .sess-thumb .dur { right: 4px; bottom: 4px; }
  .sess-thumb .sess-play { display: none; }
  .sess-body { padding: 8px 10px; }
  .sess-angles, .sess-actions .btn, .sess-nle { display: none; }
  /* Dossier en bas à droite de la carte, sans ligne à lui. */
  .sess-card { position: relative; }
  .sess-body { padding-right: 44px; }
  .sess-actions { position: absolute; right: 4px; bottom: 4px; margin: 0; padding: 0; }
  .sess-actions .spacer { display: none; }
  .sess-actions .icon-btn { width: 36px; height: 36px; }
}
@media (max-width: 860px) {
  .sess-day-head { top: -12px; padding-top: 20px; margin-top: -12px; }
}
@media (max-width: 600px) and (hover: none) {
  .sess-actions .icon-btn { width: 44px; height: 44px; }
}

/* ---------- Corbeille : toast « Annuler », page globale (pages/trash.js) ---------- */
.side-slot { display: contents; }
.toast.toast-actions { display: flex; align-items: center; gap: 10px; padding-right: 8px; pointer-events: auto; }
.toast-btn { flex: none; padding: 4px 11px; border: 0; border-radius: 980px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; }
.toast-btn:hover { background: var(--accent); color: #fff; }
.trash-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.trash-filters .search-box { flex: 1 1 220px; min-width: 0; }
.trash-filters .select { flex: 0 1 280px; width: auto; min-width: 0; }
.trash-page-list .group-row input[type=checkbox] { flex: none; width: 18px; height: 18px; accent-color: var(--accent); }
.trash-page-list .sub.right { flex: none; text-align: right; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.trash-page-list .sub.right .warn { color: var(--warning); }
.trash-page-list .trash-when-phone { display: none; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
/* Boutons collés en bas pendant le défilement, dès qu'un élément est choisi. */
.trash-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 10px 0; background: var(--bg); }
.trash-bar:not(.active) .trash-picked { display: none; }
@media (hover: none), (pointer: coarse) {
  .toast-btn { min-height: 36px; padding: 6px 14px; }
  .trash-page-list .group-row input[type=checkbox] { width: 22px; height: 22px; }
}
@media (max-width: 600px) {
  .trash-page-list .sub.right { display: none; }
  .trash-page-list .trash-when-phone { display: block; }
  .trash-page-list .trash-when-phone .warn { color: var(--warning); }
  .trash-filters .select { flex: 1 1 100%; }
  .trash-bar { flex-wrap: wrap; bottom: calc(var(--activity-h, 0px)); }
  .trash-bar .btn { flex: 1 1 auto; }
  .trash-bar .spacer { display: none; }
  .toast.toast-actions { flex-wrap: wrap; justify-content: center; border-radius: 18px; }
}
