:root {
  --bg: #0b0d12;
  --sidebar: #0e1116;
  --card: #141820;
  --card-2: #10141a;
  --line: rgba(255, 255, 255, 0.055);
  --text: #f2f4f8;
  --muted: #8b93a3;
  --faint: #6c7486;
  --blue: #3b82f6;
  --blue-deep: #2f62d6;
  --green: #3dd68c;
  --red: #ff5d6c;
  --purple: #a78bfa;
  --shadow: none;
  --radius: 14px;
  --top: 0px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

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

body {
  font-family: Inter, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; color: inherit; }

input, select, textarea { color-scheme: dark; }

button { cursor: pointer; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.login {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0b0d12;
}

.login[hidden] { display: none; }

.login-card {
  width: min(420px, 100%);
  background: #141820;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 28px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.login-card > p { margin: -6px 0 0; color: var(--muted); }

.login-error { margin: 0; color: var(--red); font-size: 13px; }

body.locked .shell,
body.locked .menu-btn,
body.locked .toast { display: none; }

.logout {
  margin-top: auto;
  width: 100%;
  background: transparent;
  text-align: left;
}

.menu-btn {
  display: none;
  position: fixed;
  z-index: 60;
  top: 14px;
  left: 14px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #141820;
  color: white;
  align-items: center;
  justify-content: center;
}

.menu-btn svg { width: 20px; height: 20px; }

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

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 22px 14px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.os-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 12px 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.os-brand svg { width: 18px; height: 18px; color: #d5dbea; }

.side-label {
  margin: 14px 12px 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--faint);
  font-weight: 700;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 10px;
  color: #b7c0d0;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 550;
}

.side-link svg { width: 18px; height: 18px; flex: 0 0 auto; }

.side-link:hover { background: rgba(255, 255, 255, 0.04); color: white; }

.side-link.active {
  background: #2f6bff;
  color: white;
}

.side-foot {
  margin-top: auto;
  padding: 14px 12px 4px;
  color: var(--faint);
  font-size: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #243049;
  font-size: 12px;
  font-weight: 800;
}

.user-chip strong { display: block; font-size: 13px; color: var(--text); }
.user-chip span { color: var(--faint); font-size: 11px; }

.backdrop {
  display: none;
}

main {
  padding: 22px 26px 48px;
  min-width: 0;
}

.view-in { animation: rise 0.22s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.head h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.head-dash {
  align-items: center;
  margin-bottom: 16px;
}

.head-dash h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.head-dash p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}

.head-dash h1 svg { width: 18px; height: 18px; }

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status, .pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d5dbe6;
  font-size: 13px;
  font-weight: 500;
}

.status { background: none; border: 0; padding: 0 2px; }

.pill {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #12161e;
  border: 1px solid var(--line);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.dot.on { background: var(--green); }

.pill svg { width: 14px; height: 14px; }
.pill.good { color: var(--green); }
.pill.warn { color: #fbbf24; }

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.action {
  text-decoration: none;
  min-height: 148px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #161a22;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-weight: 600;
  font-size: 15px;
}

.action svg { width: 28px; height: 28px; stroke: #e8edf7; }

.action:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: #1b202a;
}

.action:disabled { opacity: 0.55; cursor: wait; }

.charts, .split, .modules, .stats {
  display: grid;
  gap: 14px;
}

.charts { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.split { grid-template-columns: 1.15fr 0.85fr; margin-top: 14px; }
.modules { grid-template-columns: repeat(3, 1fr); }
.stats { grid-template-columns: repeat(4, 1fr); margin-top: 8px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  min-width: 0;
}

.card h2, .card h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.chart-title, .card-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dbe2ef;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.mini {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, 0.15);
  color: #7cb0ff;
}

.mini svg { width: 13px; height: 13px; }
.mini.green { background: rgba(52, 211, 153, 0.14); color: var(--green); }
.mini.purple { background: rgba(167, 139, 250, 0.14); color: var(--purple); }
.mini.pink { background: rgba(255, 61, 136, 0.14); color: #fb7185; }

.chart-card canvas {
  width: 100%;
  height: 180px;
  display: block;
  margin-top: 8px;
}

.chart-note {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 12px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.kv:last-child { border-bottom: 0; padding-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 650; text-align: right; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; color: #c5d0e4; }

.server-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.server-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(145deg, #31405f, #1b2436);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.server-head h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.meta span { display: inline-flex; align-items: center; gap: 6px; }
.meta svg { width: 15px; height: 15px; }

.tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.activity-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.activity-top p { margin: 4px 0 0; color: var(--faint); font-size: 13px; }

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.stat span { color: var(--muted); font-size: 13px; }
.delta { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); font-weight: 600; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  flex-wrap: wrap;
}

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

.chip, .seg button, .btn, .btn-ghost {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: #1a2130;
  color: #d5dbe8;
  font-weight: 650;
  font-size: 13.5px;
}

.chip.on, .seg button.on {
  background: var(--blue-deep);
  color: white;
}

.chip:disabled { opacity: 0.4; cursor: default; }

.search, .field input, .field select, .field textarea, .inline-input,
.filters input, .filters select {
  width: 100%;
  background: var(--card-2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  color: var(--text);
}

.search { width: min(280px, 100%); padding: 10px 12px; }

.field input:focus, .field select:focus, .field textarea:focus, .search:focus, .inline-input:focus {
  border-color: rgba(59, 130, 246, 0.8);
}

.module {
  position: relative;
  min-height: 196px;
  padding: 16px;
  border-radius: 16px;
  background:
    radial-gradient(120px 80px at 100% 100%, rgba(59, 130, 246, 0.08), transparent 70%),
    var(--card);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.mod-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(59, 130, 246, 0.12);
  color: #9ec1ff;
}

.mod-icon svg { width: 18px; height: 18px; }

.status-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 999px;
}

.status-pill.on { color: var(--green); background: rgba(52, 211, 153, 0.12); }
.status-pill.off { color: #9aa3b5; background: rgba(255, 255, 255, 0.05); }

.module h3 { margin: 4px 0 0; font-size: 16px; letter-spacing: -0.03em; }
.module p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; flex: 1; }

.btn {
  background: var(--blue-deep);
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
}

.btn:hover { filter: brightness(1.08); }

.btn-ghost {
  background: #1a2130;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: #2a3142;
  position: relative;
  flex: 0 0 auto;
}

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

.switch.on { background: var(--blue); }
.switch.on::after { left: 21px; }

.filters {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.filters label, .field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.filters label span, .field > span, .hint { color: var(--muted); font-weight: 600; }

.hint { display: block; margin-top: -2px; font-size: 12.5px; font-weight: 500; }

.log-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

.log {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #10151f;
  border: 1px solid var(--line);
}

.log-main { min-width: 0; }

.log-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.src {
  font-size: 12px;
  font-weight: 800;
  color: #dbe7ff;
  background: #24365c;
  border-radius: 8px;
  padding: 3px 8px;
}

.src.discord { background: #3b2d62; }
.src.bot { background: #1e3d45; }
.src.tickets { background: #3a3350; }

.log time, .count {
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
}

.log p { margin: 6px 0 0; }
.log .detail {
  margin-top: 4px;
  color: #aeb7c9;
  word-break: break-word;
}

.linkish {
  border: 0;
  background: none;
  color: #8eb6ff;
  padding: 6px 0 0;
  font-weight: 700;
  font-size: 13px;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.stack { display: flex; flex-direction: column; gap: 14px; }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--card-2);
  border-radius: 12px;
  padding: 14px 16px;
}

.toggle-row strong { display: block; font-size: 14.5px; }
.toggle-row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.seg {
  display: flex;
  gap: 6px;
  padding: 5px;
  width: max-content;
  max-width: 100%;
  background: var(--card-2);
  border-radius: 12px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.color-line { display: flex; gap: 8px; align-items: center; }

.color-line input[type="color"] {
  width: 46px;
  height: 44px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: var(--card-2);
}

.preview-box {
  background: #0c1018;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--line);
}

.kicker {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.embed {
  background: #2b2d31;
  border-radius: 4px;
  padding: 10px 12px;
  max-width: 520px;
  border-left: 4px solid #5865f2;
}

.embed .who { color: #949ba4; font-size: 12px; margin-bottom: 6px; }
.embed .body { color: #dbdee1; line-height: 1.45; font-size: 14.5px; }
.embed img {
  margin-top: 10px;
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  object-fit: cover;
}

.mention {
  background: rgba(88, 101, 242, 0.3);
  color: #c9cdfb;
  border-radius: 3px;
  padding: 0 2px;
}

.bubble {
  max-width: 520px;
  background: #313338;
  border-radius: 8px;
  padding: 10px 12px;
  color: #dbdee1;
}

.canvas-card {
  max-width: 560px;
  min-height: 150px;
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(120deg, rgba(7, 9, 15, 0.15), rgba(7, 9, 15, 0.55)),
    linear-gradient(135deg, #3554d4, #8a3dff 60%, #ff3d88);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--faint);
  font-weight: 700;
  padding: 8px 10px 12px;
}

td {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.who-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.bar {
  width: 110px;
  height: 7px;
  border-radius: 99px;
  background: #222838;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.badge-role {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #d5dbe8;
}

.banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.18);
  color: #d5e2ff;
  font-size: 13.5px;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: -0.045em;
}

.hero .lead {
  margin: 0;
  max-width: 640px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.feature {
  padding: 16px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}

.feature h3 { margin: 0 0 6px; font-size: 15px; letter-spacing: 0; }
.feature p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }

details.faq {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

details.faq + details.faq { margin-top: 8px; }
details.faq summary { cursor: pointer; font-weight: 700; }
details.faq p { color: var(--muted); line-height: 1.5; }

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

.empty {
  padding: 28px 10px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  max-width: min(360px, calc(100vw - 32px));
  background: #182033;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show { opacity: 1; transform: none; }

dialog {
  width: min(460px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: #141a26;
  color: var(--text);
  padding: 18px;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.62); }

dialog h3 { margin: 0 0 8px; font-size: 18px; }
dialog p { margin: 0 0 16px; color: var(--muted); line-height: 1.45; }
dialog .form-actions { justify-content: flex-end; }

@media (max-width: 1180px) {
  .actions, .charts, .modules, .feature-grid { grid-template-columns: 1fr 1fr; }
  .stats, .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 980px) {
  .menu-btn { display: inline-flex; }
  .shell { grid-template-columns: 1fr; }
  main { padding-top: 68px; }
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    height: 100vh;
    width: 270px;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; }
  .backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 45;
  }
}

@media (max-width: 760px) {
  main { padding: 16px 14px 40px; }
  .actions, .charts, .split, .modules, .stats, .filters, .two, .feature-grid { grid-template-columns: 1fr; }
  .head { flex-direction: column; }
  .status-row { justify-content: flex-start; }
  .log { grid-template-columns: 1fr; }
  .server-head h2 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
