:root {
  --bg-a: #d8ebff;
  --bg-b: #b7d9f2;
  --surface: #f8f9ff;
  --panel: #ffffff;
  --panel-soft: #f2f4ff;
  --border: #e1e7fb;
  --text: #1f2430;
  --muted: #7d859f;
  --brand: #7265f5;
  --brand-strong: #5e53e0;
  --success: #24a06b;
  --warn: #d28b12;
  --danger: #d24d4d;
  --shadow-xl: 0 28px 60px rgba(65, 86, 142, 0.18);
  --shadow-md: 0 10px 24px rgba(78, 103, 158, 0.12);
  --radius-xl: 30px;
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 255, 255, 0.6), transparent 32%),
    linear-gradient(160deg, var(--bg-a), var(--bg-b));
}

a {
  color: inherit;
}

.layout-shell {
  min-height: calc(100vh - 34px);
  margin: 16px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid #dbe2fb;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 34px);
  overflow: auto;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbff 0%, #f5f6ff 100%);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 14px;
}

.brand-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #dcb8ff, #8d66ff 70%);
  box-shadow: 0 0 0 7px rgba(134, 95, 255, 0.13);
}

.brand-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

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

.admin-block {
  margin: 8px 4px 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-md);
}

.admin-name {
  font-weight: 700;
}

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

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

.nav-item {
  display: block;
  margin: 0 4px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration: none;
  color: #4e5570;
  font-size: 14px;
  transition: 150ms ease;
}

.nav-item:hover {
  background: #eef0ff;
  border-color: #d9ddff;
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  border-color: #6255e8;
  box-shadow: 0 10px 20px rgba(95, 83, 224, 0.35);
}

.sidebar-promo {
  margin: 16px 6px 10px;
  padding: 14px 12px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, #cc86ff, #6b62fb);
  box-shadow: 0 12px 24px rgba(119, 93, 242, 0.35);
}

.sidebar-promo-title {
  font-size: 14px;
  font-weight: 700;
}

.sidebar-promo-text {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.92;
}

.sidebar-promo-btn {
  display: inline-flex;
  margin-top: 12px;
  height: 32px;
  padding: 0 12px;
  align-items: center;
  border-radius: 999px;
  text-decoration: none;
  color: #4338ca;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.logout-wrap {
  margin-top: 10px;
  padding: 6px 4px;
}

.main-shell {
  min-width: 0;
  padding: 22px;
}

.topbar {
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.topbar-hi {
  color: #4f5473;
  font-size: 28px;
  margin-bottom: 4px;
}

.topbar-title {
  font-size: 42px;
  line-height: 1.05;
  font-weight: 800;
}

.topbar-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
}

.top-search {
  position: relative;
}

.top-search input {
  width: 210px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid #e3e8ff;
  background: #f3f5ff;
  padding: 0 12px;
}

.top-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid #e0e6ff;
  background: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.top-icon em {
  position: absolute;
  right: 0;
  top: 0;
  transform: translate(40%, -35%);
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  font-style: normal;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  color: #fff;
  background: #ff6d4c;
}

.mini-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border-radius: 12px;
  border: 1px solid #e2e8ff;
  background: #fff;
  padding: 0 12px;
  font-size: 13px;
  text-decoration: none;
}

.mini-link:hover {
  background: #eef2ff;
}

.page-main {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.page-head {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.page-title {
  margin: 0;
  font-size: 22px;
}

.page-desc {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.dashboard-shell {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 320px;
}

.dashboard-main {
  display: grid;
  gap: 14px;
}

.dashboard-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

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

.panel-title {
  margin: 0 0 14px;
  font-size: 18px;
}

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

.metric-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 14px;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  right: -24px;
  bottom: -24px;
  background: rgba(255, 255, 255, 0.48);
}

.card-tone-1 { background: linear-gradient(140deg, #eef4ff, #e4eeff); }
.card-tone-2 { background: linear-gradient(140deg, #f3edff, #ebe3ff); }
.card-tone-3 { background: linear-gradient(140deg, #efffff, #e3f6ff); }
.card-tone-4 { background: linear-gradient(140deg, #fff7ea, #fff1d7); }
.card-tone-5 { background: linear-gradient(140deg, #ffeef7, #ffe3f2); }
.card-tone-6 { background: linear-gradient(140deg, #eef8ff, #e1f1ff); }

.metric-title {
  color: #586082;
  font-size: 13px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 34px;
  line-height: 1.05;
  font-weight: 800;
}

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

.chart-fake {
  height: 180px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8f9ff);
  padding: 12px;
  position: relative;
  overflow: hidden;
}

.chart-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 44%;
  height: 56px;
  background: linear-gradient(135deg, rgba(112, 101, 245, 0.22), rgba(112, 101, 245, 0));
  filter: blur(16px);
}

.chart-bars {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  height: 70%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  align-items: end;
}

.chart-bars span {
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #8f87ff, #6f64f4);
}

.kpi-strip {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fcfdff;
  padding: 10px;
}

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

.kpi-number {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 700;
}

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

.rank-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: center;
}

.rank-index {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #eef1ff;
  color: #5a63a1;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

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

.rank-name {
  font-size: 13px;
  color: #3c4464;
}

.rank-bar {
  margin-top: 6px;
  height: 8px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
}

.rank-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6d62f2, #4ea9ff);
}

.rank-value {
  color: #4b5376;
  font-weight: 700;
}

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

.notify-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: #fff;
}

.notify-item.active {
  background: linear-gradient(135deg, #4f9cff, #3d7ce8);
  color: #fff;
  border-color: #4a8df8;
}

.notify-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, #f7e6ff, #e7f2ff);
  color: #5764a2;
}

.notify-item.active .notify-avatar {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.notify-title {
  font-size: 13px;
  font-weight: 700;
}

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

.notify-item.active .notify-sub {
  color: rgba(255, 255, 255, 0.85);
}

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

.notify-item.active .notify-time {
  color: rgba(255, 255, 255, 0.88);
}

.side-action .side-btns {
  display: grid;
  gap: 8px;
}

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

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

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

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

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

th,
td {
  border-bottom: 1px solid #edf1fd;
  padding: 10px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9ff;
  color: #5a648b;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

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

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

.text-clip {
  max-width: 420px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mono {
  font-family: Menlo, Consolas, "Courier New", monospace;
}

.empty-row {
  text-align: center;
  color: #9aa4c6;
  padding: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  white-space: nowrap;
}

.tag.ok {
  color: #1a734f;
  background: #eaf9f1;
  border-color: #c8edd9;
}

.tag.warn {
  color: #8e6211;
  background: #fff5e1;
  border-color: #f6deb0;
}

.tag.danger {
  color: #9f3434;
  background: #ffecec;
  border-color: #f8c8c8;
}

.tag.neutral {
  color: #546188;
  background: #eef2ff;
  border-color: #d8e0ff;
}

.btn {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 13px;
  font-size: 13px;
  cursor: pointer;
  transition: 140ms ease;
}

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

.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

.btn.success {
  color: #fff;
  background: linear-gradient(135deg, #29ac73, #1b8c5d);
}

.btn.warn {
  color: #fff;
  background: linear-gradient(135deg, #e09b23, #c98211);
}

.btn.danger {
  color: #fff;
  background: linear-gradient(135deg, #df5b5b, #c74a4a);
}

.btn.ghost {
  color: #44507b;
  background: #eef2ff;
  border-color: #dce4ff;
}

.btn.block {
  width: 100%;
}

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

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-form,
.create-form,
.edit-form {
  display: grid;
  gap: 10px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

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

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

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

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

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

.field {
  display: grid;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field > span {
  color: #5f6a91;
  font-size: 12px;
}

.field > span input[type="checkbox"],
.field > span input[type="radio"] {
  margin-right: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dbe3fa;
  border-radius: 10px;
  padding: 8px 9px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  padding: 0;
  vertical-align: middle;
}

textarea {
  resize: vertical;
  min-height: 74px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #b7c6ff;
  box-shadow: 0 0 0 3px rgba(111, 100, 244, 0.15);
}

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

.section-gap {
  margin-top: 4px;
}

.edit-row td {
  background: #fbfcff;
}

.edit-box {
  border: 1px solid #e5eafe;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.notice {
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  font-size: 13px;
}

.notice.success {
  background: #eaf8f0;
  color: #10623f;
  border-color: #bfe8d0;
}

.notice.error {
  background: #feeeee;
  color: #922a2a;
  border-color: #f3c3c3;
}

.json-box {
  width: 100%;
  min-height: 360px;
  border: 1px solid #dbe3fa;
  border-radius: 10px;
  padding: 10px;
  background: #fbfdff;
  color: #2f3d50;
  font-size: 12px;
  line-height: 1.45;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(145, 127, 255, 0.25), transparent 38%),
    radial-gradient(circle at 80% 70%, rgba(84, 160, 255, 0.22), transparent 34%),
    linear-gradient(160deg, #e8f3ff 0%, #d6ebff 45%, #c4dff7 100%);
}

.login-wrap {
  width: min(520px, calc(100vw - 24px));
}

.page-login {
  margin-top: 0;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dce5fb;
  border-radius: 20px;
  box-shadow: var(--shadow-xl);
  padding: 24px;
}

.login-title {
  margin: 0;
  font-size: 24px;
}

.login-sub {
  margin: 8px 0 18px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 1460px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
  }
}

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

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

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

  .topbar-title {
    font-size: 34px;
  }
}

@media (max-width: 1080px) {
  .layout-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .main-shell {
    padding: 14px;
  }

  .grid-2,
  .grid-3,
  .split {
    grid-template-columns: 1fr;
  }

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

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

  .cols-3,
  .cols-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 740px) {
  .layout-shell {
    margin: 8px;
    border-radius: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-title {
    font-size: 28px;
  }

  .topbar-hi {
    font-size: 22px;
  }

  .topbar-right {
    width: 100%;
  }

  .top-search,
  .top-search input {
    width: 100%;
  }

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

  .cols-6,
  .cols-5,
  .cols-4 {
    grid-template-columns: 1fr;
  }

  th,
  td {
    white-space: nowrap;
  }
}
