:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --accent: #7c5cff;
  --accent2: #3dd6d0;
  --danger: #ff4d5e;
  --ok: #24d18b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7ff;
    --panel: rgba(0, 0, 0, 0.04);
    --panel2: rgba(0, 0, 0, 0.06);
    --border: rgba(0, 0, 0, 0.08);
    --text: rgba(0, 0, 0, 0.88);
    --muted: rgba(0, 0, 0, 0.55);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(1200px 600px at 15% 0%, rgba(124, 92, 255, 0.25), transparent 55%),
    radial-gradient(900px 500px at 85% 10%, rgba(61, 214, 208, 0.16), transparent 60%),
    var(--bg);
}

.app {
  min-height: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(10, 14, 30, 0.6);
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

@media (prefers-color-scheme: light) {
  .topbar {
    background: rgba(245, 247, 255, 0.75);
  }
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: white;
  box-shadow: var(--shadow);
}

.title {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
}

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

.pill {
  font-size: 12px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 999px;
  color: var(--muted);
}

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

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

.sidebar {
  width: 260px;
  flex: 0 0 260px;
  position: sticky;
  top: 86px;
  height: calc(100vh - 110px);
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.sidebar-title {
  margin: 6px 8px 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 900;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.nav-item:hover {
  border-color: rgba(124, 92, 255, 0.35);
}

.nav-item.active {
  background: rgba(124, 92, 255, 0.14);
  border-color: rgba(124, 92, 255, 0.6);
}

.nav-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 6px;
}

.nav-danger {
  background: rgba(255, 77, 94, 0.12);
  border-color: rgba(255, 77, 94, 0.35);
}

.anchor {
  scroll-margin-top: 96px;
}

@media (max-width: 980px) {
  .main {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    position: relative;
    top: auto;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-login {
  max-width: 360px;
  margin: 36px auto;
}

@media (max-width: 560px) {
  .panel-login {
    margin: 18px auto;
  }
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

h2 {
  margin: 0 0 10px 0;
  font-size: 18px;
}

.hidden {
  display: none;
}

.form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
  outline: none;
}

@media (prefers-color-scheme: light) {
  input,
  select {
    background: rgba(255, 255, 255, 0.8);
  }
}

input:focus,
select:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.14);
}

.btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.9), rgba(61, 214, 208, 0.7));
  border-color: transparent;
  color: white;
}

.btn-danger {
  background: rgba(255, 77, 94, 0.14);
  border-color: rgba(255, 77, 94, 0.35);
  color: rgba(255, 255, 255, 0.92);
}

.btn-ghost {
  background: transparent;
}

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

@media (max-width: 980px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  padding: 14px;
}

.card-title {
  font-weight: 800;
  margin-bottom: 10px;
}

.card-metric {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.card-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

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

.table th,
.table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.table th {
  font-size: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.12);
}

.k {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.row {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.row:hover {
  border-color: rgba(124, 92, 255, 0.35);
}

.row-left {
  display: grid;
  gap: 2px;
}

.row-title {
  font-weight: 800;
}

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

.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  cursor: pointer;
}

.switch::after {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  transition: left 0.18s ease, background 0.18s ease;
}

.switch.on {
  background: rgba(36, 209, 139, 0.18);
  border-color: rgba(36, 209, 139, 0.35);
}

.switch.on::after {
  left: 21px;
  background: rgba(36, 209, 139, 0.92);
}

.support-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  margin-top: 8px;
}

@media (max-width: 980px) {
  .support-layout {
    grid-template-columns: 1fr;
  }
}

.support-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.select {
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
}

.messages {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.msg {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 10px;
  background: rgba(255, 255, 255, 0.04);
}

.msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: min(520px, calc(100vw - 32px));
  background: rgba(10, 14, 30, 0.92);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 12px;
  box-shadow: var(--shadow);
  display: none;
}

.toast.show {
  display: block;
}

.toast-title {
  font-weight: 900;
  margin-bottom: 4px;
}

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