:root {
  --bg: #0c0c0e; --panel: #141418; --panel2: #1b1b21; --line: #26262e; --text: #ececf1; --muted: #8b8b97;
  --accent: #ffd400; --accent-ink: #141414; --red: #ff5a4e; --green: #3ddc84; --blue: #59a6ff;
  --r: 12px; --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 8px; padding: 7px 12px; }
button:hover { border-color: #3a3a45; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.ghost { background: transparent; }
button.sm { padding: 4px 8px; font-size: 12px; }
input, textarea, select { font: inherit; color: var(--text); background: #0f0f13; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea:focus, input:focus { outline: none; border-color: var(--accent); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }

#top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 22px; padding: 12px 22px; background: rgba(12,12,14,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.logo b { color: var(--accent); font-weight: 900; }
.logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
nav { display: flex; gap: 6px; margin-left: auto; }
nav a { padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; }
nav a.on { background: var(--accent); color: var(--accent-ink); }
main { padding: 22px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 26px; margin: 4px 0 4px; font-weight: 800; letter-spacing: -.01em; }
h1 em { font-style: italic; font-family: Georgia, serif; font-weight: 400; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 26px 0 12px; font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 6px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; font-family: var(--mono); color: var(--accent); }
.stat span { color: var(--muted); font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: .15s; display: block; }
.card:hover { border-color: #3d3d48; transform: translateY(-2px); }
.thumb { aspect-ratio: 16/9; background: #08080a center/cover no-repeat; position: relative; display: flex; align-items: center; justify-content: center; color: #444; }
.thumb.v { aspect-ratio: 16/9; background-size: contain; }
.card .body { padding: 12px 14px; }
.card .title { font-weight: 700; margin-bottom: 6px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.tag.y { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag.r { background: rgba(255,90,78,.15); color: var(--red); border-color: rgba(255,90,78,.4); }
.tag.g { background: rgba(61,220,132,.12); color: var(--green); border-color: rgba(61,220,132,.35); }
.badge-ver { position: absolute; left: 8px; bottom: 8px; }
.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 40px; text-align: center; color: var(--muted); }
.empty code { background: var(--panel2); padding: 2px 6px; border-radius: 6px; color: var(--text); }

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.player { background: #000; border-radius: var(--r); overflow: hidden; position: relative; }
.player video { width: 100%; display: block; max-height: 72vh; background: #000; }
.path { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
.versions { display: flex; gap: 6px; flex-wrap: wrap; }
.versions button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
pre.report { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: #0f0f13; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 340px; overflow: auto; }

/* Relecture */
.ctrl { display: flex; align-items: center; gap: 6px; padding: 10px; background: var(--panel); border-top: 1px solid var(--line); flex-wrap: wrap; }
.ctrl .tc { font-family: var(--mono); font-size: 13px; padding: 0 8px; min-width: 150px; }
.ctrl .tc b { color: var(--accent); }
.scrub { position: relative; height: 34px; margin: 0 10px 10px; cursor: pointer; }
.scrub .track { position: absolute; left: 0; right: 0; top: 14px; height: 6px; border-radius: 3px; background: #2a2a33; }
.scrub .fill { position: absolute; left: 0; top: 14px; height: 6px; border-radius: 3px; background: var(--accent); }
.scrub .mk { position: absolute; top: 4px; width: 4px; height: 26px; margin-left: -2px; border-radius: 2px; background: var(--red); }
.scrub .mk.done { background: var(--green); opacity: .6; }
.cmt-in { display: flex; gap: 8px; }
.cmt-in textarea { flex: 1; min-height: 64px; resize: vertical; }
.cmts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 58vh; overflow: auto; }
.cmt { background: #101014; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.cmt.done { opacity: .5; }
.cmt .tc { font-family: var(--mono); font-size: 12px; color: var(--accent); cursor: pointer; }
.cmt .txt { margin-top: 4px; white-space: pre-wrap; }
.cmt .reply { margin-top: 6px; font-size: 12px; color: var(--green); }
.kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.kbd b { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--text); font-weight: 500; }

/* Studio */
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.agent { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; position: relative; }
.agent .av { width: 44px; height: 44px; border-radius: 12px; background: var(--panel2); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 10px; }
.agent .nm { font-weight: 700; }
.agent .ms { color: var(--muted); font-size: 12px; margin-top: 4px; min-height: 34px; }
.agent .st { position: absolute; top: 14px; right: 14px; width: 10px; height: 10px; border-radius: 50%; background: #3a3a44; }
.agent.working { border-color: var(--accent); }
.agent.working .st { background: var(--accent); box-shadow: 0 0 0 0 rgba(255,212,0,.7); animation: pulse 1.4s infinite; }
.agent.done .st { background: var(--green); }
.agent.error .st { background: var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,212,0,.7); } 70% { box-shadow: 0 0 0 10px rgba(255,212,0,0); } 100% { box-shadow: 0 0 0 0 rgba(255,212,0,0); } }
.log { font-family: var(--mono); font-size: 12px; max-height: 300px; overflow: auto; background: #0f0f13; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.log div { padding: 2px 0; color: var(--muted); }
.log div b { color: var(--text); font-weight: 600; }

/* Bibliothèque */
.tpl { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tpl .frame { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #2a2a30; }
.tpl .frame iframe { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; pointer-events: none; }
.tpl .frame.v { aspect-ratio: 9/16; max-height: 420px; margin: 0 auto; }
.tpl .frame.v iframe { width: 1080px; height: 1920px; }
.tpl .body { padding: 12px 14px; }
.tpl code { font-size: 11px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.sw { display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); }
.sw input[type=color] { width: 64px; height: 64px; border-radius: 12px; padding: 0; border: 1px solid var(--line); background: none; cursor: pointer; }
.fmt { display: grid; grid-template-columns: 70px 1fr; gap: 14px; align-items: center; }
.fmt .shape { background: var(--panel2); border: 2px solid var(--accent); border-radius: 6px; margin: auto; }
.asset { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.asset img { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; }
.tabs2 { display: flex; gap: 6px; margin: 10px 0 0; flex-wrap: wrap; }
.tabs2 button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--accent); color: var(--accent-ink); font-weight: 700; padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .25s; pointer-events: none; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, 1fr); } }

.drop { margin-top: 12px; border: 2px dashed #3a3a45; border-radius: 12px; padding: 28px; text-align: center; cursor: pointer; font-weight: 700; transition: .15s; }
.drop:hover, .drop.on { border-color: var(--accent); background: rgba(255,212,0,.06); }

/* ---------------------------------------------------------------- Portail Raccord */
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.who b { color: var(--text); }
.role { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.login { min-height: 80vh; display: grid; place-items: center; }
.login .box { max-width: 420px; text-align: center; }
.login .big { font-size: 44px; font-weight: 900; letter-spacing: -.02em; }
.login .big b { color: var(--accent); }
.gbtn { display: inline-flex; gap: 10px; align-items: center; background: #fff; color: #1f1f1f; font-weight: 600; padding: 11px 18px; border-radius: 999px; margin-top: 18px; }
.hero { background: linear-gradient(135deg, rgba(255,212,0,.12), rgba(255,212,0,0) 60%), var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.hero h1 { margin: 0; }
.form { display: grid; gap: 12px; max-width: 760px; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form label span { font-weight: 400; color: var(--muted); font-size: 12px; }
.form textarea { min-height: 150px; resize: vertical; }
.files { display: grid; gap: 8px; margin-top: 10px; }
.file { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #101014; }
.bar { grid-column: 1 / -1; height: 6px; background: #2a2a33; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.file.ok .bar i { background: var(--green); }
.gauge { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.job { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #101014; margin-top: 12px; }
.job.en_attente, .job.en_cours { border-color: var(--accent); }
.job.erreur { border-color: rgba(255,90,78,.5); }
.job .sum { white-space: pre-wrap; margin-top: 6px; font-size: 13px; }
.spin { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
.cmt .chk { margin-right: 4px; transform: scale(1.15); accent-color: var(--accent); }
.cmt .who2 { font-size: 11px; color: var(--muted); }
.cmt .out { margin-top: 6px; font-size: 12px; padding: 6px 8px; border-radius: 8px; }
.cmt .out.applique { color: var(--green); background: rgba(61,220,132,.08); }
.cmt .out.non_applique, .cmt .out.erreur { color: var(--red); background: rgba(255,90,78,.08); }
.cmt .out.annule { color: var(--muted); background: var(--panel2); }
.cmt.locked { border-color: var(--accent); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.clk { cursor: pointer; }
table.t tr.clk:hover td { background: var(--panel2); }
.tag.b { background: rgba(89,166,255,.12); color: var(--blue); border-color: rgba(89,166,255,.35); }
@media (max-width: 700px) {
  #top { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  nav { margin-left: 0; overflow-x: auto; }
  main { padding: 16px; }
  .who .mail { display: none; }
  table.t { display: block; overflow-x: auto; }
}
[hidden] { display: none !important; }
button:disabled { opacity: .4; cursor: not-allowed; }

/* menu déroulant des sections */
.menu { position: relative; }
.menu-btn { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 7px 14px; border-radius: 999px; }
.menu-btn .caret { color: var(--muted); font-size: 11px; }
.menu-list { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.45); z-index: 20; }
.menu.open .menu-list { display: block; }
.menu-list a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--text); font-weight: 600; }
.menu-list a:hover { background: var(--panel2); }
.menu-list a.on { background: var(--accent); color: var(--accent-ink); }
#nav { gap: 10px; align-items: center; }
.espace-tag { font-size: 12px; padding: 4px 10px; }
#espace-sel { padding: 6px 10px; border-radius: 999px; max-width: 220px; }
/* liens clients */
.link-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #101014; margin-top: 8px; }
.link-row.dead { opacity: .45; }
.grow { flex: 1; min-width: 180px; }
/* mémoire */
.mem { display: grid; gap: 8px; }
.mem-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.mem-text { outline: none; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.mem-text:focus { background: #0f0f13; box-shadow: 0 0 0 1px var(--accent); }
.scrub .mk.client { background: var(--blue); }
/* pages client */
.client-head { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.client-head .logo { font-size: 15px; }
