:root {
  --bg: #0f0f14;
  --surface: #191921;
  --surface-2: #23232e;
  --line: #2e2e3b;
  --text: #f2f1f7;
  --muted: #9a98ab;
  --accent: #ff85d6;
  --accent-ink: #1a0a14;
  --ok: #6fdc9b;
  --warn: #ffb86b;
  --danger: #ff6b7d;
  --ig: #e86cc4;
  --tt: #5ee2e8;
  --yt: #ff6b6b;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 640px; margin: 0 auto; padding: env(safe-area-inset-top, 0px) 16px calc(110px + var(--safe-b)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
.vide { color: var(--muted); text-align: center; padding: 48px 0; }

/* barre du haut */
.haut { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: 14px 0 10px; background: linear-gradient(var(--bg) 80%, transparent); }
.haut h1 { font-size: 26px; margin: 0; flex: 1; letter-spacing: -0.02em; }
.haut h2 { font-size: 17px; margin: 0; flex: 1; line-height: 1.25; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rond { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; font-size: 18px; flex: none; }
.rond:active { background: var(--surface-2); }
.rond.tourne { animation: tourne 1s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* comptes */
.comptes { display: flex; gap: 8px; margin: 2px 0 6px; }
.compte { flex: 1; background: var(--surface); border-radius: var(--radius); padding: 10px 12px; }
.compte b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.compte span { color: var(--muted); font-size: 12.5px; }
.maj { color: var(--muted); font-size: 12.5px; margin: 4px 2px 10px; }
.maj .err { color: var(--warn); display: block; }

/* filtres */
.filtres { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.filtres::-webkit-scrollbar { display: none; }
.puce { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; white-space: nowrap; font-size: 14px; }
.puce.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

/* cartes */
.carte { display: flex; gap: 12px; background: var(--surface); border-radius: var(--radius); padding: 10px;
  margin-bottom: 10px; color: var(--text); }
.carte:active { background: var(--surface-2); }
.vign { width: 64px; height: 100px; border-radius: 9px; background: var(--surface-2) center/cover no-repeat; flex: none; position: relative; }
.vign .nb { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.72); border-radius: 6px; font-size: 11.5px; padding: 1px 5px; }
.carte .corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.carte .titre { font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.carte .date { color: var(--muted); font-size: 12.5px; }
.lignes { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }
.ligne { display: flex; align-items: center; gap: 7px; font-size: 13px; font-variant-numeric: tabular-nums; }
.ligne .v { font-weight: 600; }
.ligne .s { color: var(--muted); }
.pf { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; border-radius: 5px; padding: 1px 5px; color: #111; flex: none; }
.pf.instagram { background: var(--ig); } .pf.tiktok { background: var(--tt); } .pf.youtube { background: var(--yt); }

/* page vidéo */
.onglets { display: flex; gap: 6px; margin-bottom: 12px; }
.bloc { background: var(--surface); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.bloc h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.entete { display: flex; gap: 12px; align-items: flex-start; }
.entete .vign { width: 78px; height: 122px; }
.entete .infos { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.entete .legende { color: var(--text); white-space: pre-line; max-height: 5.8em; overflow: hidden; }
.grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 9px 10px; }
.stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
.courbe { margin-top: 12px; }
.courbe svg { width: 100%; height: 70px; display: block; }
.courbe .leg { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.note-tt { color: var(--muted); font-size: 13.5px; margin: 0; }

/* frise des captures */
.moment { margin-top: 14px; }
.moment:first-of-type { margin-top: 0; }
.moment .lab { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.moment .lab b { color: var(--accent); font-size: 15px; }
.moment .lab span { color: var(--muted); font-size: 12.5px; }
.caps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cap { aspect-ratio: 9/16; border-radius: 9px; overflow: hidden; background: var(--surface-2); position: relative; border: 0; padding: 0; }
.cap img, .cap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cap .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; text-shadow: 0 1px 8px #000; pointer-events: none; }
.cap .mini { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.8)); font-size: 11px; padding: 10px 6px 4px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* envois en cours */
.envois { margin-bottom: 12px; }
.envoi { background: var(--surface); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; font-size: 13px; }
.envoi .nom { display: flex; justify-content: space-between; gap: 8px; }
.envoi .nom span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre { height: 5px; background: var(--surface-2); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.barre i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.envoi.ok .barre i { background: var(--ok); } .envoi.ko { color: var(--danger); } .envoi.ko .barre i { background: var(--danger); }

/* gros bouton du bas */
.bas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(transparent, var(--bg) 35%); }
.bas .gros { max-width: 608px; margin: 0 auto; display: block; }
.gros { width: 100%; border: 0; border-radius: 999px; padding: 15px 18px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 16px; }
.gros:active { filter: brightness(.92); }
.gros:disabled { opacity: .5; }
.second { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; text-align: left; margin-bottom: 8px; }
.second:active { background: var(--surface-2); }
.second small { display: block; color: var(--muted); }

/* formulaires */
.champ { display: block; margin-bottom: 14px; }
.champ > span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.champ input, .champ select, .champ textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 16px; }
.champ input:focus, .champ select:focus, .champ textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.msg { color: var(--danger); font-size: 14px; min-height: 1.4em; margin: 0 0 10px; }
.login { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.login h1 { font-size: 34px; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 26px; }

/* visionneuse */
.voile { position: fixed; inset: 0; z-index: 20; background: #060609; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px calc(12px + var(--safe-b)); }
.voile .media { flex: 1; min-height: 0; display: grid; place-items: center; }
.voile .media img, .voile .media video { max-width: 100%; max-height: 100%; border-radius: 10px; }
.voile .outils { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.voile .outils .t { flex: 1; color: var(--muted); font-size: 13px; }
.voile textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; resize: none; font-size: 16px; }
.danger { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 30;
  background: var(--surface-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px); }
