:root {
  --wine: #7c1b21;
  --wine-deep: #5f1218;
  --wine-soft: #f8e9e8;
  --gold: #c99b48;
  --paper: #f6f1e9;
  --surface: #fffdf9;
  --ink: #261b18;
  --muted: #84736a;
  --line: #e7ddd2;
  --green: #2c7a5b;
  --amber: #9f6a21;
  --red: #b4232d;
  --shadow: 0 16px 45px rgba(54, 31, 23, 0.1);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1000px;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0, rgba(124, 27, 33, 0.07), transparent 32rem),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

.admin-boot {
  display: grid;
  min-height: 100vh;
  place-content: center;
  justify-items: center;
  color: var(--muted);
}

.admin-boot-mark {
  display: grid;
  width: 74px;
  height: 74px;
  margin-bottom: 18px;
  border-radius: 24px;
  place-items: center;
  color: #fff8eb;
  background: var(--wine);
  box-shadow: var(--shadow);
  font: 700 39px/1 "STKaiti", "KaiTi", serif;
}

.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(520px, 1fr) minmax(440px, 0.72fr);
}

.login-brand {
  position: relative;
  display: flex;
  overflow: hidden;
  padding: 7vw;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.08), transparent 25rem),
    linear-gradient(150deg, var(--wine), var(--wine-deep));
}

.login-brand::after {
  position: absolute;
  right: -100px;
  bottom: -120px;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 55px rgba(255, 255, 255, 0.025),
    0 0 0 120px rgba(255, 255, 255, 0.016);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-seal {
  display: grid;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  place-items: center;
  color: var(--wine);
  background: #fff8e8;
  font: 800 27px/1 "STKaiti", "KaiTi", serif;
}

.brand-lockup strong {
  font-size: 20px;
  letter-spacing: 0.08em;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
  padding: 70px 0;
}

.login-copy small {
  color: #e8c986;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.login-copy h1 {
  margin: 18px 0 20px;
  font: 700 clamp(44px, 5vw, 74px)/1.14 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.04em;
}

.login-copy p {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, 0.67);
  font-size: 17px;
  line-height: 1.9;
}

.brand-points {
  display: flex;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-points span {
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

.login-panel {
  display: grid;
  padding: 8vw;
  place-content: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), transparent),
    var(--paper);
}

.login-form {
  width: 360px;
}

.login-form h2 {
  margin: 0 0 9px;
  font-size: 31px;
}

.login-form > p {
  margin: 0 0 34px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.form-group {
  margin-top: 17px;
}

.form-group > label {
  display: block;
  margin-bottom: 8px;
  color: #5d4c43;
  font-size: 13px;
  font-weight: 650;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid #ded2c5;
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  transition:
    border-color 0.17s ease,
    box-shadow 0.17s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #b98e48;
  box-shadow: 0 0 0 3px rgba(201, 155, 72, 0.12);
}

.textarea {
  min-height: 105px;
  line-height: 1.65;
  resize: vertical;
}

.primary,
.secondary,
.danger-button,
.ghost-button {
  display: inline-flex;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 9px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 650;
  gap: 7px;
}

.primary {
  border: 1px solid var(--wine);
  color: #fff;
  background: var(--wine);
  box-shadow: 0 7px 16px rgba(124, 27, 33, 0.14);
}

.primary:hover {
  background: var(--wine-deep);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary {
  border: 1px solid #d9cbbb;
  color: #5e4c42;
  background: #fff;
}

.ghost-button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid transparent;
  color: var(--wine);
  background: var(--wine-soft);
}

.danger-button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid #ead0d1;
  color: var(--red);
  background: #fff7f7;
}

.login-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 25px;
  font-size: 15px;
}

.login-note {
  margin-top: 18px;
  padding: 11px 13px;
  border: 1px solid #eadabf;
  border-radius: 9px;
  color: #8d7146;
  background: #fff9ed;
  font-size: 12px;
  line-height: 1.6;
}

.admin-layout {
  min-height: 100vh;
}

.top-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  height: 68px;
  padding: 0 24px;
  border-bottom: 1px solid #e8ddd2;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(15px);
}

.top-brand,
.top-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

.top-brand .brand-seal {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  background: var(--wine);
  font-size: 22px;
}

.top-brand strong {
  font-size: 16px;
  letter-spacing: 0.04em;
}

.top-brand span {
  padding: 4px 8px;
  border-radius: 999px;
  color: #8a6b35;
  background: #f6ead2;
  font-size: 10px;
  font-weight: 700;
}

.top-actions a {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.admin-body {
  display: grid;
  min-height: calc(100vh - 68px);
  grid-template-columns: 264px minmax(0, 1fr);
}

.channel-sidebar {
  border-right: 1px solid #e3d8cd;
  background: rgba(248, 244, 237, 0.86);
}

.sidebar-head {
  display: flex;
  padding: 21px 16px 12px;
  align-items: center;
  justify-content: space-between;
}

.sidebar-head h2 {
  margin: 0;
  color: #5f5047;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.add-channel {
  width: 30px;
  height: 30px;
  border: 1px solid #decbb4;
  border-radius: 8px;
  color: var(--wine);
  background: #fff;
  font-size: 20px;
}

.channel-list {
  display: grid;
  padding: 3px 10px 20px;
  gap: 5px;
}

.channel-item {
  display: grid;
  width: 100%;
  padding: 12px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  align-items: center;
  color: #4e4038;
  background: transparent;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  text-align: left;
}

.channel-item:hover {
  background: rgba(255, 255, 255, 0.65);
}

.channel-item.active {
  border-color: #e4d2ba;
  background: #fffdf9;
  box-shadow: 0 5px 16px rgba(79, 50, 32, 0.07);
}

.platform-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.platform-mark.wechat {
  background: #1aad19;
}

.platform-mark.alipay {
  background: #1677ff;
}

.channel-item strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-item small {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: #a18f82;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4b9b0;
}

.status-dot.enabled {
  background: #38a169;
  box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.12);
}

.sidebar-foot {
  padding: 16px;
  color: #a09083;
  font-size: 10px;
  line-height: 1.65;
}

.admin-main {
  min-width: 0;
  padding: 30px clamp(24px, 3.5vw, 58px) 70px;
}

.channel-heading {
  display: flex;
  margin-bottom: 25px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
}

.channel-heading h1 {
  margin: 0 0 8px;
  font-size: 30px;
  letter-spacing: -0.02em;
}

.channel-subline {
  display: flex;
  color: var(--muted);
  font-size: 12px;
  gap: 13px;
  align-items: center;
}

.platform-pill {
  padding: 4px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.platform-pill.wechat {
  background: #1aad19;
}

.platform-pill.alipay {
  background: #1677ff;
}

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

.tabs {
  display: flex;
  margin-bottom: 19px;
  border-bottom: 1px solid var(--line);
  gap: 26px;
}

.tab {
  position: relative;
  padding: 12px 0;
  border: 0;
  color: #918177;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

.tab.active {
  color: var(--wine);
}

.tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  content: "";
  background: var(--wine);
}

.panel {
  animation: panel-in 0.2s ease;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(65, 38, 25, 0.045);
}

.card + .card {
  margin-top: 14px;
}

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

.card-head h2 {
  margin: 0;
  font-size: 15px;
}

.card-head p {
  margin: 5px 0 0;
  color: #9b8a80;
  font-size: 11px;
  line-height: 1.5;
}

.card-body {
  padding: 20px;
}

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

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

.inline-check {
  display: flex;
  min-height: 43px;
  align-items: center;
  color: #5c4a40;
  font-size: 13px;
  gap: 9px;
}

.inline-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--wine);
}

.help {
  margin: 6px 0 0;
  color: #9b8a80;
  font-size: 10px;
  line-height: 1.55;
}

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

.color-field {
  display: flex;
  min-height: 43px;
  padding: 7px 9px;
  border: 1px solid #ded2c5;
  border-radius: 9px;
  align-items: center;
  background: #fff;
  gap: 9px;
}

.color-field input[type="color"] {
  width: 30px;
  height: 27px;
  padding: 0;
  border: 0;
  background: transparent;
}

.color-field input[type="text"] {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: #5f4d43;
  background: transparent;
  font-size: 11px;
}

.save-bar {
  position: sticky;
  z-index: 35;
  bottom: 18px;
  display: flex;
  margin-top: 18px;
  padding: 12px 15px;
  border: 1px solid #e1d2bf;
  border-radius: 12px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 10px 35px rgba(66, 38, 24, 0.12);
  backdrop-filter: blur(15px);
}

.save-state {
  color: #9a887a;
  font-size: 11px;
}

.save-state.dirty {
  color: #a16c1d;
}

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

.content-toolbar input {
  max-width: 360px;
}

.content-tree {
  display: grid;
  gap: 9px;
}

.tree-details {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.tree-details > summary {
  display: flex;
  padding: 14px 17px;
  align-items: center;
  justify-content: space-between;
  color: #4a3931;
  background: #faf6f0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.tree-details > summary::-webkit-details-marker {
  display: none;
}

.tree-details > summary::after {
  color: #a38e7e;
  content: "⌄";
  font-size: 16px;
}

.tree-details[open] > summary::after {
  transform: rotate(180deg);
}

.tree-body {
  display: grid;
  padding: 15px;
  gap: 12px;
}

.tree-object {
  padding: 12px;
  border: 1px solid #eee4d9;
  border-radius: 10px;
  background: #fffdfa;
}

.tree-object-title {
  margin: 0 0 10px;
  color: #806d60;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tree-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 12px;
}

.tree-field {
  min-width: 0;
}

.tree-field.wide {
  grid-column: 1 / -1;
}

.tree-field > label {
  display: flex;
  margin-bottom: 5px;
  align-items: center;
  justify-content: space-between;
  color: #7d6960;
  font-size: 10px;
  gap: 6px;
}

.tree-field .input,
.tree-field .textarea,
.tree-field .select {
  min-height: 36px;
  padding: 7px 9px;
  font-size: 12px;
}

.tree-field .textarea {
  min-height: 72px;
}

.array-box {
  padding: 11px;
  border: 1px dashed #dccab6;
  border-radius: 10px;
  background: #fffcf7;
}

.array-title {
  display: flex;
  margin-bottom: 9px;
  align-items: center;
  justify-content: space-between;
  color: #756156;
  font-size: 11px;
  font-weight: 700;
}

.array-items {
  display: grid;
  gap: 9px;
}

.array-item {
  position: relative;
  padding: 10px;
  border: 1px solid #eee2d4;
  border-radius: 9px;
  background: #fff;
}

.array-item-head {
  display: flex;
  margin-bottom: 8px;
  align-items: center;
  justify-content: space-between;
  color: #a18a78;
  font-size: 9px;
}

.icon-button {
  display: grid;
  width: 25px;
  height: 25px;
  border: 1px solid #eadfd5;
  border-radius: 7px;
  place-items: center;
  color: #9a8271;
  background: #fff;
  font-size: 12px;
}

.icon-button:hover {
  color: var(--red);
}

.image-field-row {
  display: flex;
  gap: 6px;
}

.image-field-row .input {
  min-width: 0;
  flex: 1;
}

.image-pick {
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid #ddcdbd;
  border-radius: 8px;
  color: var(--wine);
  background: #fff;
  font-size: 10px;
}

.empty-panel {
  display: grid;
  min-height: 280px;
  padding: 40px;
  place-content: center;
  color: #9c8a7f;
  text-align: center;
}

.empty-panel strong {
  margin-bottom: 8px;
  color: #5f4e45;
  font-size: 17px;
}

.empty-panel p {
  margin: 0;
  font-size: 12px;
}

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

.data-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: #9a887b;
  font-size: 10px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #f0e8df;
  color: #4d3d34;
  vertical-align: top;
}

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

.data-table .money {
  color: var(--wine);
  font-weight: 700;
}

.table-empty {
  padding: 50px 20px;
  color: #a08e82;
  text-align: center;
}

.status-select {
  min-height: 31px;
  padding: 5px 8px;
  border: 1px solid #e1d6ca;
  border-radius: 7px;
  color: #67564b;
  background: #fff;
  font-size: 11px;
}

.asset-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(440px, 1.35fr);
  gap: 14px;
  align-items: start;
}

.generator {
  padding: 20px;
}

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

.generator > p {
  margin: 7px 0 17px;
  color: #958277;
  font-size: 11px;
  line-height: 1.6;
}

.config-chip {
  display: inline-flex;
  margin-left: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #2f7456;
  background: #e7f4ed;
  font-size: 9px;
}

.config-chip.off {
  color: #a16718;
  background: #fff2db;
}

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

.asset-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.asset-thumb {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
  background: #f0e7dc;
}

.asset-info {
  padding: 9px;
}

.asset-info strong {
  display: block;
  overflow: hidden;
  color: #4d3d34;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-info small {
  display: block;
  margin-top: 4px;
  color: #a19084;
  font-size: 9px;
}

.asset-actions {
  display: flex;
  margin-top: 7px;
  gap: 5px;
}

.asset-actions button {
  flex: 1;
  padding: 4px;
  border: 1px solid #e7dccf;
  border-radius: 6px;
  color: #776156;
  background: #fff;
  font-size: 9px;
}

.upload-drop {
  display: grid;
  min-height: 90px;
  margin: 16px 0;
  padding: 15px;
  border: 1px dashed #d8c4ac;
  border-radius: 10px;
  place-items: center;
  color: #9b846e;
  background: #fffaf1;
  font-size: 11px;
  text-align: center;
  cursor: pointer;
}

.upload-drop input {
  display: none;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 30px;
  place-items: center;
  background: rgba(38, 23, 18, 0.5);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(580px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 23px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 25px 70px rgba(40, 22, 16, 0.22);
}

.modal.wide-modal {
  width: min(850px, 94vw);
}

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

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

.modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: #8c796d;
  background: #f2e9de;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  margin-top: 22px;
  justify-content: flex-end;
  gap: 8px;
}

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

.media-choice {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.media-choice img {
  width: 100%;
  height: 92px;
  object-fit: cover;
}

.media-choice span {
  display: block;
  overflow: hidden;
  padding: 6px;
  color: #6f5c51;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-toast {
  position: fixed;
  z-index: 150;
  right: 26px;
  bottom: 26px;
  max-width: 430px;
  padding: 11px 16px;
  border-radius: 9px;
  opacity: 0;
  color: #fff;
  background: #31211b;
  box-shadow: 0 10px 35px rgba(35, 20, 14, 0.2);
  font-size: 12px;
  line-height: 1.55;
  transform: translateY(8px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  pointer-events: none;
}

.admin-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@media (max-width: 1200px) {
  body {
    min-width: 900px;
  }

  .admin-body {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .asset-layout {
    grid-template-columns: 1fr;
  }
}
