/* mod.mallairr.com — панель twitchmoderatorAI */
:root {
  --bg: #0d0d12;
  --bg2: #11111a;
  --panel: #16161f;
  --panel2: #1c1c28;
  --line: #262633;
  --line2: #33334a;
  --txt: #e9e9f2;
  --muted: #8d8da6;
  --muted2: #6a6a82;
  --acc: #a970ff;
  --acc2: #7b3fe4;
  --ban: #ff4d6a;
  --to: #ffb020;
  --nick: #3ddc97;
  --ai: #56a8ff;
  --ok: #3ddc97;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 14px;
}
:root[data-theme="light"] {
  --bg: #f6f6fb;
  --bg2: #eeeef6;
  --panel: #ffffff;
  --panel2: #f4f4fa;
  --line: #e3e3ee;
  --line2: #d2d2e2;
  --txt: #1a1a24;
  --muted: #6b6b83;
  --muted2: #8b8ba3;
  --acc: #7b3fe4;
  --acc2: #6429d6;
  --shadow: 0 8px 24px rgba(30,20,60,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acc); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--acc2); color: #fff; }

/* ─────────── страница входа ─────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(169,112,255,.18), transparent 60%),
    radial-gradient(700px 400px at 90% 110%, rgba(86,168,255,.12), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 34px 30px; box-shadow: var(--shadow); text-align: center;
}
.login-card .logo { width: 54px; height: 54px; margin: 0 auto 16px; }
.login-card h1 { margin: 0 0 6px; font-size: 21px; letter-spacing: -.2px; }
.login-card p { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.btn-twitch {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px 18px; border-radius: 11px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--acc), var(--acc2)); color: #fff;
  font-weight: 600; font-size: 15px; transition: transform .12s ease, filter .12s ease;
}
.btn-twitch:hover { filter: brightness(1.08); transform: translateY(-1px); }
.login-note { margin-top: 18px; font-size: 12px; color: var(--muted2); }
.login-err {
  margin-bottom: 18px; padding: 11px 14px; border-radius: 10px; font-size: 13px;
  background: rgba(255,77,106,.12); border: 1px solid rgba(255,77,106,.3); color: #ff8fa3;
}

/* ─────────── каркас ─────────── */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg2); border-right: 1px solid var(--line);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(140deg, var(--acc), var(--acc2));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px;
}
.brand b { font-size: 14.5px; letter-spacing: -.1px; display: block; }
.brand span { font-size: 11.5px; color: var(--muted2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 14px; transition: background .12s, color .12s;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; flex: 0 0 auto; }
.nav a:hover { background: var(--panel); color: var(--txt); }
.nav a.active { background: linear-gradient(90deg, rgba(169,112,255,.18), rgba(169,112,255,.05)); color: var(--txt); }
.nav a.active svg { color: var(--acc); opacity: 1; }
.nav-sep { margin: 14px 12px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted2); }
.side-foot { margin-top: 18px; padding: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(61,220,151,.16); }
.dot.off { background: var(--ban); box-shadow: 0 0 0 3px rgba(255,77,106,.16); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 26px;
  border-bottom: 1px solid var(--line); background: rgba(13,13,18,.72);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
:root[data-theme="light"] .topbar { background: rgba(255,255,255,.8); }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.topbar .sub { font-size: 12px; color: var(--muted2); margin-top: 1px; }
.spacer { flex: 1; }
.content { padding: 22px 26px 60px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.chip img { width: 22px; height: 22px; border-radius: 50%; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { color: var(--txt); border-color: var(--line2); }
.icon-btn svg { width: 16px; height: 16px; }

/* ─────────── элементы ─────────── */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g21 { grid-template-columns: 2fr 1fr; }
.g12 { grid-template-columns: 1fr 2fr; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; min-width: 0;
}
.card.pad0 { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-h .hint { font-size: 12px; color: var(--muted2); }

.kpi { position: relative; overflow: hidden; }
.kpi .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .foot { margin-top: 6px; font-size: 12px; color: var(--muted2); }
.kpi .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--acc); }
.kpi.ban .bar { background: var(--ban); } .kpi.to .bar { background: var(--to); }
.kpi.nick .bar { background: var(--nick); } .kpi.ai .bar { background: var(--ai); }
.delta { font-size: 12px; padding: 2px 7px; border-radius: 20px; font-weight: 600; }
.delta.up { background: rgba(255,77,106,.14); color: #ff8fa3; }
.delta.down { background: rgba(61,220,151,.14); color: var(--nick); }
.delta.flat { background: var(--panel2); color: var(--muted2); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.BAN { background: rgba(255,77,106,.13); color: #ff8fa3; border-color: rgba(255,77,106,.25); }
.badge.TIMEOUT { background: rgba(255,176,32,.13); color: #ffc964; border-color: rgba(255,176,32,.25); }
.badge.NICKBAN { background: rgba(61,220,151,.13); color: var(--nick); border-color: rgba(61,220,151,.25); }
.badge.pass { background: var(--panel2); color: var(--muted); border-color: var(--line); }
.badge.ai { background: rgba(86,168,255,.13); color: #8cc3ff; border-color: rgba(86,168,255,.25); }
.badge.live { background: rgba(255,77,106,.16); color: #ff8fa3; border-color: rgba(255,77,106,.35); }

table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
thead th {
  position: sticky; top: 0; background: var(--panel2); text-align: left; font-weight: 600;
  font-size: 12px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; z-index: 2;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--panel2); }
tbody tr.clickable { cursor: pointer; }
.t-wrap { max-height: 70vh; overflow: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 12.4px; color: var(--muted); white-space: nowrap; }
.msg { color: var(--txt); word-break: break-word; max-width: 640px; }
.reason { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
input[type="search"], input[type="text"], select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  outline: none; min-width: 120px;
}
input[type="search"] { min-width: 260px; }
input:focus, select:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(169,112,255,.14); }
.btn {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px;
  cursor: pointer; color: var(--muted); font-weight: 500;
}
.btn:hover { color: var(--txt); border-color: var(--line2); }
.btn.primary { background: linear-gradient(180deg, var(--acc), var(--acc2)); color: #fff; border: 0; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { background: transparent; border: 0; border-radius: 8px; padding: 6px 11px; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--panel2); color: var(--txt); box-shadow: inset 0 0 0 1px var(--line); }

.hbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-bottom: 9px; }
.hbar .track { position: relative; height: 26px; background: var(--panel2); border-radius: 7px; overflow: hidden; }
.hbar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(169,112,255,.55), rgba(169,112,255,.22)); }
.hbar .lbl { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 10px; font-size: 12.5px; gap: 8px; }
.hbar .lbl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .cnt { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 3px; font-size: 10px; color: var(--muted2); }
.heat .cell { aspect-ratio: 1; border-radius: 3px; background: var(--panel2); }
.heat .rl { display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; }
.heat .hl { text-align: center; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }

svg.chart { width: 100%; display: block; overflow: visible; }
svg.chart text { fill: var(--muted2); font-size: 10.5px; }
svg.chart .grid-line { stroke: var(--line); stroke-width: 1; }
svg.chart .hoverbar { fill: transparent; }
svg.chart .hoverbar:hover { fill: rgba(169,112,255,.08); }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--panel2);
  border: 1px solid var(--line2); border-radius: 10px; padding: 9px 11px; font-size: 12.4px;
  box-shadow: var(--shadow); opacity: 0; transition: opacity .1s; max-width: 260px;
}
.tooltip.on { opacity: 1; }
.tooltip b { display: block; margin-bottom: 4px; font-size: 12px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); }
.tooltip .row b { display: inline; color: var(--txt); font-weight: 600; }

.drawer-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .16s; z-index: 40;
}
.drawer-bg.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(860px, 96vw); background: var(--bg2);
  border-left: 1px solid var(--line); z-index: 41; transform: translateX(102%);
  transition: transform .2s ease; overflow-y: auto; padding: 22px 24px 60px;
}
.drawer.on { transform: none; }
.drawer-h { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.drawer-h h2 { margin: 0; font-size: 18px; }

.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.empty { padding: 40px; text-align: center; color: var(--muted2); }
.skeleton { background: linear-gradient(90deg, var(--panel2), var(--panel), var(--panel2)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sh { to { background-position: -200% 0; } }
.spin { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3, .g21, .g12, .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a span { display: none; }
  .nav-sep, .side-foot { display: none; }
  .content { padding: 16px 14px 50px; }
  .topbar { padding: 12px 14px; }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  input[type="search"] { min-width: 100%; }
}

/* ─────────── подпись проекта: лента модерации ─────────── */
.tape-wrap { position: relative; }
.tape-host { width: 100%; margin: 10px 0 6px; }
svg.tape-svg { display: block; width: 100%; }
svg.tape-svg .hoverbar { fill: transparent; }
svg.tape-svg .hoverbar:hover { fill: rgba(169,112,255,.10); }
.tape-axis {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 11px; color: var(--muted2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.tape-peak { color: var(--muted2); opacity: .8; }
.tape-lead {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 2px;
}
.tape-lead .big {
  font-size: 34px; font-weight: 700; letter-spacing: -1.2px; font-variant-numeric: tabular-nums;
}
.tape-lead .cap {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted2);
}

/* ─────────── строка чата с вердиктом ─────────── */
.line { display: grid; grid-template-columns: 92px auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .stamp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; padding: 3px 7px; border-radius: 6px; text-align: center; height: fit-content;
  border: 1px solid transparent; white-space: nowrap;
}
.line .stamp.BAN { background: rgba(255,84,112,.12); color: #ff8fa3; border-color: rgba(255,84,112,.28); }
.line .stamp.TIMEOUT { background: rgba(242,163,60,.12); color: #f3bb70; border-color: rgba(242,163,60,.26); }
.line .stamp.NICKBAN { background: rgba(53,208,165,.12); color: var(--nick); border-color: rgba(53,208,165,.26); }
.line .stamp.pass { background: var(--panel2); color: var(--muted2); border-color: var(--line); }
.line .body { min-width: 0; }
.line .txt { word-break: break-word; white-space: pre-wrap; }
.line .meta {
  margin-top: 3px; font-size: 12px; color: var(--muted2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  display: flex; gap: 10px; flex-wrap: wrap;
}
.line .meta .why { color: var(--muted); }

.eyebrow {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted2);
  margin-bottom: 10px;
}
.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline div { display: flex; flex-direction: column; gap: 2px; }
.stat-inline .v { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-inline .k { font-size: 11.5px; color: var(--muted2); }
.livebar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px;
  border-radius: var(--radius); border: 1px solid rgba(255,84,112,.3);
  background: linear-gradient(90deg, rgba(255,84,112,.12), transparent 70%);
}
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ban); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,84,112,.6); } 70% { box-shadow: 0 0 0 9px rgba(255,84,112,0); } 100% { box-shadow: 0 0 0 0 rgba(255,84,112,0); } }
@media (prefers-reduced-motion: reduce) { .pulse, .spin, .skeleton { animation: none; } * { transition: none !important; } }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }

.line .meta .nick, td.nick a { color: var(--acc); }
td.nick a:hover { text-decoration: underline; }
td.nick .muted { color: var(--muted2); }

/* ─────────── экран списков ─────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px;
  border-radius: 9px; background: var(--panel2); border: 1px solid var(--line);
  font-size: 13.5px; max-width: 100%;
}
.chip-item:hover { border-color: var(--line2); }
.chip-item .val { cursor: text; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.chip-item .val:hover { color: var(--acc); }
.chip-item input {
  background: var(--bg); border: 1px solid var(--acc); border-radius: 6px;
  padding: 2px 6px; min-width: 120px; font-size: 13.5px;
}
.chip-item .x {
  border: 0; background: transparent; color: var(--muted2); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 5px;
}
.chip-item .x:hover { color: var(--ban); background: rgba(255,84,112,.12); }
.chip-item.busy { opacity: .5; pointer-events: none; }
.chip-item.fresh { border-color: var(--nick); box-shadow: 0 0 0 3px rgba(53,208,165,.12); }

.banner {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px; margin-bottom: 16px;
  border-radius: var(--radius); font-size: 13.4px; line-height: 1.45;
}
.banner.warn { background: rgba(242,163,60,.10); border: 1px solid rgba(242,163,60,.3); color: #f3bb70; }
.banner.ok { background: rgba(53,208,165,.10); border: 1px solid rgba(53,208,165,.28); color: #6fe0bd; }
.banner b { color: var(--txt); }
.banner .ico { font-size: 15px; line-height: 1.3; }
.list-hint { color: var(--muted); font-size: 13px; margin-bottom: 14px; max-width: 720px; }
.seg.wrap { flex-wrap: wrap; }
.seg button .n { color: var(--muted2); font-variant-numeric: tabular-nums; margin-left: 6px; }
