:root {
  color-scheme: dark;
  --brand: #0330ef;
  --brand-soft: rgb(3 48 239 / 0.16);
  --bg: #0b0b0b;
  --surface: #0f0f0f;
  --raised: #151517;
  --fg: #f4f5fb;
  --muted: #8e92a6;
  --line: rgb(255 255 255 / 0.1);
  --outline: rgb(255 255 255 / 0.34);
  --ok: #3ec97b;
  --warn: #f5b73b;
  --danger: #ff5c5c;
  --font-title: "Figtree", sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --side: 272px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f2f7;
  --surface: #ffffff;
  --raised: #f6f7fb;
  --fg: #0b0b0b;
  --muted: #5f637a;
  --line: rgb(11 11 11 / 0.12);
  --outline: rgb(11 11 11 / 0.32);
}

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

[hidden] {
  display: none !important;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  background: none;
  border: 0;
  cursor: pointer;
}

ul {
  list-style: none;
}

h1,
h2 {
  font-family: var(--font-title);
  font-weight: 800;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
}

.shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100dvh;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100dvh;
  padding: 20px 14px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}

.side__logo img {
  display: block;
  width: 110px;
  height: auto;
  margin: 2px 8px 6px;
}

.side__server {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 10px 0 4px;
  text-align: center;
}

.side__server strong {
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--brand);
  overflow-wrap: anywhere;
}

.side__back {
  justify-content: center;
}

.stack {
  display: grid;
  gap: 22px;
}

.nav {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 4px;
}

.nav__label {
  margin: 14px 10px 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 700;
  transition: background 0.25s, color 0.25s;
}

.nav__link i {
  font-size: 19px;
}

.nav__link:hover {
  background: var(--raised);
  color: var(--fg);
}

.nav__link.is-active {
  background: var(--brand-soft);
  color: var(--fg);
}

.nav__link.is-active i {
  color: var(--brand);
}

.side__user {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  box-shadow: 0 -14px 14px 2px var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
}

.side__name {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
  justify-items: start;
}

.side__name strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 18px;
  transition: background 0.25s, color 0.25s;
}

.iconbtn:hover {
  background: var(--surface);
  color: var(--fg);
}

.content {
  min-width: 0;
}

.mobilebar {
  display: none;
}

.main {
  width: min(100%, 980px);
  margin-inline: auto;
  padding: 44px 32px 80px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.pagehead__title {
  color: var(--brand);
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.pagehead__desc {
  margin-top: 8px;
  color: var(--muted);
}

.card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}

.card > :not(.card__head, .row) {
  margin: 0 22px 22px;
}

.card__head {
  display: grid;
  gap: 4px;
  padding: 20px 22px 14px;
}

.card__title {
  font-size: 18px;
  letter-spacing: -0.01em;
}

.card__desc {
  color: var(--muted);
  font-size: 14px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row__text {
  display: grid;
  gap: 2px;
}

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

.row.is-disabled {
  opacity: 0.55;
}

.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--outline);
  transition: background 0.25s;
}

.switch[aria-checked="true"] {
  background: var(--brand);
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.3s var(--ease);
}

.switch[aria-checked="true"] .switch__thumb {
  transform: translateX(20px);
}

.switch:disabled {
  cursor: not-allowed;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn--fill {
  background: var(--brand);
  color: #fff;
}

.btn--line {
  border-color: var(--line);
  background: var(--raised);
}

.btn--line:hover {
  border-color: var(--outline);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--small {
  padding: 9px 14px;
  font-size: 14px;
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field--wrap {
  flex-wrap: wrap;
}

.field .input {
  flex: 1;
  min-width: 160px;
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
}

.input:focus {
  border-color: var(--brand);
  outline: 0;
}

.input--short {
  flex: none !important;
  width: auto;
  min-width: 0 !important;
}

.color {
  width: 56px;
  height: 46px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  cursor: pointer;
}

.modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  text-align: left;
  transition: border-color 0.25s, background 0.25s;
}

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

.mode:hover {
  border-color: var(--outline);
}

.mode.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.stat i {
  color: var(--brand);
  font-size: 22px;
}

.stat__label {
  color: var(--muted);
  font-size: 13px;
}

.stat__value {
  font-family: var(--font-title);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.servers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.server {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color 0.25s, transform 0.4s var(--ease);
}

.server:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.server > i {
  margin-left: auto;
  color: var(--muted);
  font-size: 22px;
}

.server__info {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.server__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--small {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.avatar--large {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 20px;
}

.avatar--xl {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  font-size: 28px;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--muted {
  color: var(--muted);
}

.badge--ok {
  color: var(--ok);
}

.badge--warn {
  color: var(--warn);
}

.badge--danger {
  color: var(--danger);
}

.badge--brand {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--danger);
  border-radius: 14px;
  background: rgb(255 92 92 / 0.1);
}

.logs {
  display: grid;
}

.log {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
}

.log + .log {
  border-top: 1px solid var(--line);
}

.log__text {
  flex: 1;
  min-width: 0;
}

.log__change {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

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

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raised);
}

.chip button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: var(--muted);
}

.chip button:hover {
  background: var(--danger);
  color: #fff;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 36px 22px;
  color: var(--muted);
  text-align: center;
}

.empty i {
  color: var(--brand);
  font-size: 34px;
}

.empty strong {
  color: var(--fg);
}

.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
}

.login__card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(100%, 440px);
  padding: 36px 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}

.login__logo {
  width: 120px;
  height: auto;
}

.login__title {
  color: var(--brand);
  font-size: 30px;
  letter-spacing: -0.03em;
}

.login__text,
.login__hint {
  color: var(--muted);
}

.login__hint {
  font-size: 13px;
}

.login__error {
  min-height: 1em;
  color: var(--danger);
  font-size: 14px;
}

.login__actions {
  display: grid;
  gap: 10px;
  width: 100%;
}

.login__actions .btn {
  justify-content: center;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 380px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);
  animation: toast-in 0.4s var(--ease);
}

.toast--ok i {
  color: var(--ok);
}

.toast--error i {
  color: var(--danger);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.4s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.scrim {
  display: none;
}

@media (max-width: 880px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(84vw, 300px);
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease);
  }

  .side.is-open {
    transform: none;
  }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: rgb(0 0 0 / 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobilebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .mobilebar__logo {
    width: 84px;
    height: auto;
  }

  .main {
    padding: 28px 16px 64px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .servers,
  .modes {
    grid-template-columns: minmax(0, 1fr);
  }

  .field {
    flex-direction: column;
    align-items: stretch;
  }

  .field .input--short {
    width: 100%;
  }

  .field .btn,
  .shortcuts .btn {
    justify-content: center;
  }

  .shortcuts .btn {
    flex: 1 1 100%;
  }

  .row {
    padding: 16px;
  }

  .log {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .log time {
    flex: 1 1 100%;
  }

  .card__head {
    padding: 18px 16px 12px;
  }

  .card > :not(.card__head, .row) {
    margin: 0 16px 18px;
  }
}

.card > .logs {
  margin: 0;
}
