:root {
  --bg: #121214;
  --bg-2: #1a1a1e;
  --side: #0e0e10;
  --card: #1e1f22;
  --card-2: #2b2d31;
  --line: rgba(255, 255, 255, 0.06);
  --text: #f2f3f5;
  --muted: #b5bac1;
  --accent: #ed4245;
  --accent-2: #f23f43;
  --gold: #fee75c;
  --mint: #23a559;
  --blue: #5865f2;
  --danger: #f23f43;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Figtree, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: #fb8181; text-decoration: none; }
h1, h2, strong { font-family: "Bricolage Grotesque", Figtree, sans-serif; }
h1 { margin: 0; font-size: 1.55rem; letter-spacing: -0.03em; }
h2 { margin: 0; font-size: 1rem; }
p { margin: 0; }

.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--side);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.icon-btn {
  border: 0;
  background: var(--card-2);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
}
.scrim.on { display: block; }

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  background: var(--side);
  border-right: 1px solid var(--line);
}

.brand, .brand.big {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand strong, .brand.big strong { display: block; font-size: 1.05rem; }
.brand small, .brand.big small { color: var(--muted); font-size: 0.78rem; }

.mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
}

nav { display: grid; gap: 2px; }
.nav-label {
  margin: 12px 10px 4px;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #87898c;
}
nav a {
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
nav a.on, nav a:hover {
  background: rgba(237, 66, 69, 0.14);
  color: var(--text);
}
.nav-count {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  min-width: 20px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.who { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.who-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.who button, .linkish, .btn, select, input, textarea { font: inherit; }
.who button, .linkish {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
}
.linkish.danger { color: var(--danger); }
[data-sound] {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  text-align: left;
  padding: 6px 10px;
  border-radius: 999px;
  width: fit-content;
}

.main { padding: 28px 32px 48px; display: grid; gap: 18px; align-content: start; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 14px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; }
.muted { color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.stats article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stats span { color: var(--muted); font-size: 0.8rem; }
.stats strong { display: block; margin-top: 4px; font-size: 1.7rem; }

.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 12px; }
.stack { display: grid; gap: 10px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.9rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { resize: vertical; }

.search {
  display: flex;
  gap: 8px;
  min-width: min(380px, 100%);
}
.search input { flex: 1; }

.btn {
  border: 0;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 14px;
  white-space: nowrap;
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 0.94rem; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.row-actions { display: flex; gap: 12px; }

.pill, .badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge { color: #111; background: var(--c, var(--accent)); }
.bot-badge { --c: #7ec8ff; }
.pill.aberto { background: rgba(35, 165, 89, 0.18); color: #3ba55d; }
.pill.pendente { background: rgba(254, 231, 92, 0.14); color: var(--gold); }
.pill.fechado { background: rgba(148, 155, 165, 0.16); color: var(--muted); }
.pill.ban { background: rgba(237, 66, 69, 0.18); color: #f87171; }
.pill.mute { background: rgba(254, 231, 92, 0.14); color: var(--gold); }
.pill.proxy { background: rgba(88, 101, 242, 0.18); color: #a5b4fc; }
.pill.kick { background: rgba(251, 146, 60, 0.16); color: #fdba74; }

.ticket-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ticket-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  color: var(--text);
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-2);
}
.ticket-list a:hover { background: var(--card-2); }
.ticket-list.compact a { padding: 9px 10px; }
.ticket-sub { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ticket-id {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ticket-sub small { font-weight: 400; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(237, 66, 69, 0.2);
  color: #fecaca;
  font-weight: 800;
  flex-shrink: 0;
}
.avatar.live { background: rgba(35, 165, 89, 0.2); color: #86efac; }
.avatar.bot { background: rgba(88, 101, 242, 0.2); color: #a5b4fc; }

.log-card {
  display: grid;
  gap: 10px;
}
.log-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.log-meta div {
  background: var(--bg-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.log-meta span { display: block; color: var(--muted); font-size: 0.75rem; margin-bottom: 4px; }
.log-meta strong { font-size: 0.95rem; word-break: break-word; }

.thread {
  display: grid;
  gap: 2px;
  background: #313338;
  border-radius: 12px;
  padding: 8px;
}
.bubble {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
}
.bubble:hover { background: rgba(255, 255, 255, 0.03); }
.bubble header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.bubble-body {
  white-space: pre-wrap;
  line-height: 1.5;
  overflow-wrap: anywhere;
  color: #dbdee1;
}
.thread-end {
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(237, 66, 69, 0.12);
  color: #fca5a5;
  text-align: center;
}

.punish-grid, .ac-grid {
  display: grid;
  gap: 10px;
}
.punish-card, .ac-card, .bug-card {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
  border-left: 3px solid var(--accent);
}
.ac-card { border-left-color: #f87171; }
.bug-card { border-left-color: var(--gold); }
.punish-fields, .ac-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.field span { display: block; color: var(--muted); font-size: 0.72rem; margin-bottom: 3px; }
.field strong { word-break: break-word; font-size: 0.92rem; }
.punish-head, .ac-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.rank-list { display: grid; gap: 8px; }
.rank-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg-2);
  border-radius: 12px;
  padding: 12px 14px;
}
.rank-row.compact { padding: 9px 10px; grid-template-columns: 40px 1fr; }
.rank-pos { font-size: 1.2rem; font-weight: 800; }
.rank-pos.gold { color: var(--gold); }
.rank-pos.silver { color: #d3d6db; }
.rank-pos.bronze { color: #c47a3a; }
.rank-stats { color: var(--muted); font-size: 0.86rem; }

.d-emoji { width: 1.3em; height: 1.3em; vertical-align: middle; }
.d-mention {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(88, 101, 242, 0.3);
  color: #c7d2fe;
  font-weight: 600;
}
.feed-meta { color: var(--muted); font-size: 0.84rem; }

.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.role-card { border-top: 3px solid var(--c); }
.role-card ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); }
.rule-body { white-space: pre-wrap; color: var(--muted); line-height: 1.55; }

.flash { padding: 11px 12px; border-radius: 10px; margin: 0; }
.flash.ok { background: rgba(35, 165, 89, 0.14); color: #86efac; }
.flash.error { background: rgba(237, 66, 69, 0.16); color: #fca5a5; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(600px 280px at 50% 0%, rgba(237, 66, 69, 0.2), transparent 60%), var(--bg);
}
.login-card {
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  gap: 16px;
}
.login-card .btn { width: 100%; text-align: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    z-index: 40;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    overflow: auto;
  }
  .side.open { transform: none; }
  .main { padding: 16px 14px 36px; }
  .stats, .grid-2, .role-grid, .punish-fields, .ac-fields { grid-template-columns: 1fr 1fr; }
  .search { width: 100%; min-width: 0; }
  .ticket-list a { grid-template-columns: auto 1fr; }
  .ticket-list a .pill { grid-column: 2; justify-self: start; }
}

@media (max-width: 560px) {
  .stats, .punish-fields, .ac-fields, .rank-row, .grid-2, .role-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
  .page-head { align-items: start; }
}
