:root {
	--bg: #16171d; --panel: #1d1e27; --panel-2: #23242f; --line: #2b2c38;
	--text: #e8e9f0; --muted: #8e90a3; --accent: #5865f2; --green: #3ddc97; --pink: #ec5b9b; --amber: #f0b232; --red: #ed4245;
	color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.sidebar { display: flex; flex-direction: column; width: 240px; flex: none; padding: 20px 14px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; padding: 0 10px 20px; }
.logo { width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover; border: 2px solid var(--panel); box-shadow: 0 0 0 2px var(--accent), 0 4px 14px #0008; transition: transform .25s ease; }
.brand:hover .logo { transform: rotate(-8deg) scale(1.06); }
nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; margin-bottom: 2px; border-radius: 8px; color: var(--muted); text-decoration: none; cursor: pointer; }
nav a .ico { display: inline-flex; width: 20px; height: 20px; justify-content: center; align-items: center; flex: none; font-size: 15px; line-height: 1; }
nav a .ico svg { width: 20px; height: 20px; }
nav a:hover .ico-chart-spline .draw { stroke-dasharray: 30; animation: draw .6s ease-out; }
nav a:hover .ico-wand-sparkles .wand { animation: wave .5s ease-in-out; transform-origin: 3px 21px; }
nav a:hover .ico-wand-sparkles .spark { animation: twinkle .6s ease-in-out; transform-box: fill-box; transform-origin: center; }
nav a:hover .ico-scroll-text .line { stroke-dasharray: 6; animation: write .45s ease-out backwards; }
nav a:hover .ico-scroll-text .l2 { animation-delay: .15s; }
nav a:hover .ico-scroll-text .scroll { animation: lift .5s ease-in-out; }
@keyframes write { from { stroke-dashoffset: 6; } to { stroke-dashoffset: 0; } }
@keyframes lift { 40% { transform: translateY(-1.2px); } }
nav a:hover .ico-hourglass .flip { animation: flip .6s ease-in-out; transform-box: view-box; transform-origin: 12px 12px; }
@keyframes flip { to { transform: rotate(180deg); } }
nav a:hover .ico-swords .sw { transform-box: view-box; transform-origin: 12px 12px; }
nav a:hover .ico-swords .a { animation: clash-a .55s ease-in-out; }
nav a:hover .ico-swords .b { animation: clash-b .55s ease-in-out; }
@keyframes clash-a { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(-12deg); } 60% { transform: rotate(3deg); } }
@keyframes clash-b { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(12deg); } 60% { transform: rotate(-3deg); } }
nav a:hover .ico-user-star .star { animation: pop .6s ease-in-out; transform-box: view-box; transform-origin: 18.4px 18px; }
@keyframes pop { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(72deg) scale(1.35); } }
/* Les animations (couvercle, étoile, épées…) peuvent dépasser du cadre 24x24 de l'icône. */
.ico svg { overflow: visible; }
button.icon .ico { display: inline-flex; vertical-align: middle; }
button.icon .ico svg { width: 18px; height: 18px; }
button.icon:hover .ico-square-pen .pen { animation: scribble .5s ease-in-out; }
@keyframes scribble { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-1.5px, 1px); } 50% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, .5px); } }
button.icon:hover .ico-trash .lid { animation: lid-open .45s ease-in-out forwards; transform-box: view-box; transform-origin: 4px 6px; }
@keyframes lid-open { to { transform: translateY(-1.5px) rotate(-16deg); } }
button.icon:hover .ico-log-out .arrow { animation: exit .45s ease-in-out; }
@keyframes exit { 50% { transform: translateX(3px); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-14deg); } 65% { transform: rotate(8deg); } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 40% { opacity: .15; } 70% { opacity: 1; } }
@keyframes draw { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { nav a:hover .ico .draw, nav a:hover .ico .wand, nav a:hover .ico .spark, nav a:hover .ico .line, nav a:hover .ico .scroll, nav a:hover .ico .flip, nav a:hover .ico .sw, nav a:hover .ico .star, button.icon:hover .ico .pen, button.icon:hover .ico .lid, button.icon:hover .ico .arrow { animation: none; } }
nav a:hover { background: var(--panel); color: var(--text); }
nav a.active { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #fff; }
nav a.soon { opacity: .45; cursor: default; }
nav a .tag { margin-left: auto; font-size: 11px; border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; }
main { flex: 1; min-width: 0; padding: 28px 36px 48px; max-width: 1200px; }
h1 { font-size: 28px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }
.stat { padding: 18px 22px; border-right: 1px solid var(--line); }
.stat:last-child { border: 0; }
.stat .label { color: var(--muted); font-size: 14px; }
.stat .value { font-size: 34px; font-weight: 700; display: inline-block; margin-right: 8px; }
.stat .delta { font-size: 12px; }
.delta.up { color: var(--green); } .delta.down { color: var(--pink); } .delta.flat { color: var(--amber); }
.chart { padding: 14px 18px 8px; margin-bottom: 18px; position: relative; }
.chart .plot { position: relative; }
.chart svg { width: 100%; height: 300px; display: block; }
.hover-dot { position: absolute; display: none; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; border: 2px solid var(--panel); pointer-events: none; }
.chart .tip { position: absolute; pointer-events: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; white-space: nowrap; display: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.msg { max-width: 560px; word-break: break-word; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #1b2540; color: #cdd6ff; }
.pill.moderator { background: #123324; color: var(--green); }
.pill.regular { background: #2d2a14; color: var(--amber); }
.pill.subscriber { background: #26183f; color: #c4a1ff; }
.pill.vip { background: #3a1730; color: #ff8fc7; }
.pill.broadcaster { background: #3a1818; color: #ff8a8a; }
.toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
input, textarea, select { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { font: inherit; border-radius: 8px; padding: 8px 16px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button.icon { padding: 4px 8px; background: transparent; border: 0; color: var(--muted); }
button.icon:hover { color: var(--text); }
button.icon.danger:hover { color: var(--red); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(560px, 92vw); }
dialog::backdrop { background: #000a; }
dialog h2 { margin: 0 0 14px; }
dialog label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
dialog label > * { margin-top: 4px; color: var(--text); font-size: 15px; }
.prefix { display: flex; align-items: center; gap: 8px; } .prefix span { color: var(--muted); }
.row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.error { color: var(--red); margin: 0 0 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 900px) { body { flex-direction: column; } .sidebar { width: auto; height: auto; position: static; } .stats, .grid2 { grid-template-columns: 1fr; } .stat { border-right: 0; border-bottom: 1px solid var(--line); } main { padding: 20px 16px; } }

.user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); }
.user img { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.user .who { min-width: 0; flex: 1; line-height: 1.25; }
.user .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .who span { color: var(--muted); font-size: 12px; }
.login-page { align-items: center; justify-content: center; }
.login { flex: none; width: min(420px, 92vw); padding: 36px 32px; text-align: center; }
.login .logo.big { width: 88px; height: 88px; margin-bottom: 14px; }
.login h1 { font-size: 26px; }
.login .error { margin: 0 0 16px; }
.twitch-btn { display: flex; align-items: center; justify-content: center; gap: 10px; line-height: 1; padding: 12px 18px; border-radius: 10px; background: #9146ff; color: #fff; font-weight: 700; text-decoration: none; margin: 8px 0 16px; }
.twitch-btn svg { display: block; flex: none; }
.twitch-btn:hover { background: #a36bff; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.filter { display: flex; flex-direction: column; }
.f-top { display: flex; gap: 16px; padding: 20px; flex: 1; }
.f-top h3 { margin: 0 0 4px; font-size: 16px; }
.f-top p { margin: 0; color: var(--muted); font-size: 14px; }
.f-icon { flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--panel-2); display: grid; place-items: center; color: var(--text); }
.f-icon .ico svg { width: 24px; height: 24px; display: block; }
.f-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--line); }
.f-actions { display: flex; gap: 8px; }
.sq { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); cursor: pointer; text-decoration: none; }
.sq:hover { border-color: var(--accent); }
.sq .ico svg { width: 18px; height: 18px; display: block; }
.sq:hover .ico-settings svg { transform: rotate(60deg); }
.sq .ico-settings svg { transition: transform .35s ease; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider { position: relative; width: 44px; height: 24px; border-radius: 99px; background: #3a3b4a; transition: background .2s; flex: none; }
.slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid #fff; outline-offset: 2px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 6px 3px 12px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; margin-bottom: 12px; }
.chip a { color: var(--muted); text-decoration: none; padding: 0 6px; }
.chip a:hover { color: var(--text); }
#filter-dialog textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .slider, .slider::after, .sq .ico-settings svg { transition: none; } }

.toolbar select { width: auto; min-width: 150px; }
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.search-box .ico svg { width: 17px; height: 17px; }
.search-box input { padding-left: 38px; }
.nowrap { white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.pager select { width: auto; }
.pager-info { color: var(--muted); font-size: 14px; }
.sq:disabled { opacity: .4; cursor: default; }
.sq:disabled:hover { border-color: var(--line); }

.toolbar button { white-space: nowrap; flex: none; }
.toolbar input { min-width: 0; }

/* Apparition du tableau de bord */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .55s cubic-bezier(.2, .7, .2, 1) backwards; }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }
