:root {
  --bg: #0d1117; --bg2: #131a24; --bg3: #1b2433; --line: #263247; --text: #e6edf3; --muted: #8b98a9;
  --accent: #5b8def; --accent2: #7ee0c3; --danger: #ef5350; --warn: #ffb74d; --ok: #66bb6a;
  --radius: 8px; --side: 260px; --panel: 400px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .error { color: var(--danger); min-height: 1.2em; }
button, .button, select, input, textarea {
  font: inherit; color: var(--text); background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
button, .button { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
button:hover, .button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.ok { background: transparent; border-color: var(--ok); color: var(--ok); }
button.ghost { background: transparent; }
button.small, .button.small { padding: 4px 8px; font-size: 12px; }
button.icon { background: transparent; border: none; font-size: 18px; padding: 4px 8px; }
input, textarea { width: 100%; } textarea { min-height: 90px; resize: vertical; }
label { display: block; margin: 6px 0; } label > span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
label.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
label.row > span { margin: 0; } label.row select { width: 130px; }
label.check { justify-content: flex-start; } label.check input { width: auto; }

.login { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, #1b2a48, var(--bg) 60%); }
.login-card { width: min(360px, 92vw); background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login-card button { width: 100%; justify-content: center; margin-top: 10px; }
.brand { font-weight: 700; letter-spacing: .08em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand.big { font-size: 22px; } .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 24px var(--accent2); }

.app { display: grid; height: 100vh; grid-template-columns: var(--side) 1fr auto; grid-template-rows: auto auto 1fr;
  grid-template-areas: "top top top" "bar bar bar" "side main panel"; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg2);
  border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tabs button { background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.search-wrap { position: relative; flex: 1; min-width: 160px; max-width: 460px; margin-left: auto; }
.search-results { position: absolute; top: 110%; left: 0; right: 0; z-index: 50; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); max-height: 60vh; overflow: auto; box-shadow: 0 10px 30px #0008; }
.search-results .hit { padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-results .hit:hover, .search-results .hit:focus { background: var(--bg3); }
.search-results .hit .extrait { color: var(--muted); font-size: 12px; }

.sidebar { grid-area: side; overflow: auto; padding: 10px 12px; border-right: 1px solid var(--line); background: var(--bg2); }
.sidebar h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px; }
.sidebar section > input { margin: 4px 0; } .sidebar #btn-apply { width: 100%; justify-content: center; margin-top: 6px; }
.checklist label { display: flex; align-items: center; gap: 6px; margin: 2px 0; font-size: 13px; }
.checklist input { width: auto; } .checklist .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.checklist.scroll { max-height: 220px; overflow: auto; }
.legend { display: grid; gap: 2px; font-size: 12px; } .legend div { display: flex; gap: 6px; align-items: center; }

.main { grid-area: main; position: relative; overflow: hidden; }
.view { display: none; height: 100%; overflow: auto; padding: 10px 14px; } .view.active { display: block; }
#view-graph { padding: 0; display: none; flex-direction: column; } #view-graph.active { display: flex; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cy { flex: 1; min-height: 300px; background: radial-gradient(circle at 50% 40%, #121c2c, var(--bg) 70%); }
.g3d { flex: 1; min-height: 300px; position: relative; overflow: hidden; background: #04060b; }
.g3d canvas { display: block; }
button.toggle { border-color: var(--accent2); color: var(--accent2); }
.banner { padding: 6px 12px; background: #2a3550; color: var(--accent2); font-size: 13px; }
.small-input { width: 200px; }

.panel { grid-area: panel; width: var(--panel); overflow: auto; border-left: 1px solid var(--line); background: var(--bg2); padding: 10px 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: 16px; margin: 6px 0; word-break: break-word; }
.panel h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 2px 8px; font-size: 12px; }
.kv .k { color: var(--muted); } .kv .v { word-break: break-word; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--bg3); border: 1px solid var(--line); font-size: 11px; margin: 1px; }
.st-validee { border-color: var(--ok); color: var(--ok); } .st-proposee { border-color: var(--warn); color: var(--warn); }
.st-contestee, .st-rejetee { border-color: var(--danger); color: var(--danger); } .st-obsolete { color: var(--muted); }
.rel { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.rel a, a.link { color: var(--accent); cursor: pointer; text-decoration: none; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.preview { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #000; }
.preview img, .preview video { max-width: 100%; display: block; margin: auto; } .preview audio { width: 100%; }
.preview iframe { width: 100%; height: 360px; border: 0; background: #fff; }
.frames { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; } .frames img { width: 100%; }
.warn-box { border: 1px solid var(--warn); color: var(--warn); border-radius: 6px; padding: 6px 8px; font-size: 12px; margin: 6px 0; }
pre.text { white-space: pre-wrap; max-height: 260px; overflow: auto; background: var(--bg); padding: 8px; border-radius: 6px; font-size: 12px; }
.meta-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 4px; margin: 3px 0; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table tr:hover td { background: var(--bg3); cursor: pointer; }
.dropzone { margin: 10px 0; padding: 26px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; color: var(--muted); }
.dropzone.over { border-color: var(--accent); color: var(--text); background: #5b8def14; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; }
.ask { display: flex; gap: 8px; margin-bottom: 10px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--accent);
  padding: 8px 14px; border-radius: 8px; z-index: 100; max-width: 90vw; }
dialog { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; width: min(480px, 94vw); }
dialog::backdrop { background: #0009; } .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.only-mobile { display: none; }

@media (max-width: 1100px) { :root { --panel: 340px; --side: 220px; } .tabs button { padding: 6px; } }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "top" "bar" "main"; }
  .bb-label { display: none; }
  .only-mobile { display: inline-flex; }
  .topbar { flex-wrap: wrap; } .tabs { order: 5; width: 100%; } .search-wrap { order: 4; max-width: none; flex-basis: 100%; margin-left: 0; min-width: 0; }
  html, body { overflow-x: hidden; }
  #whoami { display: none; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 82vw; max-width: 320px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px #000; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; z-index: 55; border-left: 0;
    border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -10px 30px #000a; }
  .small-input { width: 100%; }
}

/* ---------------------------------------------------------------- signature Djoe.ca (v3) */
:root { --djoe-cyan: #05c8ff; --djoe-blue: #0a74ea; }
.djoe-logo { display: block; height: 30px; width: auto; background: #fff; padding: 3px 7px; border-radius: 6px; }
.djoe-logo.big { height: 52px; padding: 5px 9px; border-radius: 7px; margin: 0 auto 14px; }
.login-card .brand.big { justify-content: center; margin-bottom: 6px; }
.center { text-align: center; } .msg { min-height: 1.2em; color: var(--accent2); }
.signature { position: fixed; bottom: 12px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 12px; }
.signature a { color: var(--djoe-cyan); text-decoration: none; font-weight: 600; }
.signature.side { position: static; margin-top: 18px; text-align: left; }
a.brand { text-decoration: none; }

/* ---------------------------------------------------------------- sélecteur de cerveau très visible et animé */
.brainbar { grid-area: bar; display: flex; align-items: center; gap: 10px; padding: 8px 12px; position: relative; overflow-x: auto;
  background: linear-gradient(90deg, #07172e, #0b2a52 40%, #06243f 70%, #07172e); background-size: 300% 100%;
  animation: bb-flow 14s ease-in-out infinite; border-bottom: 1px solid #12406f; }
.brainbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--djoe-cyan), var(--djoe-blue), transparent); background-size: 200% 100%;
  animation: bb-line 4s linear infinite; }
@keyframes bb-flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes bb-line { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.bb-label { color: var(--djoe-cyan); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; }
.bb-chips { display: flex; gap: 8px; }
.bb-chip { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 14px; font-weight: 600;
  background: #0d2240; border: 1px solid #1d4a7a; color: #cfe6ff; transition: transform .15s, box-shadow .2s, background .2s; white-space: nowrap; }
.bb-chip:hover { transform: translateY(-1px); border-color: var(--djoe-cyan); }
.bb-chip .n { font-size: 11px; opacity: .75; background: #ffffff1a; border-radius: 999px; padding: 1px 7px; }
.bb-chip.active { background: linear-gradient(90deg, var(--djoe-blue), var(--djoe-cyan)); color: #fff; border-color: transparent;
  box-shadow: 0 0 0 2px #05c8ff55, 0 0 22px #05c8ff88; animation: bb-pulse 2.6s ease-in-out infinite; }
@keyframes bb-pulse { 0%, 100% { box-shadow: 0 0 0 2px #05c8ff44, 0 0 14px #05c8ff66; } 50% { box-shadow: 0 0 0 3px #05c8ff88, 0 0 28px #05c8ffaa; } }
.bb-invites { background: #ffb74d; color: #1b1300; border: none; font-weight: 700; border-radius: 999px; animation: bb-pulse 1.6s infinite; }
@media (prefers-reduced-motion: reduce) { .brainbar, .brainbar::after, .bb-chip.active, .bb-invites { animation: none; } }
