:root {
  --ink: #0f172a;
  --ink-2: #16203a;
  --ink-3: #243250;
  --teal: #2dd4bf;
  --teal-deep: #0d9488;
  --cream: #f7f5ef;
  --sand: #f0a868;
  --lilac: #b7a6f6;
  --blue: #7aa2f7;
  --gold: #e8c57a;
  --muted: #7c8496;
  --line: rgba(15, 23, 42, 0.08);
  --danger: #d95252;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

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

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* 登录 */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 18% 20%, #1b2f52 0, transparent 46%),
    radial-gradient(circle at 82% 74%, #144a4b 0, transparent 44%),
    linear-gradient(160deg, #0b1220 0%, #0f172a 55%, #101a2e 100%);
  position: relative;
  overflow: hidden;
}

.login .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.5;
  pointer-events: none;
}

.login .orb.a {
  width: 420px;
  height: 420px;
  left: -120px;
  bottom: -140px;
  background: radial-gradient(circle at 30% 30%, rgba(45, 212, 191, 0.35), transparent 70%);
}

.login .orb.b {
  width: 520px;
  height: 520px;
  right: -180px;
  top: -160px;
  background: radial-gradient(circle at 60% 60%, rgba(122, 162, 247, 0.26), transparent 70%);
}

.login-card {
  position: relative;
  width: 420px;
  max-width: calc(100vw - 40px);
  padding: 42px 38px 34px;
  border-radius: 28px;
  background: rgba(247, 245, 239, 0.97);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.35);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 2px;
}

.login-brand p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.login-card .sub {
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.login-tip {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(45, 212, 191, 0.09);
  color: #176e67;
  font-size: 12px;
  line-height: 1.6;
}

.login-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

/* 主框架 */
.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  padding: 26px 18px 22px;
  background: linear-gradient(180deg, #0f172a 0%, #121a2c 58%, #0d1422 100%);
  color: #e7ecf5;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2dd4bf, #7aa2f7);
  display: grid;
  place-items: center;
  color: #062220;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 10px 24px rgba(45, 212, 191, 0.28);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 1px;
  font-weight: 600;
}

.brand p {
  margin: 3px 0 0;
  font-size: 11px;
  color: #7c8aa5;
  letter-spacing: 1px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #9aa6bd;
  font-size: 13px;
  transition: 0.18s ease;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  flex: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e7ecf5;
}

.nav-item.active {
  background: rgba(45, 212, 191, 0.12);
  color: var(--teal);
}

.nav-item.active svg {
  stroke: var(--teal);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.version-box {
  padding: 12px 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  color: #8c98b0;
  line-height: 1.7;
}

.version-box strong {
  color: #dbe3f0;
  font-weight: 600;
}

.admin-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 0 6px;
}

.avatar-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #7aa2f7);
  color: #052220;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.admin-mini span {
  font-size: 12px;
  color: #b9c4d8;
}

.admin-mini button {
  margin-left: auto;
  background: none;
  border: none;
  color: #7c8aa5;
  font-size: 11px;
}

.admin-mini button:hover {
  color: var(--teal);
}

.main {
  margin-left: 240px;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 32px;
  background: rgba(247, 245, 239, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.topbar h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
}

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

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  padding: 26px 32px 64px;
  max-width: 1360px;
}

/* 卡片与网格 */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

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

.card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

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

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

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.kpi {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
}

.kpi::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.14), transparent 70%);
}

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

.kpi .value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.5px;
}

.kpi .foot {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.kpi .foot em {
  font-style: normal;
  color: var(--teal-deep);
}

/* 图表 */
.chart-wrap {
  overflow: hidden;
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--muted);
}

.chart-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  margin-right: 5px;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-item .bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 7px;
}

.bar-item .bar-top span:last-child {
  color: var(--muted);
}

.bar-track {
  height: 7px;
  border-radius: 6px;
  background: #eef0f5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #2dd4bf, #7aa2f7);
}

/* 表格 */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 13px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(45, 212, 191, 0.035);
}

td.strong {
  font-weight: 550;
}

.cell-sub {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  transition: 0.16s ease;
  white-space: nowrap;
}

.btn.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.btn.primary:hover {
  background: #1b2944;
}

.btn.teal {
  background: linear-gradient(135deg, #2dd4bf, #3fd0c3);
  color: #04201d;
  box-shadow: 0 8px 22px rgba(45, 212, 191, 0.28);
}

.btn.teal:hover {
  filter: brightness(1.03);
}

.btn.ghost {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  color: var(--ink);
}

.btn.ghost:hover {
  border-color: rgba(15, 23, 42, 0.24);
}

.btn.small {
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12px;
}

.btn.text {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0 6px;
  height: auto;
}

.btn.text:hover {
  color: var(--ink);
}

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

.btn.danger:hover {
  background: rgba(217, 82, 82, 0.07);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 标签 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.5;
  background: #f1f3f7;
  color: #616b7e;
}

.badge.green {
  background: rgba(45, 212, 191, 0.12);
  color: #0f766e;
}

.badge.orange {
  background: rgba(240, 168, 104, 0.16);
  color: #b05d21;
}

.badge.blue {
  background: rgba(122, 162, 247, 0.14);
  color: #315a9d;
}

.badge.red {
  background: rgba(217, 82, 82, 0.1);
  color: #a83333;
}

.badge.gray {
  background: #f1f3f7;
  color: #6b7486;
}

.badge.dark {
  background: rgba(15, 23, 42, 0.88);
  color: #dbe3f0;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* 工具条 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .spacer {
  flex: 1;
}

.input,
.select,
textarea.input {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: 0.15s ease;
}

.input:focus,
.select:focus,
textarea.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.input.search {
  width: 220px;
}

textarea.input {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.7;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

.field label {
  font-size: 12px;
  color: #566078;
}

.field .hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

.field input,
.field select {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #dfe3ea;
  border: none;
  transition: 0.2s ease;
  flex: none;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: 0.2s ease;
}

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

.switch.on::after {
  transform: translateX(18px);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8f9fb;
  font-size: 13px;
}

/* Tabs */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(15, 23, 42, 0.045);
  border-radius: 12px;
}

.tab {
  border: none;
  background: none;
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--muted);
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

/* 广告位卡片 */
.slot-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.slot-card .slot-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.slot-card h4 {
  margin: 0;
  font-size: 15px;
}

.slot-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}

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

.slot-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.creative-preview {
  width: 64px;
  height: 44px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: #fff;
  letter-spacing: 1px;
  overflow: hidden;
  flex: none;
}

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

.theme-night {
  background: linear-gradient(135deg, #0f172a, #2dd4bf);
}

.theme-sand {
  background: linear-gradient(135deg, #b98a52, #f0a868);
}

.theme-forest {
  background: linear-gradient(135deg, #1d3b2f, #86c9a0);
}

.theme-deep {
  background: linear-gradient(135deg, #101a2e, #7aa2f7);
}

.theme-teal {
  background: linear-gradient(135deg, #0d9488, #2dd4bf);
}

/* 模弹与抽屉 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(8, 13, 23, 0.5);
  backdrop-filter: blur(3px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade 0.16s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: 620px;
  max-width: 100%;
  max-height: calc(100vh - 60px);
  background: #fff;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.28);
  animation: rise 0.2s ease;
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 15px;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fbfbf9;
}

.icon-close {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: #f2f4f7;
  color: #6b7486;
  font-size: 15px;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(8, 13, 23, 0.42);
  z-index: 85;
  display: flex;
  justify-content: flex-end;
  animation: fade 0.16s ease;
}

.drawer {
  width: 720px;
  max-width: 94vw;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  animation: slide 0.22s ease;
}

@keyframes slide {
  from {
    transform: translateX(30px);
    opacity: 0.6;
  }
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px;
}

.drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 26px;
  border-top: 1px solid var(--line);
}

.section-title {
  margin: 24px 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: #566078;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.section-title:first-child {
  margin-top: 0;
}

/* 提示 */
.toast-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
  animation: rise 0.2s ease;
  max-width: 360px;
}

.toast.error {
  background: #a83333;
}

.toast.success {
  background: #0f766e;
}

/* 空态 */
.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 6px;
}

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 16px;
  font-size: 12px;
  color: var(--muted);
}

/* 看板提示 */
.notice-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(45, 212, 191, 0.12), rgba(122, 162, 247, 0.1));
  color: #144e5c;
  font-size: 13px;
}

.notice-strip .spark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(45, 212, 191, 0.14);
  flex: none;
}

/* 颜色块 */
.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.color-chip i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

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

@media (max-width: 860px) {
  .sidebar {
    width: 76px;
    padding: 20px 10px;
  }
  .brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
  .brand > div:last-child,
  .nav-item span,
  .sidebar-foot .version-box,
  .admin-mini span,
  .admin-mini button {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px 0;
  }
  .main {
    margin-left: 76px;
  }
  .topbar {
    padding: 14px 18px;
  }
  .content {
    padding: 18px 18px 50px;
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .input.search {
    width: 100%;
  }
}
