body.admin { overflow-x: hidden; }
body.admin .bg-glow { display: none; }

/* Login */
.a-login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(600px circle at 70% 20%, rgba(34,211,238,.10), transparent 60%), var(--bg); }
.a-login-card { width: min(400px, 100%); padding: 32px; border-radius: 22px; background: var(--card); border: 1px solid rgba(255,255,255,.1); }
.a-login-card img { border-radius: 14px; margin-bottom: 16px; }
.a-login-card h1 { font-size: 1.8rem; }

/* Shell */
.a-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.a-side, .a-main { min-width: 0; }
.a-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px; background: var(--bg2); border-right: 1px solid var(--stroke); }
.a-side nav { display: grid; gap: 4px; }
.a-side nav button { text-align: left; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: var(--muted); font: 500 .94rem var(--sans); cursor: pointer; }
.a-side nav button:hover { background: rgba(255,255,255,.04); color: var(--text); }
.a-side nav button.on { background: rgba(34,211,238,.12); color: var(--text); box-shadow: inset 3px 0 0 var(--cyan); }
.a-me { margin-top: auto; display: grid; gap: 6px; font-size: .82rem; color: var(--muted); word-break: break-all; }
.a-main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.a-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.a-head h1 { font-size: 1.7rem; margin-right: auto; }
.muted { color: var(--muted); } .small { font-size: .85rem; }

/* Cards & KPIs */
.a-card { padding: 22px; border-radius: 16px; background: var(--card); border: 1px solid var(--stroke); margin-bottom: 18px; min-width: 0; }
.a-card h3 { font-size: 1rem; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; border-radius: 14px; background: var(--card); border: 1px solid var(--stroke); position: relative; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--c, var(--cyan)); }
.kpi .v { font: 700 1.9rem var(--mono); line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.kpi .s { color: var(--ok); font-size: .78rem; margin-top: 2px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.charts .a-card { margin: 0; }
.chart svg { width: 100%; height: 160px; display: block; }
.chart .ax { fill: var(--muted); font: 10px var(--mono); }
.versions { display: grid; gap: 10px; }
.vbar { display: grid; grid-template-columns: 60px 1fr 40px; gap: 10px; align-items: center; font: .85rem var(--mono); }
.vbar i { height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--cyan), #a78bfa); }

/* Table */
.table-wrap { overflow-x: auto; padding: 0; position: relative; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; padding: 12px 14px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-family: var(--mono); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; }
.tag.ok { background: rgba(52,211,153,.14); color: var(--ok); }
.tag.off { background: rgba(248,113,113,.14); color: #f87171; }
.tag.adm { background: rgba(212,175,55,.16); color: var(--gold2); }
.tag.mute { background: rgba(255,255,255,.06); color: var(--muted); }
.act { display: flex; gap: 6px; }
.act button { padding: 4px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: none; color: var(--text); font: 500 .8rem var(--sans); cursor: pointer; }
.act button.danger { color: #f87171; border-color: rgba(248,113,113,.3); }
.search { height: 36px; min-width: 240px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.25); color: var(--text); font: 500 .9rem var(--sans); }
.empty { padding: 22px; color: var(--muted); }

/* Messages */
.msg-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.msg-grid .a-card { margin: 0 0 18px; }
textarea { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.25); color: var(--text); font: 500 .95rem/1.5 var(--sans); resize: vertical; }
textarea:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px rgba(34,211,238,.18); }
.channels { display: grid; gap: 10px; margin: 6px 0 12px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--stroke); background: rgba(0,0,0,.18); cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--cyan); width: 16px; height: 16px; }
.check small { display: block; color: var(--muted); font-size: .8rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ok { color: var(--ok); font-size: .88rem; min-height: 1.2em; }
.notif { display: flex; gap: 12px; padding: 14px; border-radius: 16px; background: rgba(60,62,68,.85); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 10px 30px rgba(0,0,0,.4); margin-bottom: 12px; }
.notif img { border-radius: 8px; flex: 0 0 34px; }
.notif b { font-size: .9rem; } .notif p { font-size: .85rem; color: #d4d5da; white-space: pre-wrap; word-break: break-word; }
.hist { display: grid; gap: 10px; }
.hitem { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 14px 16px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid var(--stroke); }
.hitem p { color: var(--muted); font-size: .88rem; grid-column: 1 / -1; white-space: pre-wrap; }
.hmeta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--muted); grid-column: 1 / -1; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 12px 18px; border-radius: 12px; background: var(--card2); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 20px 50px rgba(0,0,0,.5); z-index: 200; font-size: .92rem; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]:hover, .tbl th[data-sort]:focus-visible { color: var(--text); }
.tbl th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
.tbl th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: -6px 0 18px; }
.a-login-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: .88rem; }
.a-login-links .link:disabled { color: var(--muted); cursor: default; }
.hmeta .link { font-size: .8rem; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; z-index: 150; }
.overlay[hidden] { display: none; }
.dialog { width: min(520px, 100%); max-height: 80vh; overflow: auto; margin: 0; }
.dialog .a-head { margin-bottom: 12px; }
.dialog .a-head h3 { margin: 0 auto 0 0; font-size: 1.05rem; word-break: break-all; }
.mac { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--stroke); }
.mac small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }

@media (max-width: 900px) {
  .a-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .a-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; align-content: flex-start; padding: 12px 16px; }
  .a-side nav { display: flex; overflow-x: auto; gap: 4px; order: 3; width: 100%; }
  .a-side nav button { white-space: nowrap; }
  .a-me { margin: 0 0 0 auto; }
  .charts, .msg-grid { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1; }
  .a-side nav { min-width: 0; }
  .a-head h1 { font-size: 1.4rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 1.5rem; }
}
