/* ============================================================
   sx-panel-web — style (noir, minimal, pilules blanches)
   ============================================================ */
@font-face { font-family: 'Geist'; src: url('../fonts/geist-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../fonts/geist-sans-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../fonts/geist-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../fonts/geist-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../fonts/geist-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../fonts/geist-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
    --page: #030303;
    --frame: #0a0a0b;
    --s1: #0f0f11;
    --s2: #141417;
    --s3: #1b1b1f;
    --s4: #242429;
    --line: rgba(255,255,255,.07);
    --line2: rgba(255,255,255,.12);
    --line3: rgba(255,255,255,.2);
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --dim: #71717a;
    --faint: #52525b;
    --white: #ffffff;
    --ink: #0a0a0b;
    --green: #3ecf8e;
    --red: #ff5a5f;
    --amber: #f5a524;
    --blue: #6e9bff;
    --stage: #8a8a8a;
    --r: 14px;
    --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
    --mono: 'Geist Mono', ui-monospace, monospace;
    --side: 232px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--sans); font-size: 13.5px; color: var(--text); background: var(--page); -webkit-font-smoothing: antialiased; overflow: hidden; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1.2px); background-size: 22px 22px;
    mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 85%); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: inherit; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.18); }
::selection { background: rgba(255,255,255,.25); }

/* ---------- fenêtre ---------- */
.shell { position: relative; z-index: 1; height: 100vh; padding: 18px; display: flex; }
.window { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--frame); border: 1px solid var(--line2); border-radius: 22px; overflow: hidden;
    box-shadow: 0 40px 120px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.04); }
.titlebar { height: 52px; flex-shrink: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--line); }
.lights { display: flex; gap: 8px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
.addr { display: flex; align-items: center; gap: 10px; min-width: 340px; max-width: 520px; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--s2); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.addr b { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr .sep { width: 1px; height: 14px; background: var(--line2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex-shrink: 0; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(62,207,142,.15); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px rgba(255,90,95,.15); }
.tb-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.presence { display: flex; align-items: center; }
.presence span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; text-transform: uppercase; background: var(--s4); border: 2px solid var(--frame); margin-left: -7px; }
.presence span:first-child { margin-left: 0; }
.userbtn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--s1); }
.userbtn:hover { border-color: var(--line2); }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--white); color: var(--ink); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.userbtn small { font-size: 11px; color: var(--dim); }

.body { flex: 1; min-height: 0; display: flex; }
.side { width: var(--side); flex-shrink: 0; border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--white); color: var(--ink); display: grid; place-items: center; }
.brand .mark svg.i { width: 18px; height: 18px; stroke-width: 2.4; }
.brand b { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.brand small { display: block; font-size: 11px; color: var(--dim); margin-top: 1px; }
.nav-h { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.03); }
.nav a.on { color: var(--text); background: var(--s3); box-shadow: inset 0 0 0 1px var(--line); }
.nav a .badge { margin-left: auto; font: 500 10.5px var(--mono); padding: 1px 7px; border-radius: 999px; background: var(--s4); color: var(--muted); }
.side .foot { margin-top: auto; padding: 14px 10px 4px; font-size: 11px; color: var(--faint); line-height: 1.5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 28px 0; }
.page-head h1 { font-size: 19px; font-weight: 600; letter-spacing: -.015em; }
.page-head p { margin-top: 3px; color: var(--dim); font-size: 13px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 28px 28px; }

/* ---------- pilules (onglets) ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { height: 30px; padding: 0 13px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 12.5px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.pill:hover { color: var(--text); }
.pill.on { background: var(--white); color: var(--ink); }
.pill .n { font: 500 10.5px var(--mono); opacity: .7; }

/* ---------- boutons ---------- */
.btn { height: 34px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 500; font-size: 13px; white-space: nowrap;
    background: var(--s2); border: 1px solid var(--line2); color: var(--text); transition: background .12s, border-color .12s, opacity .12s; }
.btn:hover { background: var(--s3); border-color: var(--line3); }
.btn.primary { background: var(--white); color: var(--ink); border-color: var(--white); }
.btn.primary:hover { background: #e6e6e6; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255,255,255,.04); }
.btn.danger { color: var(--red); border-color: rgba(255,90,95,.25); background: rgba(255,90,95,.06); }
.btn.danger:hover { background: rgba(255,90,95,.12); border-color: rgba(255,90,95,.4); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 34px; padding: 0; } .btn.sm.icon { width: 28px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.linkbtn { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line3); }
.linkbtn:hover { color: var(--text); }

/* ---------- champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 12px; font-weight: 500; color: var(--muted); }
.field .hint { font-size: 11.5px; color: var(--dim); }
.in, select.in, textarea.in { height: 36px; width: 100%; padding: 0 12px; border-radius: 10px; background: var(--s1); border: 1px solid var(--line2); outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.in { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.in:focus { border-color: rgba(255,255,255,.35); box-shadow: 0 0 0 3px rgba(255,255,255,.06); }
.in::placeholder { color: var(--faint); }
select.in { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
select.in option { background: var(--s2); }
.in.mono { font-family: var(--mono); font-size: 12.5px; }
.search { position: relative; }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search .in { padding-left: 34px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 12.5px; user-select: none; }
.switch i { width: 32px; height: 18px; border-radius: 999px; background: var(--s4); position: relative; transition: background .15s; flex-shrink: 0; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch.on { color: var(--text); }
.switch.on i { background: var(--white); }
.switch.on i::after { transform: translateX(14px); background: var(--ink); }

/* ---------- cartes ---------- */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 13.5px; font-weight: 600; }
.card-h small { color: var(--dim); font-size: 12px; }
.card-b { padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 16px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat .v { margin-top: 10px; font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--dim); font-weight: 500; }
.stat .s { margin-top: 4px; font-size: 12px; color: var(--dim); }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-top: 12px; }
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }

/* ---------- tableaux ---------- */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--s1); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--s1); text-align: left; font-weight: 500; font-size: 11.5px; color: var(--dim); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.sortable { cursor: pointer; } .tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td, .tbl tbody tr.sel td { background: rgba(255,255,255,.025); }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl .ellipsis { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cellv { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12px; cursor: pointer; border-radius: 6px; padding: 3px 6px; margin: -3px -6px; }
.cellv:hover { background: var(--s3); }
.cellv.null { color: var(--faint); font-style: italic; }
.cellv.ro { cursor: default; } .cellv.ro:hover { background: none; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--dim); font-size: 12.5px; }
.empty { padding: 34px 20px; text-align: center; color: var(--dim); line-height: 1.6; }
.empty b { display: block; color: var(--muted); font-weight: 500; margin-bottom: 2px; }

/* ---------- petites étiquettes ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 500; background: var(--s3); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.green { color: var(--green); background: rgba(62,207,142,.08); border-color: rgba(62,207,142,.2); }
.tag.red { color: var(--red); background: rgba(255,90,95,.08); border-color: rgba(255,90,95,.2); }
.tag.amber { color: var(--amber); background: rgba(245,165,36,.08); border-color: rgba(245,165,36,.22); }
.tag.white { color: var(--ink); background: var(--white); border-color: var(--white); }
.kbd { font: 500 11px var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--s3); border: 1px solid var(--line2); }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(245,165,36,.06); border: 1px solid rgba(245,165,36,.2); color: #f3d39b; font-size: 12.5px; line-height: 1.5; }
.banner svg.i { color: var(--amber); margin-top: 1px; }
.banner.info { background: rgba(110,155,255,.06); border-color: rgba(110,155,255,.22); color: #c8d6ff; }
.banner.info svg.i { color: var(--blue); }
.banner.red { background: rgba(255,90,95,.06); border-color: rgba(255,90,95,.22); color: #ffc2c4; }
.banner.red svg.i { color: var(--red); }
.banner .grow b { color: var(--text); font-weight: 600; }

/* ---------- listes ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; } .li.click:hover { background: rgba(255,255,255,.02); }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t small { display: block; color: var(--dim); font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ava { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--s3); border: 1px solid var(--line); font-size: 11px; font-weight: 600; color: var(--muted); flex-shrink: 0; text-transform: uppercase; }
.bars { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.bar-r { display: grid; grid-template-columns: 110px 1fr 34px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-r span:first-child { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-t { height: 8px; border-radius: 4px; background: var(--s3); overflow: hidden; }
.bar-t i { display: block; height: 100%; border-radius: 4px; background: var(--white); }

/* ---------- tiroir (fiche) & fenêtres ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(620px, calc(100vw - 24px)); z-index: 41; display: flex; flex-direction: column; background: var(--frame); border: 1px solid var(--line2); border-radius: 18px; box-shadow: -30px 0 80px rgba(0,0,0,.5); animation: slidein .22s cubic-bezier(.2,.9,.3,1); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.drawer-h { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-b { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 24px; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 51; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--frame); border: 1px solid var(--line2); border-radius: 18px; box-shadow: 0 40px 100px rgba(0,0,0,.6); animation: pop .18s cubic-bezier(.2,.9,.3,1.1); }
.modal.wide { width: min(860px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }
.modal-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-h h3 { font-size: 15px; font-weight: 600; }
.modal-h p { color: var(--dim); font-size: 12.5px; margin-top: 3px; line-height: 1.5; }
.modal-b { padding: 12px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.scrim.top { z-index: 50; }
.sect { margin-top: 22px; }
.sect:first-child { margin-top: 0; }
.sect-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sect-h h4 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; font-size: 13px; }
.kv dt { color: var(--dim); } .kv dd { min-width: 0; overflow-wrap: anywhere; }
.money-r { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--s1); }
.money-r + .money-r { margin-top: 8px; }
.money-r .lbl { display: block; }
.money-r .val { font: 600 18px var(--mono); margin-top: 3px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.qty button { width: 28px; height: 28px; color: var(--muted); } .qty button:hover { background: var(--s3); color: var(--text); }
.qty span { min-width: 34px; text-align: center; font: 500 12.5px var(--mono); }

/* ---------- notifications ---------- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; max-width: 420px; padding: 11px 14px; border-radius: 12px; background: #161619; border: 1px solid var(--line2); box-shadow: 0 16px 40px rgba(0,0,0,.5); font-size: 13px; line-height: 1.45; pointer-events: auto; animation: tin .2s ease-out; }
.toast .dot { margin-top: 6px; }
.toast.ok .dot { background: var(--green); } .toast.err .dot { background: var(--red); } .toast.info .dot { background: var(--blue); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .2s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- connexion ---------- */
.auth { flex: 1; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.auth-card .mark { width: 44px; height: 44px; border-radius: 13px; background: var(--white); color: var(--ink); display: grid; place-items: center; margin-bottom: 6px; }
.auth-card .mark svg.i { width: 24px; height: 24px; stroke-width: 2.4; }
.auth-card h1 { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.auth-card p { color: var(--dim); line-height: 1.55; }
.err-line { color: var(--red); font-size: 12.5px; min-height: 18px; }

/* ---------- apparence (éditeur façon vidéo) ---------- */
.ap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ap-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: border-color .12s, background .12s; text-align: left; }
.ap-card:hover { border-color: var(--line3); background: var(--s2); }
.ap-card .sw { display: flex; gap: 4px; }
.ap-card .sw i { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(255,255,255,.12); }
.ap-card b { font-weight: 600; } .ap-card small { color: var(--dim); font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ap-card .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; height: 100%; min-height: 0; }
.stage-col { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.stage { position: relative; flex: 1; min-height: 300px; border-radius: 16px; background: var(--stage); overflow: hidden; border: 1px solid var(--line); }
.stage.scene { background: radial-gradient(120% 90% at 70% 20%, #3a4a5c 0%, #1b2430 45%, #0b0f15 100%); }
.stage.checker { background-color: #2a2a2e; background-image: linear-gradient(45deg, #333338 25%, transparent 25%), linear-gradient(-45deg, #333338 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #333338 75%), linear-gradient(-45deg, transparent 75%, #333338 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.stage iframe { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; border: 0; background: transparent; transform-origin: center center; }
.stage .tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 2; }
.stage .tools .btn { background: rgba(10,10,11,.75); backdrop-filter: blur(6px); }
.stage .tools .btn.on { background: var(--white); color: var(--ink); }
.stage .msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 30px; color: rgba(255,255,255,.85); font-size: 13px; line-height: 1.6; z-index: 1; pointer-events: none; }
.stage .msg b { display: block; font-size: 14px; color: #fff; }
.stage.full { position: fixed; inset: 12px; z-index: 45; min-height: 0; }
.stage-hint { font-size: 12px; color: var(--dim); }
.ctrl-col { display: flex; flex-direction: column; min-height: 0; }
.ctrl-col h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.ctrl-scroll { flex: 1; min-height: 0; overflow-y: auto; margin-right: -10px; padding-right: 10px; }
.ctrl-sub { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 16px 0 10px; }
.vctl { padding: 10px 0; border-bottom: 1px solid var(--line); }
.vctl.hl { animation: hl 1.4s ease-out; border-radius: 10px; }
@keyframes hl { 0%, 40% { background: rgba(255,255,255,.08); box-shadow: 0 0 0 8px rgba(255,255,255,.08); } }
.vctl .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.vctl .top b { font-weight: 500; font-size: 13px; }
.vctl .top code { font: 400 11px var(--mono); color: var(--faint); }
.vctl .top .mod { width: 6px; height: 6px; border-radius: 50%; background: var(--white); display: inline-block; margin-left: 6px; vertical-align: middle; }
.vctl .top button { font-size: 11px; color: var(--dim); } .vctl .top button:hover { color: var(--text); }
.colorrow { display: grid; grid-template-columns: 34px 92px 1fr 42px; gap: 10px; align-items: center; }
.swatch { position: relative; width: 34px; height: 34px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line2);
    background-image: linear-gradient(45deg, #444 25%, transparent 25%), linear-gradient(-45deg, #444 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #444 75%), linear-gradient(-45deg, transparent 75%, #444 75%);
    background-size: 10px 10px; background-position: 0 0, 0 5px, 5px -5px, -5px 0; background-color: #666; }
.swatch i { position: absolute; inset: 0; }
.swatch input { position: absolute; inset: -8px; width: 50px; height: 50px; opacity: 0; cursor: pointer; }
.hexin { height: 30px; padding: 0 8px; border-radius: 8px; background: var(--s1); border: 1px solid var(--line); font: 400 12px var(--mono); width: 100%; outline: none; }
.hexin:focus { border-color: var(--line3); }
input[type=range].rng { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; border-radius: 3px; background: var(--s4); outline: none; }
input[type=range].rng::-webkit-slider-thumb { -webkit-appearance: none; width: 6px; height: 18px; border-radius: 3px; background: var(--white); cursor: pointer; }
input[type=range].rng::-moz-range-thumb { width: 6px; height: 18px; border-radius: 3px; background: var(--white); border: 0; cursor: pointer; }
.pct { font: 400 11.5px var(--mono); color: var(--muted); text-align: right; }
.lenrow { display: grid; grid-template-columns: 1fr 86px; gap: 10px; align-items: center; }
.textpair { display: grid; grid-template-columns: 1fr 16px 1fr 28px; gap: 8px; align-items: center; padding: 6px 0; }
.textpair svg.i { color: var(--faint); width: 14px; height: 14px; }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.sugg button { max-width: 100%; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--s2); border: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg button:hover { color: var(--text); border-color: var(--line3); }
.ctrl-foot { display: flex; gap: 8px; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 10px; }
.unsaved { font-size: 12px; color: var(--amber); display: flex; align-items: center; gap: 6px; }
.unsaved::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

/* ---------- base de données ---------- */
.db { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; height: 100%; min-height: 0; }
.db-tables { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.db-tables .list-wrap { flex: 1; min-height: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--s1); }
.db-t { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.db-t:hover { color: var(--text); background: rgba(255,255,255,.02); }
.db-t.on { color: var(--ink); background: var(--white); }
.db-t span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-t .n { font-size: 10.5px; opacity: .6; }
.db-main { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.db-main .tbl-wrap { flex: 1; min-height: 0; }
.pk { color: var(--amber); }

/* ---------- divers ---------- */
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; height: 100%; min-height: 0; }
.scroll { overflow-y: auto; min-height: 0; }
.gtbl { display: grid; gap: 8px; }
.grade-r { display: grid; grid-template-columns: 64px 1fr 1.3fr 110px 30px; gap: 8px; align-items: center; }
.grade-h { font-size: 11px; color: var(--dim); font-weight: 500; }
.ann-prev { padding: 16px 20px 18px; border-radius: 16px; background: rgba(10,10,11,.94); border: 1px solid rgba(255,255,255,.12); max-width: 520px; position: relative; overflow: hidden; }
.ann-prev .top { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ann-prev b { display: block; margin-top: 8px; font-size: 18px; }
.ann-prev p { margin-top: 4px; color: #d4d4d8; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.ann-prev .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 62%; background: #fff; opacity: .7; }
.ann-prev.warning .bar, .ann-prev.warning .dot { background: var(--amber); }
.ann-prev.event .bar, .ann-prev.event .dot { background: #8b7bff; }
.offline-screen { display: grid; place-items: center; height: 100%; }
.code { font-family: var(--mono); font-size: 12px; background: var(--s1); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-all; color: var(--muted); }
.menu { position: fixed; z-index: 55; min-width: 200px; padding: 6px; background: #151518; border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.menu button:hover { background: var(--s3); color: var(--text); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }

.menu-btn { display: none !important; }

@media (max-width: 1180px) {
    .editor { grid-template-columns: 1fr; height: auto; }
    .stage { min-height: 420px; }
    .cols, .cols3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .shell { padding: 0; }
    .window { border-radius: 0; border: 0; }
    .side { position: fixed; z-index: 30; top: 52px; bottom: 0; left: 0; background: var(--frame); transform: translateX(-100%); transition: transform .2s; }
    .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.6); }
    .addr { min-width: 0; }
    .lights { display: none; }
    .titlebar { grid-template-columns: auto 1fr auto; gap: 10px; padding: 0 12px; }
    .menu-btn { display: inline-flex !important; }
    .page-head, .page { padding-left: 16px; padding-right: 16px; }
    .split, .db { grid-template-columns: 1fr; height: auto; }
    .grid2, .grid3 { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
}

/* ---------- staff & permissions ---------- */
.staff-page { display: flex; flex-direction: column; }
.staff-tabs { margin-bottom: 14px; }
.staff-tabs .pill svg.i { width: 14px; height: 14px; }
.staff-body { flex: 1; min-height: 0; }
.staff-body > .split { height: 100%; }
.tag.blue { color: var(--blue); background: rgba(110,155,255,.08); border-color: rgba(110,155,255,.22); }
.tag svg.i { width: 12px; height: 12px; }
.rdot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; box-shadow: 0 0 0 3px rgba(255,255,255,.04); }
.card-h h3 { display: flex; align-items: center; gap: 9px; }
.li.sel { background: var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 6px 0 10px; border-radius: 999px; background: var(--s2); border: 1px solid var(--line2); font-size: 12.5px; }
.chip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--dim); }
.chip button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.chip button svg.i { width: 12px; height: 12px; }
.perm-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.perm-cat { border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--s2); }
.perm-cat-h { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px; }
.perm-cat-h b { font-weight: 600; font-size: 12.5px; }
.perm-cat-h .linkbtn { margin-left: auto; font-size: 11.5px; }
.perm { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.perm:hover { background: rgba(255,255,255,.03); }
.perm.ro { cursor: default; }
.perm input { position: absolute; opacity: 0; pointer-events: none; }
.perm .box { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line3); display: grid; place-items: center; flex-shrink: 0; transition: background .12s, border-color .12s; }
.perm .box svg.i { width: 12px; height: 12px; stroke-width: 3; color: var(--ink); opacity: 0; }
.perm input:checked + .box { background: var(--white); border-color: var(--white); }
.perm input:checked + .box svg.i { opacity: 1; }
.perm input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(255,255,255,.18); }
.perm input:disabled + .box { opacity: .55; }
.perm .pl { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.35; }
.perm code { font: 400 10.5px var(--mono); color: var(--faint); white-space: nowrap; }
.save-row { position: sticky; bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px; background: var(--s1); border-top: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); }
.matrix-wrap { max-height: calc(100vh - 300px); }
.matrix th, .matrix td { padding: 0; }
.matrix .pcol { position: sticky; left: 0; z-index: 2; background: var(--s1); padding: 8px 14px; min-width: 260px; }
.matrix thead .pcol { z-index: 3; }
.matrix td.pcol span { display: block; font-size: 12.5px; }
.matrix td.pcol code { font: 400 10.5px var(--mono); color: var(--faint); }
.matrix th.rcol { padding: 10px 8px; text-align: center; min-width: 92px; vertical-align: bottom; }
.matrix th.rcol .rdot { display: block; margin: 0 auto 6px; }
.matrix th.rcol .rl { display: block; color: var(--text); font-size: 12px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; margin: 0 auto; }
.matrix th.rcol small { display: block; color: var(--faint); font-size: 10.5px; margin-top: 2px; }
.matrix td.rcol { text-align: center; }
.matrix .perm.cell { justify-content: center; padding: 9px 0; border-radius: 0; }
.matrix tbody tr:hover td { background: rgba(255,255,255,.02); }
.matrix tbody tr:hover td.pcol { background: var(--s2); }
.matrix tr.cat td { padding: 14px 14px 6px; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); background: var(--s1); position: sticky; left: 0; }
select.in.rsel { height: 30px; width: auto; min-width: 150px; font-size: 12.5px; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 12px; line-height: 1.55; color: var(--muted); font-size: 13px; }
.steps b { color: var(--text); font-weight: 600; }
.steps .code { margin-top: 8px; }
@media (max-width: 860px) {
    .page-head { flex-wrap: wrap; }
    .page-head .actions { justify-content: flex-start; }
    .staff-body > .split { height: auto; }
    .matrix-wrap { max-height: none; }
    .matrix .pcol { min-width: 190px; }
    .perm-cats { grid-template-columns: 1fr; }
    .save-row { position: static; margin: 0; padding: 0; border: 0; background: none; }
}
