:root {
  --bg: #10131d;
  --panel: #181c2a;
  --panel-2: #202537;
  --line: rgba(255,255,255,.1);
  --text: #f5f7ff;
  --muted: #9aa3bb;
  --soft: #747e99;
  --blue: #5966ff;
  --green: #47d18c;
  --red: #ff7575;
  --yellow: #f4c76b;
  --shadow: 0 24px 70px rgba(0,0,0,.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -12%, rgba(89,102,255,.28), transparent 34%),
    linear-gradient(135deg, #10131d, #131722 58%, #171a28);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

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

button {
  cursor: pointer;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(13, 16, 25, .84);
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 24px;
}

.mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, #b997ff, #5966ff 52%, #2e316b);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}

.brand strong {
  display: block;
  font-size: 14px;
}

.brand span {
  color: var(--soft);
  font-size: 12px;
}

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

.nav a,
.nav button {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #c8cede;
  padding: 0 12px;
  text-align: left;
}

.nav .active {
  background: rgba(89,102,255,.16);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 24px 28px 34px;
}

.topbar,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  align-items: center;
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1;
  font-weight: 680;
}

h2 {
  margin: 0;
  font-size: 16px;
}

.subtitle,
.hint {
  color: var(--muted);
}

.button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  background: rgba(255,255,255,.05);
  color: #eef1fb;
  padding: 0 13px;
  font-weight: 650;
}

.button.primary {
  border-color: transparent;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(89,102,255,.22);
}

.button.danger {
  border-color: rgba(255,117,117,.35);
  color: #ffc4c4;
}

.button.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(24, 28, 42, .78);
  box-shadow: var(--shadow);
}

.metric {
  padding: 17px 18px;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  font-size: 24px;
  font-weight: 680;
}

.grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.form {
  display: grid;
  gap: 12px;
}

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

.form-actions-wide {
  grid-column: 1 / -1;
}

.compact-search {
  width: min(260px, 100%);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  outline: none;
  background: rgba(255,255,255,.05);
  color: #fff;
  padding: 0 11px;
}

textarea {
  min-height: 72px;
  padding-top: 9px;
  resize: vertical;
}

option {
  color: #11131d;
}

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

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  padding: 12px;
}

.item strong {
  display: block;
  margin-bottom: 5px;
}

.item span {
  color: var(--soft);
  font-size: 12px;
}

.pill {
  align-self: start;
  border-radius: 999px;
  background: rgba(89,102,255,.14);
  color: #dce0ff;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.edit {
  grid-column: 1 / -1;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.item.editing .edit {
  display: grid;
}

.edit textarea {
  grid-column: span 2;
}

.notice {
  margin: 0 0 14px;
  color: var(--yellow);
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(24, 28, 42, .96);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .metrics,
  .grid {
    grid-template-columns: 1fr;
  }

  .edit {
    grid-template-columns: 1fr;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .edit textarea {
    grid-column: auto;
  }
}
