:root {
  --bg: #f7f4ee;
  --surface: #fffdfa;
  --ink: #23302a;
  --ink-2: #5c6b62;
  --ink-3: #8a948d;
  --green: #2f4b3c;
  --moss: #7c8b6f;
  --line: #e6e0d4;
  --rust: #b05a3a;
  --serif: "Songti SC", "STSong", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.login-card { width: min(420px, 100%); padding: 52px; background: var(--surface); border: 1px solid var(--line); }
.brand-mark { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: var(--bg); font: 30px var(--serif); }
.eyebrow { margin: 24px 0 6px; color: var(--moss); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; }
h1 { margin: 0; font: 34px/1.3 var(--serif); }
.muted { color: var(--ink-3); }
label { display: grid; gap: 8px; color: var(--ink-2); font-size: 13px; }
.login-card form { display: grid; gap: 14px; margin-top: 32px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 11px 13px; border-radius: 6px; outline: none; }
textarea { resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus, .editor:focus { border-color: var(--moss); box-shadow: 0 0 0 3px rgb(124 139 111 / 12%); }

.primary, .secondary, .danger { border: 1px solid transparent; border-radius: 6px; padding: 11px 18px; }
.primary { background: var(--green); color: white; }
.secondary { border-color: var(--line); background: white; color: var(--ink-2); }
.danger { background: transparent; color: var(--rust); }
.compact { padding-inline: 28px; }
.small { padding: 9px 12px; white-space: nowrap; }
.error { min-height: 20px; margin: 0; color: var(--rust); font-size: 13px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 340px 1fr; }
.sidebar { height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; background: #f1ede3; border-right: 1px solid var(--line); }
.side-head { padding: 28px 26px 18px; display: flex; align-items: center; justify-content: space-between; }
.side-head .eyebrow { margin: 0 0 5px; }
.side-head h1 { font-size: 28px; }
.round { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--green); color: white; font-size: 24px; }
.filters { display: grid; grid-template-columns: 1fr 112px; gap: 8px; padding: 0 20px 16px; }
.post-list { overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.post-item { width: 100%; padding: 17px 22px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); }
.post-item:hover, .post-item.active { background: rgb(255 255 255 / 68%); }
.post-title { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 17px/1.5 var(--serif); }
.post-meta { display: flex; gap: 10px; margin-top: 5px; color: var(--ink-3); font-size: 12px; }
.draft { color: var(--rust); }
.load-more { margin: 12px 20px; border: 0; color: var(--green); background: transparent; }
.side-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--ink-3); font-size: 12px; }
.text-button { padding: 0; border: 0; background: none; color: var(--ink-2); }

.workspace { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.workspace-head { height: 72px; padding: 0 34px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: rgb(247 244 238 / 92%); }
.actions { display: flex; gap: 8px; }
.status-pill { display: inline-block; padding: 4px 9px; border-radius: 20px; background: #e5eadf; color: var(--green); font-size: 12px; }
.save-state { margin-left: 10px; color: var(--ink-3); font-size: 12px; }
.editor-scroll { overflow-y: auto; flex: 1; padding: 54px max(40px, calc((100% - 820px) / 2)) 120px; }
.title-input { padding: 0 0 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font: 38px/1.35 var(--serif); }
.title-input:focus { box-shadow: none; border-color: var(--green); }
.meta-grid { margin: 30px 0; display: grid; gap: 16px; }
.inline-field { display: flex; gap: 8px; }
.cover-preview { height: 250px; margin-bottom: 24px; border-radius: 8px; background: center / cover no-repeat; border: 1px solid var(--line); }
.toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 5px; padding: 10px; border: 1px solid var(--line); background: var(--surface); }
.toolbar button { min-width: 36px; height: 34px; padding: 0 9px; border: 0; background: transparent; color: var(--ink-2); border-radius: 4px; }
.toolbar button:hover { background: #f1ede3; color: var(--green); }
.editor { min-height: 480px; padding: 38px 12px; border: 1px solid transparent; outline: none; color: #3a453e; font-size: 17px; line-height: 1.9; }
.editor:empty::before { content: attr(data-placeholder); color: #a7aea8; }
.editor h2, .editor h3 { color: var(--ink); font-family: var(--serif); line-height: 1.5; }
.editor img { display: block; max-width: 100%; height: auto; margin: 28px auto; border-radius: 6px; }
.editor blockquote { margin: 28px 0; padding: 16px 22px; border-left: 4px solid var(--moss); background: #f1ede3; color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 20; padding: 12px 18px; border-radius: 6px; background: var(--ink); color: white; box-shadow: 0 8px 30px rgb(0 0 0 / 18%); }

@media (max-width: 820px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: 44vh; }
  .workspace { height: auto; min-height: 100vh; }
  .workspace-head { position: sticky; top: 0; z-index: 5; padding: 0 16px; }
  .editor-scroll { padding: 30px 18px 100px; overflow: visible; }
  .title-input { font-size: 30px; }
}

/* ---------- 视图切换 ---------- */
.view-nav { display: flex; gap: 6px; padding: 0 20px 14px; }
.nav-item { flex: 1; padding: 9px 12px; border: 1px solid var(--line); background: white; color: var(--ink-2); border-radius: 6px; font-size: 13px; }
.nav-item.active { background: var(--green); border-color: var(--green); color: white; }

/* ---------- 案例工作台 ---------- */
.cases-shell { min-height: 100vh; padding: 34px clamp(20px, 4vw, 48px) 70px; }
.cases-headline { max-width: 1500px; margin: 0 auto; }
.cases-layout { max-width: 1500px; min-height: 690px; margin: 22px auto 0; display: grid; grid-template-columns: 290px minmax(0, 1fr); border: 1px solid var(--line); background: var(--surface); }
.case-admin-list { background: #f1ede3; border-right: 1px solid var(--line); }
.case-admin-item { width: 100%; padding: 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.case-admin-item:hover, .case-admin-item.active { background: var(--surface); }
.case-admin-item strong { display: block; font: 18px/1.4 var(--serif); }
.case-admin-item span { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--ink-3); font-size: 11px; }
.case-admin-item i { font-style: normal; }
.case-admin-item .is-draft { color: var(--rust); }
.case-list-empty { padding: 38px 20px; color: var(--ink-3); text-align: center; font-size: 13px; }
.case-editor-panel { min-width: 0; }
.case-editor-head { min-height: 68px; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: rgb(247 244 238 / 78%); }
.case-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.case-form { display: grid; gap: 18px; padding: 34px clamp(24px, 4vw, 58px) 70px; border-right: 1px solid var(--line); }
.case-form label > span, .case-gallery-title strong { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.case-fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.case-options-row { grid-template-columns: 1fr 110px 170px; align-items: end; }
.case-featured-check { min-height: 43px; display: flex; grid-template-columns: 20px 1fr; align-items: center; gap: 9px; padding: 0 4px; }
.case-featured-check input { width: 18px; height: 18px; accent-color: var(--green); }
.case-gallery-editor { margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.case-gallery-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.case-gallery-title div { display: grid; gap: 5px; }
.case-gallery-title span { color: var(--ink-3); font-size: 12px; }
.case-gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.case-gallery-image { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #e8e6df; }
.case-gallery-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.case-gallery-image button { position: absolute; top: 7px; right: 7px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; color: white; background: rgb(35 48 42 / 84%); }
.case-gallery-empty { grid-column: 1 / -1; padding: 28px; border: 1px dashed #d7d0c3; color: var(--ink-3); text-align: center; font-size: 12px; }
.case-live-preview { padding: 30px 24px; background: #ebe7dc; }
.case-live-preview .eyebrow { margin-top: 0; }
.case-preview-card { position: sticky; top: 26px; overflow: hidden; color: #f7f4ee; background: var(--green); border-radius: 2px 30px 2px 2px; box-shadow: 0 20px 55px rgb(45 58 50 / 14%); }
.case-preview-cover { height: 220px; display: grid; place-items: center; background: #d9ddd5 center / cover no-repeat; color: rgb(35 48 42 / 45%); font: 11px/1 var(--sans); letter-spacing: .2em; }
.case-preview-copy { padding: 24px 25px 30px; }
.case-preview-status { display: inline-block; padding: 5px 9px; border: 1px solid currentColor; font-size: 10px; letter-spacing: .12em; opacity: .72; }
.case-preview-copy h2 { margin: 28px 0 6px; font: 30px/1.3 var(--serif); }
.case-preview-type { margin: 0; font-size: 12px; letter-spacing: .08em; opacity: .7; }
.case-preview-story { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid currentColor; font-size: 13px; line-height: 1.8; opacity: .86; }
.case-preview-card.tone-paper { color: var(--ink); background: #efe8da; }
.case-preview-card.tone-earth { color: var(--ink); background: #ddd3c0; }
.case-preview-card.tone-ink { color: #f5f0e5; background: #292c2a; }
.case-preview-card.tone-clay { color: #fff8ec; background: #a8674e; }
.case-preview-note { margin: 16px 4px; color: var(--ink-3); font-size: 11px; line-height: 1.7; }

/* ---------- 编辑区：分类与日期字段 ---------- */
.meta-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.meta-grid .span-2 { grid-column: span 2; }

/* ---------- 审核界面 ---------- */
.review-shell { min-height: 100vh; padding: 34px clamp(20px, 4vw, 48px) 80px; }
.review-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.review-head h1 { font-size: 32px; }
.review-head .muted { margin: 8px 0 0; font-size: 13px; }
.review-filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(5, minmax(120px, 1fr)); gap: 10px; margin: 22px 0 14px; }
.batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; background: #f1ede3; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; }
.batch-bar .check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.batch-group { display: flex; align-items: center; gap: 8px; }
.batch-group select { width: auto; min-width: 130px; padding: 8px 10px; font-size: 13px; }
.check input[type="checkbox"], .review-table input[type="checkbox"], .batch-bar input[type="checkbox"] { width: auto; }
.review-table-wrap { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.review-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.review-table th { padding: 12px 14px; text-align: left; background: #f7f4ee; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: 12px; font-weight: 500; letter-spacing: .04em; }
.review-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.review-table tr:last-child td { border-bottom: 0; }
.review-table tr.is-hidden { background: #fbf7f4; }
.review-table tr.is-hidden .link-title { color: var(--ink-3); }
.col-check { width: 36px; }
.col-date { width: 110px; }
.col-cat { width: 210px; }
.col-status { width: 84px; }
.col-act { width: 76px; }
.cell-date { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.cell-excerpt { margin: 5px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cell-cat select { padding: 6px 8px; font-size: 12px; margin-bottom: 5px; }
.link-title { padding: 0; border: 0; background: none; color: var(--ink); font: 16px/1.5 var(--serif); text-align: left; }
.link-title:hover { color: var(--green); text-decoration: underline; }
.status-pill.is-draft { background: #f3e3dc; color: var(--rust); }

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

/* ---------- 审核预设筛选 ---------- */
.batch-group.presets { margin-left: auto; }
.preset-label { font-size: 12px; }
.batch-group.presets button { white-space: nowrap; }

/* ---------- 访客素材 ---------- */
.materials-shell { min-height: 100vh; padding: 34px clamp(20px, 4vw, 48px) 80px; }
.materials-toolbar { display: flex; gap: 10px; margin: 22px 0 14px; }
.materials-toolbar select { width: 180px; }
.materials-layout { min-height: 560px; display: grid; grid-template-columns: minmax(260px, 340px) 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.materials-list { border-right: 1px solid var(--line); background: #f1ede3; }
.material-card { width: 100%; display: grid; gap: 8px; padding: 18px 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.material-card:hover, .material-card.active { background: var(--surface); }
.material-card-top { display: flex; align-items: center; justify-content: space-between; color: var(--ink-3); font-size: 11px; }
.material-state { padding: 4px 7px; border-radius: 20px; color: var(--green); background: #e5eadf; }
.state-contacted { color: #805126; background: #f3e8d5; }
.state-archived { color: var(--ink-3); background: #e9e7e1; }
.material-card-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 16px/1.5 var(--serif); }
.material-card-meta { color: var(--ink-3); font-size: 12px; }
.material-detail { min-width: 0; padding: clamp(24px, 4vw, 54px); }
.material-empty { padding: 50px 24px; color: var(--ink-3); text-align: center; }
.material-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.material-detail-head .eyebrow { margin-top: 0; }
.material-detail-head h2 { margin: 0; font: 28px/1.4 var(--serif); }
.material-status-select { width: 150px; }
.material-sources { display: grid; gap: 12px; padding: 26px 0; }
.material-source { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 14px; align-items: start; font-size: 14px; }
.material-source strong { color: var(--ink-2); font-weight: 500; }
.material-source a, .material-source span { color: var(--ink); overflow-wrap: anywhere; }
.material-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.material-gallery a { aspect-ratio: 1; overflow: hidden; border-radius: 7px; background: #eee; }
.material-gallery img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .2s ease; }
.material-gallery a:hover img { transform: scale(1.025); }

@media (max-width: 760px) {
  .materials-layout { grid-template-columns: 1fr; }
  .materials-list { max-height: 380px; overflow-y: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .material-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .material-detail-head { display: grid; }
  .cases-layout { grid-template-columns: 1fr; }
  .case-admin-list { max-height: 310px; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .case-editor-head { align-items: flex-start; flex-direction: column; }
  .case-editor-grid { grid-template-columns: 1fr; }
  .case-form { border-right: 0; }
  .case-fields-row, .case-options-row { grid-template-columns: 1fr; }
  .case-live-preview { border-top: 1px solid var(--line); }
  .case-preview-card { position: static; }
  .case-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
