:root {
  --bg: #fff6fa;
  --bg-soft: #fffafc;
  --card: #ffffff;
  --card-border: #f3dce5;
  --text: #3f2a32;
  --text-light: #7f6670;
  --accent: #ca4c77;
  --accent-strong: #b43963;
  --accent-soft: #ffe8f0;
  --shadow: 0 10px 28px rgba(185, 63, 111, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 8%, #ffe6ef 0, transparent 34%),
    radial-gradient(circle at 90% 0%, #ffeef4 0, transparent 28%),
    var(--bg);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #3a2130 0%, #5d3042 55%, #724055 100%);
  color: #fff;
  padding: 22px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex: 0 0 auto;
}

.brand-text {
  display: inline-block;
  font-size: 20px;
  line-height: 1.2;
}

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

.nav-item {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 11px 12px;
  transition: all 0.2s ease;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.main {
  padding: 22px;
}

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

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

.auth-user {
  font-size: 13px;
  color: var(--text-light);
}

.link-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  padding: 8px 14px;
  text-decoration: none;
  color: var(--accent-strong);
  background: #fff;
  font-size: 13px;
}

.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--text-light);
  font-size: 13px;
}

.token-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-light);
  font-size: 13px;
}

.token-wrap input {
  width: 280px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--card);
  padding: 8px 10px;
  color: var(--text);
}

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

.notice-panel {
  margin-bottom: 14px;
  background: linear-gradient(120deg, #fff3f8, #fff9fc);
}

.page-intro {
  margin-bottom: 14px;
  background: linear-gradient(140deg, #fff7fb 0%, #fff 100%);
}

.hero-card {
  margin-bottom: 14px;
  border-radius: 22px;
  border: 1px solid #f1d7e2;
  padding: 20px;
  background: linear-gradient(135deg, #ffe1eb 0%, #fdd3e1 46%, #f8cadc 100%);
  box-shadow: 0 12px 30px rgba(195, 78, 126, 0.15);
}

.hero-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 8px;
}

.hero-desc {
  margin: 0;
  color: #704d59;
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  text-align: center;
  border-radius: 16px;
  padding: 14px 10px;
}

.stat-card:nth-child(1) {
  background: linear-gradient(140deg, #fff, #ffeef4);
}

.stat-card:nth-child(2) {
  background: linear-gradient(140deg, #fff, #fff3f7);
}

.stat-card:nth-child(3) {
  background: linear-gradient(140deg, #fff, #ffeef5);
}

.stat-card:nth-child(4) {
  background: linear-gradient(140deg, #fff, #fff1f6);
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  margin-top: 6px;
  color: var(--text-light);
}

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

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(150deg, #fff 0%, #fff6fa 100%);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(196, 78, 125, 0.16);
}

.card-theme-1 {
  background: linear-gradient(145deg, #fff, #ffeef4);
}

.card-theme-2 {
  background: linear-gradient(145deg, #fff, #fff2f7);
}

.card-theme-3 {
  background: linear-gradient(145deg, #fff, #fff0f6);
}

.card-theme-4 {
  background: linear-gradient(145deg, #fff, #fff3f8);
}

.card-theme-5 {
  background: linear-gradient(145deg, #fff, #fff1f7);
}

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

.module-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.module-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #f0dbe3;
  color: var(--accent-strong);
  font-size: 12px;
}

.module-desc {
  margin: 0;
  color: var(--text-light);
  line-height: 1.55;
  font-size: 13px;
  min-height: 44px;
}

.module-meta {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.module-kv {
  border: 1px solid #f0dce4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.module-kv span {
  font-size: 12px;
  color: #7b666f;
}

.module-kv strong {
  font-size: 14px;
  color: #b43f68;
}

.module-action {
  margin-top: 12px;
  display: inline-block;
  align-self: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #f0dbe3;
  color: #b43f68;
  font-size: 13px;
  font-weight: 600;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-actions input[type="text"] {
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 8px 12px;
  min-width: 230px;
  background: #fff;
  color: var(--text);
}

.primary-btn,
.ghost-btn {
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #dd5d8b, #bd3f67);
}

.ghost-btn {
  color: var(--accent);
  background: var(--accent-soft);
}

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

.danger-btn {
  color: #9f3a57;
  background: #ffe3eb;
}

.crud-layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, 1.9fr);
  gap: 14px;
}

.list-card,
.form-card {
  border: 1px solid #f0d9e3;
  border-radius: 14px;
  background: var(--bg-soft);
  padding: 12px;
}

.list-title {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 10px;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 500px;
  overflow: auto;
}

.item-list.fixed-four-list {
  min-height: 218px;
  max-height: 218px;
}

.list-pagination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.page-indicator {
  color: #7a626c;
  font-size: 13px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid #f4e4ea;
}

.item-row:last-child {
  border-bottom: none;
}

.item-row.active {
  background: #ffeef4;
  border-radius: 10px;
}

.item-select {
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  color: #4f3840;
  line-height: 1.45;
  cursor: pointer;
  padding: 0;
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

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

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

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

.field span {
  font-size: 13px;
  color: #6f5860;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  width: 100%;
  padding: 9px 10px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
}

.field textarea {
  resize: vertical;
}

.field-wide {
  grid-column: span 2;
}

.inline-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

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

.upload-row input[type="file"] {
  border: 0;
  padding: 0;
  background: transparent;
}

.preview-box {
  border: 1px dashed #e8cfd9;
  background: #fff;
  border-radius: 10px;
  min-height: 130px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-image {
  width: 100%;
  max-height: 230px;
  object-fit: cover;
  border-radius: 8px;
  display: none;
}

.preview-avatar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  object-fit: cover;
  display: none;
}

.preview-empty {
  font-size: 12px;
  color: #9a7f88;
}

.gallery-preview {
  border: 1px dashed #e8cfd9;
  background: #fff;
  border-radius: 10px;
  min-height: 130px;
  padding: 8px;
}

.gallery-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.gallery-preview-item-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #f0dbe3;
  background: #fff;
  cursor: grab;
}

.gallery-preview-item-wrap.dragging {
  opacity: 0.55;
}

.gallery-preview-item-wrap.drop-target {
  outline: 2px dashed #d94b79;
  outline-offset: -3px;
}

.gallery-preview-item {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.gallery-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #e43a5f;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(211, 45, 86, 0.28);
}

.gallery-delete-btn:hover {
  background: #c92e51;
}

.gallery-order-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(41, 22, 31, 0.68);
  color: #fff;
  font-size: 12px;
}

.url-meta-list {
  border: 1px dashed #e8cfd9;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.url-meta-item {
  border: 1px solid #f0dbe3;
  border-radius: 10px;
  background: #fff8fb;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.url-meta-link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #8f2f4f;
  text-decoration: none;
}

.url-meta-link:hover {
  text-decoration: underline;
}

.url-delete-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #e43a5f;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.url-delete-btn:hover {
  background: #c92e51;
}

.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dynamic-item {
  border: 1px solid #ead5de;
  border-radius: 12px;
  padding: 12px;
  background: #fff9fc;
}

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

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

.dynamic-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.table-wrap {
  overflow: auto;
}

.table-wrap.fixed-four-table {
  min-height: 248px;
  max-height: 248px;
}

.table-pagination {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.table-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-btn.danger-link {
  color: #a33958;
}

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

.data-table th,
.data-table td {
  border-bottom: 1px solid #f0dce4;
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  color: #7b646d;
  background: #fff7fb;
  position: sticky;
  top: 0;
}

.data-table tr.row-active td {
  background: #ffeef4;
}

.login-body {
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-brand {
  font-size: 24px;
  font-weight: 700;
}

.login-subtitle {
  color: var(--text-light);
  font-size: 13px;
}

.login-submit {
  margin-top: 2px;
}

.login-notice {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-light);
}

.account-panel {
  max-width: 680px;
}

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

@media (max-width: 1200px) {
  .stats-grid,
  .module-grid,
  .crud-layout {
    grid-template-columns: 1fr;
  }
}

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

  .main {
    padding: 14px;
  }

  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .brand-text {
    font-size: 18px;
  }

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

  .auth-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .token-wrap input {
    width: 100%;
  }

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

  .field-wide {
    grid-column: auto;
  }

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