:root {
  --dash-bg: #080a10;
  --dash-rail: #0c0e16;
  --dash-card: #12151f;
  --dash-card-2: #161a26;
  --dash-line: rgba(255, 255, 255, 0.06);
  --dash-ink: #eef0f6;
  --dash-muted: #8b93a7;
  --dash-purple: #7c6cf0;
  --dash-blue: #3d7bff;
  --dash-green: #3dd68c;
  --dash-gold: #e0b03a;
  --dash-pink: #d45b8c;
  --dash-sans: "Sora", "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--dash-ink);
  font-family: var(--dash-sans);
  background: var(--dash-bg);
}

button, input, textarea { font: inherit; }

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(700px 320px at 80% -10%, rgba(124, 108, 240, 0.16), transparent 58%),
    var(--dash-bg);
}

.admin-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border-radius: 20px;
  background: var(--dash-card);
  border: 1px solid var(--dash-line);
}

.admin-card img {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  object-fit: cover;
}

.admin-kicker {
  margin: 0;
  color: var(--dash-purple);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.admin-card h1,
.admin-panel h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.admin-note,
.admin-lead {
  margin: 0;
  color: var(--dash-muted);
  font-size: 14px;
  line-height: 1.5;
}

.admin-card label,
.admin-panel label:not(.admin-check):not(.switch) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-card input,
.admin-panel input,
.admin-panel textarea,
.admin-panel select {
  width: 100%;
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  background: #0b0d14;
  color: var(--dash-ink);
  font-size: 15px;
  padding: 12px 14px;
}

.admin-panel .switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  background: transparent;
}

.admin-panel textarea { resize: vertical; min-height: 96px; }

.admin-status { min-height: 1.3em; margin: 0; color: var(--dash-green); font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--dash-ink);
  background: var(--dash-card-2);
}

.btn-primary {
  color: white;
  background: linear-gradient(180deg, #5b8dff, var(--dash-blue));
}

.btn-ghost {
  border-color: var(--dash-line);
  background: #10131c;
}

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

.admin-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px;
  background: var(--dash-rail);
  border-right: 1px solid var(--dash-line);
}

.admin-nav img {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 10px;
}

.admin-nav nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.nav-split {
  display: block;
  height: 1px;
  margin: 8px 12px;
  background: var(--dash-line);
}

.admin-nav button[data-cat] {
  position: relative;
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--dash-muted);
  cursor: pointer;
}

.admin-nav button[data-cat] svg {
  width: 20px;
  height: 20px;
  display: block;
  margin: 0 auto;
}

.admin-nav button[data-cat]:hover { color: white; background: rgba(255, 255, 255, 0.04); }

.admin-nav button[data-cat].is-on {
  color: white;
  background: rgba(124, 108, 240, 0.16);
}

.admin-nav button[data-cat].is-on::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 99px;
  background: var(--dash-purple);
}

.admin-logout {
  margin-top: auto;
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--dash-muted);
  cursor: pointer;
}

.admin-logout:hover { color: white; }

.admin-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px 8px;
}

.admin-top h1 { font-size: 30px; letter-spacing: -0.04em; }

.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.dash-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--dash-line);
  background: var(--dash-card);
  color: var(--dash-muted);
  font-size: 13px;
  font-weight: 600;
}

.dash-pill.is-on { color: var(--dash-green); }
.dash-pill.is-off { color: #ff6b7d; }
.dash-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.admin-main { padding: 16px 32px 40px; }

.admin-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  max-width: 1080px;
  width: 100%;
}

.admin-panel.is-on { display: flex; }

.admin-panel[data-panel="dashboard"] {
  max-width: none;
}

.admin-panel > h1,
.admin-panel > .admin-kicker { display: none; }

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.95fr);
  gap: 16px;
}

.dash-grid .chart-card:nth-of-type(2),
.dash-grid .chart-card:nth-of-type(3) {
  min-width: 0;
}

.dash-feed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  padding: 18px 18px 8px;
  border-radius: 18px;
  background: var(--dash-card);
  border: 1px solid var(--dash-line);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.chart-head p {
  margin: 0;
  color: var(--dash-muted);
  font-size: 14px;
  font-weight: 600;
}

.chart-tabs { display: flex; gap: 6px; }

.chart-tabs button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chart-tabs button.is-on {
  color: white;
  background: var(--dash-blue);
}

.chart-wrap { position: relative; }

.chart-card canvas { width: 100%; height: 200px; display: block; }
#chart-messages { height: 240px; }

.chart-tip {
  position: absolute;
  z-index: 3;
  min-width: 92px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #161a26;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.chart-tip small {
  display: block;
  color: var(--dash-muted);
  font-size: 11px;
}

.chart-foot {
  margin: 6px 0 8px;
  color: var(--dash-muted);
  font-size: 12px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card,
.info-card,
.form-card {
  border-radius: 18px;
  background: var(--dash-card);
  border: 1px solid var(--dash-line);
}

.stat-card { padding: 20px; }

.stat-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  margin-bottom: 18px;
}

.stat-icon.purple { background: rgba(124, 108, 240, 0.16); color: var(--dash-purple); }
.stat-icon.gold { background: rgba(224, 176, 58, 0.14); color: var(--dash-gold); }
.stat-icon.pink { background: rgba(212, 91, 140, 0.14); color: var(--dash-pink); }

.stat-card strong {
  display: block;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.stat-card span { color: var(--dash-muted); font-size: 14px; }

.info-card { padding: 0; overflow: hidden; }

.info-banner {
  height: 118px;
  background: linear-gradient(135deg, #5b4fe0, #7c6cf0 55%, #3d7bff);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
}

.info-banner img {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.info-body { padding: 20px; }

.info-body h2 { margin: 0 0 4px; font-size: 20px; }

.info-meta { margin: 0 0 18px; color: var(--dash-muted); font-size: 13px; }

.info-rows { margin: 0; display: grid; gap: 10px; }

.info-rows div {
  display: flex;
  justify-content: space-between;
  color: var(--dash-muted);
  font-size: 14px;
}

.info-rows b { color: var(--dash-ink); font-weight: 600; }

.form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
}

.form-card h2 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }

.form-card .admin-kicker { margin: 0; }

.site-save {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  position: sticky;
  bottom: 16px;
}

.admin-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dash-ink);
  font-size: 15px;
}

.admin-check input { width: auto; }

.admin-sub {
  margin: 8px 0 0;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.member-list { display: grid; gap: 10px; }

.member-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.1fr auto;
  gap: 8px;
  align-items: center;
}

.member-row.is-fixed { grid-template-columns: 1.2fr 1fr 1.1fr; }

.member-remove {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 80, 100, 0.3);
  border-radius: 12px;
  background: transparent;
  color: #ff8da0;
  cursor: pointer;
}

.admin-add { align-self: flex-start; }

.welcome-preview {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--dash-line);
}

.react-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
  align-items: center;
}

.react-row span {
  color: var(--dash-muted);
  font-size: 14px;
}

.hit-row {
  width: 100%;
  text-align: left;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--dash-line);
  background: #0b0d14;
  color: var(--dash-ink);
  cursor: pointer;
}

.hit-row:hover { border-color: var(--dash-purple); }

.staff-slot { padding: 16px; }

#level-rewards .react-row {
  grid-template-columns: 110px 1fr auto;
}

#bday-list .react-row {
  grid-template-columns: 1fr auto;
}

.grant-row {
  display: grid;
  grid-template-columns: 1.4fr 110px auto;
  gap: 8px;
  align-items: center;
}

.bday-add {
  grid-template-columns: 1.4fr 72px 72px 110px auto;
}

.alert-lookup {
  grid-template-columns: 1fr auto;
}

.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #171a24;
  border: 1px solid var(--dash-line);
}

.account-card.is-ok {
  border-color: rgba(61, 214, 140, 0.45);
}

.account-card img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #0c0e16;
}

.account-card strong {
  display: block;
  font-size: 15px;
}

.account-card small {
  color: var(--dash-muted);
}

.account-card > div { flex: 1; min-width: 0; }

.account-x {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dash-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.account-x:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

.poll-duration {
  grid-template-columns: 110px 1fr;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 7, 12, 0.72);
}

.admin-modal[hidden] { display: none !important; }

.admin-modal-card {
  width: min(520px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border-radius: 20px;
  background: var(--dash-card);
  border: 1px solid var(--dash-line);
}

.admin-modal-card h2 { margin: 0; font-size: 22px; }

#poll-choices .react-row {
  grid-template-columns: 1fr auto;
}

.admin-panel[data-panel="games"] { max-width: none; }

.mod-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mod-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 188px;
  padding: 18px;
  border-radius: 18px;
  background: var(--dash-card);
  border: 1px solid var(--dash-line);
}

.mod-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mod-kicker {
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 600;
}

.mod-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dash-green);
  background: rgba(61, 214, 140, 0.12);
}

.mod-badge.is-off {
  color: #ff8da0;
  background: rgba(255, 107, 125, 0.12);
}

.mod-card h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.mod-card p {
  margin: 0;
  flex: 1;
  color: var(--dash-muted);
  font-size: 13px;
  line-height: 1.45;
}

.mod-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.switch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #2a3040;
  transition: background 0.15s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s ease;
}

.switch input:checked + span { background: var(--dash-blue); }
.switch input:checked + span::after { transform: translateX(20px); }

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-actions .btn { min-height: 40px; }

.bot-console {
  margin: 0;
  max-height: min(62vh, 640px);
  overflow: auto;
  padding: 16px 18px;
  border-radius: 14px;
  background: #07080d;
  border: 1px solid var(--dash-line);
  color: #c8d0e0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.bot-console .console-line { display: block; }
.bot-console .console-line time {
  color: var(--dash-muted);
  margin-right: 10px;
}
.bot-console .console-line[data-level="log"] { color: #9ad4c0; }
.bot-console .console-line[data-level="info"] { color: #7eb6ff; }
.bot-console .console-line[data-level="warn"] { color: var(--dash-gold); }
.bot-console .console-line[data-level="error"] { color: #ff6b7d; }

.bot-soon {
  padding: 28px;
  border-radius: 18px;
  background: var(--dash-card);
  border: 1px dashed rgba(124, 108, 240, 0.35);
}

.bot-soon h2 { margin: 0 0 8px; font-size: 18px; }

.bot-soon p { margin: 0; color: var(--dash-muted); max-width: 52ch; }

.log-line,
.roster-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--dash-line);
  background: #0b0d14;
  color: inherit;
  text-align: left;
}

.roster-row {
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.roster-row img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.roster-row small,
.log-line small { color: var(--dash-muted); font-size: 12px; }

.log-line p {
  margin: 4px 0 0;
  color: var(--dash-muted);
  font-size: 13px;
  line-height: 1.4;
}

.role-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--dash-line);
  background: #0b0d14;
  font-size: 13px;
}

.role-chip button {
  border: 0;
  background: transparent;
  color: var(--dash-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.member-sheet { width: min(720px, 100%); }

.member-sheet-top {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
}

.member-sheet-top img {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  object-fit: cover;
}

.transcript-sheet { width: min(980px, 100%); height: min(90vh, 860px); }

.transcript-sheet iframe {
  width: 100%;
  flex: 1;
  min-height: 520px;
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  background: #fff;
}

@media (max-width: 1280px) {
  .dash-stats { grid-template-columns: repeat(3, 1fr); }
  .mod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .dash-grid,
  .dash-feed,
  .dash-stats,
  .mod-grid,
  .member-row,
  .member-row.is-fixed,
  .react-row,
  .grant-row,
  .bday-add,
  #level-rewards .react-row { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid var(--dash-line);
  }
  .admin-nav nav { flex-direction: row; width: auto; }
  .nav-split {
    width: 1px;
    height: 24px;
    margin: 10px 6px;
  }
  .admin-nav button[data-cat].is-on::before { display: none; }
  .admin-logout { margin-top: 0; width: auto; padding: 0 12px; }
  .admin-top,
  .admin-main { padding-left: 18px; padding-right: 18px; }
}
