:root {
  --ink: #282622;
  --ink-soft: #6e6961;
  --paper: #f7f4ee;
  --surface: #fffdf9;
  --surface-muted: #f1ede5;
  --gold: #b78c49;
  --gold-dark: #89652f;
  --line: #e6ded1;
  --danger: #a34e45;
  --success: #4f745e;
  --sidebar: #211f1b;
  --sidebar-muted: #aaa297;
  --shadow: 0 18px 50px rgba(51, 42, 28, .08);
  --radius: 14px;
  --sidebar-width: 248px;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body { margin: 0; min-height: 100vh; background: var(--paper); }

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

::selection { color: #fff; background: var(--gold-dark); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #c9c0b3; background-clip: padding-box; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 28px 20px 22px;
  color: #f4eee4;
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(218, 185, 128, .42);
  border-radius: 50%;
  color: #d6b579;
}

.brand-mark svg { width: 27px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.4; }
.brand strong { display: block; font: 600 21px/1.1 "Songti SC", STSong, serif; letter-spacing: .12em; }
.brand small { display: block; margin-top: 5px; color: #b9ae9e; font-size: 9px; letter-spacing: .28em; }

.nav-list { display: grid; gap: 6px; margin-top: 54px; }
.nav-list a {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border-radius: 11px;
  color: var(--sidebar-muted);
  font-size: 14px;
  font-weight: 520;
  text-decoration: none;
  transition: color .18s ease, background-color .18s ease;
}
.nav-list a:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-list a.active { color: #fff8ed; background: rgba(210, 177, 117, .15); }
.nav-list svg, .icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }
.nav-list a:first-child svg { fill: none; }

.sidebar-foot {
  display: grid;
  gap: 13px;
  margin-top: auto;
  padding: 15px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-status { display: flex; align-items: center; gap: 11px; }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; background: #d0a659; box-shadow: 0 0 0 4px rgba(208,166,89,.12); }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { color: #e7dfd3; font-size: 12px; }
.sidebar-foot small { margin-top: 3px; color: #8f887e; font-size: 10px; }
.sidebar-export { display: none; width: 100%; min-height: 42px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; color: #ded5c8; background: rgba(255,255,255,.055); cursor: pointer; font-size: 12px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid rgba(213, 204, 190, .75);
  background: rgba(247, 244, 238, .92);
  backdrop-filter: blur(18px);
}
.breadcrumb { font-size: 14px; font-weight: 650; letter-spacing: .02em; }
.top-actions { display: flex; gap: 10px; }
.mobile-menu { display: none; }

.button, .icon-button, .text-button {
  border: 0;
  cursor: pointer;
}
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 650;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { color: #fffdf8; background: var(--ink); box-shadow: 0 8px 20px rgba(40,38,34,.14); }
.button-primary:hover { background: #151411; }
.button-gold { color: #fff; background: var(--gold-dark); }
.button-quiet { border: 1px solid var(--line); background: rgba(255,255,255,.7); }
.button-danger { color: var(--danger); border: 1px solid #ead4d0; background: #fff9f8; }
.button[disabled] { cursor: not-allowed; opacity: .45; transform: none; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 10px; background: transparent; }
.icon-button:hover { background: var(--surface-muted); }
.text-button { padding: 0; color: var(--gold-dark); background: transparent; font-size: 13px; font-weight: 650; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }

.page { padding: 34px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font: 600 clamp(27px, 3vw, 38px)/1.15 "Songti SC", STSong, serif; letter-spacing: -.02em; }
.page-heading p { max-width: 680px; margin: 9px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }

.overview-lead {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  overflow: hidden;
  border-radius: var(--radius);
  color: #f5efe4;
  background: #292621;
  box-shadow: var(--shadow);
}
.overview-copy { padding: clamp(32px, 5vw, 64px); }
.overview-copy h1 { max-width: 580px; margin: 0; font: 500 clamp(32px, 4vw, 54px)/1.18 "Songti SC", STSong, serif; letter-spacing: -.025em; }
.overview-copy p { max-width: 600px; margin: 18px 0 0; color: #bdb4a7; line-height: 1.8; }
.overview-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.overview-actions .button-quiet { color: #e9dfcf; border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.06); }
.overview-status { display: flex; flex-direction: column; justify-content: flex-end; padding: 38px; border-left: 1px solid rgba(255,255,255,.08); background: #25221e; }
.status-line { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.status-line:last-child { border: 0; }
.status-line span { color: #9f9689; font-size: 12px; }
.status-line strong { font-size: 15px; font-variant-numeric: tabular-nums; }

.section-row { display: grid; grid-template-columns: 1.35fr .65fr; gap: 22px; margin-top: 22px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 10px 34px rgba(51,42,28,.045); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12px; }
.panel-body { padding: 22px 24px; }

.summary-list { display: grid; }
.summary-item { display: grid; grid-template-columns: 100px 1fr auto; align-items: center; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.summary-item:last-child { border: 0; }
.summary-label { color: var(--ink-soft); font-size: 12px; }
.summary-bar { height: 5px; overflow: hidden; border-radius: 99px; background: #ebe5dc; }
.summary-bar span { display: block; height: 100%; border-radius: inherit; background: var(--gold); }
.summary-value { min-width: 32px; text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

.check-list { display: grid; gap: 14px; }
.check-item { display: flex; align-items: flex-start; gap: 11px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.check-mark { display: grid; flex: 0 0 20px; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: var(--success); background: #e9f0eb; }
.check-mark svg { width: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.check-item.pending .check-mark { color: var(--gold-dark); background: #f4ebda; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-button { min-height: 36px; padding: 0 13px; border: 1px solid transparent; border-radius: 9px; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; }
.filter-button:hover { background: var(--surface-muted); }
.filter-button.active { color: var(--gold-dark); border-color: #decaab; background: #f8f0e3; }
.search-field { position: relative; width: min(100%, 280px); }
.search-field svg { position: absolute; top: 50%; left: 13px; width: 16px; transform: translateY(-50%); fill: none; stroke: var(--ink-soft); stroke-width: 1.7; }
.search-field input { width: 100%; height: 38px; padding: 0 13px 0 39px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: var(--surface); }
.search-field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(183,140,73,.12); }

.data-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 13px 18px; color: var(--ink-soft); background: #f5f1ea; font-size: 11px; font-weight: 650; letter-spacing: .04em; text-align: left; }
.data-table td { padding: 15px 18px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background-color .15s ease; }
.data-table tbody tr:hover { background: #fbf8f2; }
.entity-cell { display: flex; min-width: 230px; align-items: center; gap: 12px; }
.entity-image { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 11px; object-fit: cover; background: #e8e1d7; }
.entity-image.round { border-radius: 50%; }
.entity-cell strong, .entity-cell small { display: block; }
.entity-cell strong { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-cell small { margin-top: 4px; color: var(--ink-soft); font-size: 11px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 9px; border-radius: 8px; color: var(--success); background: #edf3ee; font-size: 11px; font-weight: 650; }
.status-badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-badge.draft { color: #8b7653; background: #f5efe4; }
.status-badge.offline { color: #8b5550; background: #f6ecea; }
.price-text { font-variant-numeric: tabular-nums; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.editor-main, .editor-aside { display: grid; gap: 18px; }
.editor-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.editor-card-head { padding: 20px 22px 0; }
.editor-card-head h2 { margin: 0; font-size: 15px; }
.editor-card-head p { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.editor-card-body { padding: 20px 22px 22px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 650; }
.field-hint { color: var(--ink-soft); font-size: 10px; line-height: 1.55; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #fffefa;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input, .field select { height: 42px; padding: 0 12px; }
.field textarea { min-height: 108px; resize: vertical; padding: 11px 12px; line-height: 1.65; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(183,140,73,.12); }
.field input::placeholder, .field textarea::placeholder { color: #aaa297; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
.field-error { display: none; color: var(--danger); font-size: 10px; }
.field.invalid .field-error { display: block; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr .65fr; gap: 10px; }

.media-control { display: grid; gap: 11px; }
.media-preview { position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 10; border-radius: 11px; background: #e8e1d7; }
.media-preview.square { aspect-ratio: 1; }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-preview span { display: grid; height: 100%; place-items: center; color: #8d857a; font-size: 12px; }
.file-trigger { position: relative; }
.file-trigger input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.file-trigger label { width: 100%; cursor: pointer; }

.toggle-line { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.toggle-line:last-child { border: 0; }
.toggle-copy strong, .toggle-copy small { display: block; }
.toggle-copy strong { font-size: 12px; }
.toggle-copy small { margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.switch { position: relative; width: 40px; height: 23px; flex: 0 0 40px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; cursor: pointer; background: #d8d0c5; transition: background-color .18s ease; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.16); content: ""; transition: transform .18s ease; }
.switch input:checked + span { background: var(--gold-dark); }
.switch input:checked + span::after { transform: translateX(17px); }

.collection-list { display: grid; gap: 10px; }
.collection-item { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #fffefa; }
.collection-thumb { width: 54px; height: 54px; border-radius: 9px; object-fit: cover; background: #e8e1d7; }
.collection-item strong, .collection-item small { display: block; }
.collection-item strong { font-size: 12px; }
.collection-item small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.collection-actions { display: flex; gap: 2px; }
.collection-actions .icon-button { width: 40px; height: 40px; }
.collection-actions svg { width: 16px; }
.empty-collection { padding: 35px 18px; border: 1px dashed #d9cebd; border-radius: 11px; color: var(--ink-soft); text-align: center; font-size: 12px; }

.inline-editor { margin-top: 14px; padding: 18px; border-radius: 12px; background: #f5f1ea; }
.inline-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.inline-editor-head h3 { margin: 0; font-size: 13px; }
.inline-editor .field input, .inline-editor .field textarea, .inline-editor .field select { background: #fff; }
.feature-icon-preview { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: var(--gold-dark); background: #f3e8d5; font: 600 17px/1 "Songti SC", STSong, serif; }
.member-work-group { grid-column: 1 / -1; padding-top: 4px; }
.member-work-group > label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 650; }

.form-actions { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: space-between; gap: 12px; padding: 15px 18px; border-top: 1px solid var(--line); background: rgba(255,253,249,.94); backdrop-filter: blur(12px); }
.form-actions-group { display: flex; gap: 9px; }

.ranking-columns { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.ranking-column { min-width: 220px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ranking-column-head { padding: 18px; border-bottom: 1px solid var(--line); }
.ranking-column-head h2 { margin: 0; font: 600 18px/1.3 "Songti SC", STSong, serif; }
.ranking-column-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 10px; }
.rank-list { display: grid; gap: 8px; padding: 10px; }
.rank-item { display: grid; grid-template-columns: 28px 34px 1fr; align-items: center; gap: 9px; padding: 10px; border-radius: 10px; background: #f6f2eb; }
.rank-number { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: var(--gold-dark); background: #eadcc5; font-size: 10px; font-weight: 800; }
.rank-item img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #e5ddd1; }
.rank-item strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rank-item small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 9px; }
.rank-actions { display: flex; gap: 6px; margin-top: 12px; }

.banner-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.banner-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.banner-visual { position: relative; aspect-ratio: 750 / 360; background: #e7dfd2; }
.banner-visual img { width: 100%; height: 100%; object-fit: cover; }
.banner-order { position: absolute; top: 14px; left: 14px; display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; color: #fff; background: rgba(33,31,27,.78); font-size: 11px; font-weight: 750; }
.banner-content { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; }
.banner-content strong, .banner-content small { display: block; }
.banner-content strong { font-size: 12px; }
.banner-content small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 50; display: grid; gap: 9px; }
.toast { max-width: 360px; padding: 13px 16px; border-radius: 11px; color: #fff; background: #292621; box-shadow: 0 15px 40px rgba(0,0,0,.22); font-size: 12px; animation: toast-in .24s cubic-bezier(.2,.8,.2,1); }
.toast.error { background: #7c3731; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.loading-state, .empty-state { display: grid; min-height: 340px; place-items: center; padding: 50px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-soft); background: var(--surface); text-align: center; }
.empty-state strong { display: block; margin-bottom: 8px; color: var(--ink); font: 600 22px/1.3 "Songti SC", STSong, serif; }
.empty-state p { margin: 0 0 20px; font-size: 12px; }

:focus-visible { outline: 3px solid rgba(183,140,73,.34); outline-offset: 2px; }
.file-trigger input:focus-visible + label, .switch input:focus-visible + span { outline: 3px solid rgba(183,140,73,.34); outline-offset: 3px; }
[role="link"]:focus-visible { outline: 3px solid rgba(183,140,73,.34); outline-offset: -3px; }
.is-saving { cursor: progress; }
.is-saving button, .is-saving input, .is-saving textarea, .is-saving select { pointer-events: none; }

@media (max-width: 1050px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-columns { grid-template-columns: repeat(4, 240px); }
}

@media (max-width: 820px) {
  :root { --sidebar-width: 0px; }
  .sidebar { width: 248px; transform: translateX(-102%); transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: 20px 0 60px rgba(0,0,0,.2); }
  body.menu-open .sidebar { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: grid; }
  .sidebar-export { display: block; }
  .topbar { height: 64px; padding: 0 18px; }
  .breadcrumb { margin-right: auto; margin-left: 8px; }
  .top-actions .button-quiet { display: none; }
  .page { padding: 22px 18px 36px; }
  .overview-lead, .section-row { grid-template-columns: 1fr; }
  .overview-status { border-top: 1px solid rgba(255,255,255,.08); border-left: 0; }
  .data-panel { overflow-x: auto; }
  .data-table { min-width: 760px; }
  .banner-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .page-heading { display: block; }
  .form-grid, .editor-aside { grid-template-columns: 1fr; }
  .inline-fields { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; }
  .filter-group { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filter-button { flex: 0 0 auto; }
  .search-field { width: 100%; }
  .top-actions .button { min-height: 37px; padding: 0 12px; font-size: 11px; }
  .overview-copy { padding: 34px 25px; }
  .overview-status { padding: 25px; }
  .form-actions { margin: 0 -22px -22px; }
  .inline-editor { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
