:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a; --text: #e6e8ee; --muted: #8b93a7;
  --accent: #e5484d; --blue: #3b82f6; --green: #22c55e; --yellow: #eab308; --bubble-a: #232835; --bubble-b: #2b3a55;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: #7aa7ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
button, .btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font: inherit; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: #ff7b7f; }
button.small { padding: 2px 8px; font-size: 12px; }
input, select, textarea { background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; font: inherit; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
label { color: var(--muted); font-size: 12px; display: block; margin: 8px 0 3px; }
.error { color: #ff7b7f; margin-top: 8px; min-height: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.login { height: 100%; display: flex; align-items: center; justify-content: center; }
.login form { background: var(--panel); padding: 32px; border-radius: 12px; width: 320px; display: flex;
  flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 8px; font-size: 22px; }

.app { display: flex; height: 100%; }
.sidebar { width: 210px; background: var(--panel); border-right: 1px solid var(--line); display: flex;
  flex-direction: column; padding: 12px 8px; gap: 2px; flex-shrink: 0; }
.sidebar .brand { font-weight: 700; font-size: 17px; padding: 6px 10px 14px; }
.sidebar a { color: var(--text); padding: 8px 10px; border-radius: 6px; display: flex; justify-content: space-between; }
.sidebar a:hover { background: var(--panel2); text-decoration: none; }
.sidebar a.active { background: var(--panel2); color: #fff; }
.sidebar .logout { margin-top: auto; color: var(--muted); }
.badge { background: var(--panel2); border-radius: 10px; padding: 0 7px; font-size: 12px; color: var(--muted); }
.badge:empty { display: none; }
.badge.red { background: var(--accent); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #555; margin-left: 6px;
  vertical-align: middle; }
.dot.on { background: var(--green); }
main { flex: 1; overflow: auto; min-width: 0; }
.page { padding: 20px 24px; }
.page h2 { margin: 0 0 16px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .v { font-size: 22px; font-weight: 700; }
.card .k { color: var(--muted); font-size: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel2); }

.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; background: var(--panel2);
  border: 1px solid var(--line); margin-right: 3px; white-space: nowrap; }
.tag.prem { color: #c4a5ff; border-color: #6d4fc2; }
.tag.ban { color: #ff7b7f; border-color: #8a2d30; }
.tag.shadow { color: #f3c969; border-color: #7a6324; }
.tag.flirt { color: #ff8fb1; border-color: #7a2d4a; }
.tag.green { color: #6be59a; border-color: #23633c; }

/* live messenger */
.live { display: flex; height: 100%; }
.live .list { width: 340px; border-right: 1px solid var(--line); overflow-y: auto; flex-shrink: 0; }
.live .list .head { padding: 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg);
  z-index: 1; }
.dlg { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.dlg:hover { background: var(--panel); }
.dlg.active { background: var(--panel2); }
.dlg .names { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.dlg .last { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.dlg.flash { animation: flash 1s; }
@keyframes flash { from { background: #2b3a55; } to { background: transparent; } }
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat .top { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.chat .empty { margin: auto; color: var(--muted); }
.msg { max-width: 62%; padding: 7px 10px; border-radius: 12px; background: var(--bubble-a); align-self: flex-start;
  word-wrap: break-word; white-space: pre-wrap; position: relative; }
.msg.b { background: var(--bubble-b); align-self: flex-end; }
.msg.flagged { outline: 2px solid var(--accent); }
.msg.undelivered { opacity: .55; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 3px; text-align: right; }
.msg img, .msg video { max-width: 320px; max-height: 320px; border-radius: 8px; display: block; }
.msg img.sticker { max-width: 160px; background: none; }
.msg audio { width: 260px; }
.msg video.round { border-radius: 50%; width: 220px; height: 220px; object-fit: cover; }
.sys { align-self: center; color: var(--muted); font-size: 12px; padding: 4px 10px; background: var(--panel);
  border-radius: 10px; }

.pager { margin-top: 12px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 8px; z-index: 10; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.bars .bar { min-width: 0; }
.bars { padding-top: 16px; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; }
.kv div:nth-child(odd) { color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars .bar { flex: 1; background: var(--blue); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .bar span { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.bars-labels { display: flex; gap: 4px; }
.bars-labels div { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
