:root {
  --primary-100: #eef1ff;
  --primary-500: #4f6bff;
  --primary-600: #3f5cff;
  --primary-gradient: linear-gradient(135deg, #7057ff 0%, #4e78ff 100%);
  --page: #f4f7ff;
  --surface: #ffffff;
  --section: #f7f9ff;
  --text: #151923;
  --secondary: #5f6878;
  --tertiary: #98a1b2;
  --border: #e8edf6;
  --divider: #eef1f6;
  --success: #2fc58f;
  --warning: #ffad3b;
  --danger: #ff5e57;
  --gold: #ffd58a;
  --radius-card: 12px;
  --radius-control: 10px;
  --shadow-card: 0 18px 44px rgba(56, 75, 124, 0.08);
  --shadow-pop: 0 24px 70px rgba(21, 25, 35, 0.18);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  color: var(--text);
  background: var(--page) url("./tupian/bg_admin_page.png") center / cover fixed;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--primary-gradient);
  font-weight: 900;
}

.brand-name {
  font-size: 17px;
  font-weight: 900;
}

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

.nav {
  margin-top: 26px;
  display: grid;
  gap: 8px;
}

.nav-item {
  height: 46px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--secondary);
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.nav-item img {
  width: 22px;
  height: 22px;
}

.nav-item.active {
  color: var(--primary-600);
  background: var(--primary-100);
}

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

.topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--secondary);
  font-size: 14px;
}

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

.search {
  width: 300px;
  height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.search img {
  width: 20px;
  height: 20px;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
}

.icon-btn img {
  width: 22px;
  height: 22px;
}

.admin-user {
  height: 42px;
  padding: 0 8px 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary-gradient);
  font-size: 13px;
}

.content {
  margin-top: 20px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
}

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

.toolbar-left,
.toolbar-right,
.btn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--secondary);
  background: #fff;
  font-weight: 800;
}

.btn img {
  width: 18px;
  height: 18px;
}

.btn.primary {
  color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 12px 24px rgba(78, 107, 255, 0.22);
}

.btn.secondary {
  color: var(--primary-600);
  background: var(--primary-100);
}

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

.btn.ghost {
  border-color: var(--border);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.kpi {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.kpi img {
  width: 44px;
  height: 44px;
}

.kpi-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 900;
}

.kpi-label {
  color: var(--secondary);
  font-size: 13px;
}

.kpi-trend {
  margin-top: 4px;
  color: var(--success);
  font-size: 12px;
}

.two-col {
  margin-top: 16px;
  grid-template-columns: 1.5fr 1fr;
}

.panel {
  padding: 18px;
}

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

.panel-title {
  font-size: 17px;
  font-weight: 900;
}

.chart {
  height: 282px;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}

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

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 52px;
  align-items: center;
  gap: 12px;
  color: var(--secondary);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1f6;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary-gradient);
}

.table-card {
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.table th,
.table td {
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}

.table th {
  height: 50px;
  color: var(--secondary);
  background: var(--section);
  font-weight: 900;
}

.table tr:last-child td {
  border-bottom: 0;
}

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

.cell-main img {
  width: 34px;
  height: 34px;
}

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

.badge {
  min-width: 62px;
  height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.success {
  color: var(--success);
  background: #e9f8f3;
}

.badge.warning {
  color: #b97300;
  background: #fff6e7;
}

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

.badge.primary {
  color: var(--primary-600);
  background: var(--primary-100);
}

.action-link {
  border: 0;
  color: var(--primary-600);
  background: transparent;
  font-weight: 900;
}

.action-link.danger {
  color: var(--danger);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

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

.form label {
  display: grid;
  gap: 7px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 800;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  outline: 0;
  background: #fff;
  color: var(--text);
}

.form textarea {
  min-height: 82px;
  padding-top: 10px;
  resize: vertical;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
}

.switch {
  width: 46px;
  height: 26px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: #d9dfec;
}

.switch::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin-left: 0;
  border-radius: 50%;
  background: #fff;
  transition: margin 0.18s ease;
}

.switch.on {
  background: var(--primary-500);
}

.switch.on::after {
  margin-left: auto;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.tab {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--secondary);
  background: #fff;
  font-weight: 900;
}

.tab.active {
  color: var(--primary-600);
  background: var(--primary-100);
}

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

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

.audit-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.audit-card img {
  width: 44px;
  height: 44px;
}

.session-preview {
  display: grid;
  gap: 10px;
}

.message-item {
  padding: 12px;
  border-radius: 10px;
  background: var(--section);
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.5;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(21, 25, 35, 0.28);
}

.hidden {
  display: none !important;
}

.modal,
.drawer {
  position: fixed;
  z-index: 60;
  background: #fff;
  box-shadow: var(--shadow-pop);
}

.modal {
  left: 50%;
  top: 50%;
  width: 520px;
  transform: translate(-50%, -50%);
  border-radius: 18px;
}

.drawer {
  top: 0;
  right: 0;
  width: 430px;
  height: 100vh;
}

.modal-head,
.drawer-head {
  min-height: 62px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--divider);
}

.modal-title {
  font-size: 18px;
  font-weight: 900;
}

.modal-body,
.drawer-body {
  padding: 20px;
}

.modal-foot,
.drawer-foot {
  padding: 16px 20px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--divider);
}

.close-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--section);
}

.close-btn img {
  width: 18px;
  height: 18px;
}

.empty-note {
  padding: 38px;
  color: var(--secondary);
  text-align: center;
}

.toast {
  position: fixed;
  right: 28px;
  top: 24px;
  z-index: 80;
  min-width: 220px;
  max-width: 420px;
  padding: 13px 16px;
  border-radius: var(--radius-control);
  color: #fff;
  background: var(--success);
  box-shadow: var(--shadow-pop);
  font-size: 14px;
  font-weight: 800;
}

.toast.danger {
  background: var(--danger);
}

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

  .two-col,
  .split-layout,
  .config-grid {
    grid-template-columns: 1fr;
  }
}
