:root {
  --bg: #f6f2e9;
  --panel: #fffdf8;
  --ink: #171612;
  --muted: #746d60;
  --line: #ded6c7;
  --gold: #9a762b;
  --green: #28755b;
  --red: #b84a42;
  --amber: #a45c18;
  --shadow: 0 20px 52px rgba(35, 30, 20, .08);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgba(246, 242, 233, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand,
.nav-main,
.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.brand {
  text-decoration: none;
  font-weight: 900;
}
.brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #15130f;
  color: #fff;
  font-size: 13px;
}
.nav-main {
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-main a,
.nav-actions a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  border-radius: 10px;
  padding: 8px 10px;
}
.nav-main a:hover,
.nav-actions a:hover {
  color: var(--ink);
  background: #ede5d6;
}
.nav-actions a {
  font-weight: 800;
}
.nav-actions a.primary {
  color: #fff;
  background: #15130f;
}
.nav-actions a.active {
  color: var(--ink);
  background: #fbf6e9;
}
.publish-shell {
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 64px;
}
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 20px;
  align-items: start;
}
.editor-pane,
.notice-panel,
.record-panel,
.gate {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.editor-pane {
  border-radius: 18px;
  padding: clamp(18px, 3vw, 30px);
}
.page-head,
.record-panel-head,
.form-actions,
.tag-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-head,
.record-panel-head {
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h1 {
  margin: 8px 0 8px;
  font-size: 36px;
  line-height: 1.06;
  letter-spacing: 0;
}
.page-head p,
.notice-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.eyebrow {
  color: var(--gold);
  font-weight: 900;
  font-size: 13px;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: grid;
  gap: 8px;
}
.field.full { grid-column: 1 / -1; }
.field > span {
  font-weight: 900;
  color: #3d382f;
}
input,
textarea,
button {
  font: inherit;
}
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
}
textarea {
  min-height: 360px;
  resize: vertical;
  line-height: 1.75;
}
.note-area { min-height: 120px; }
input:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(154, 118, 43, .12);
}
button,
.primary-link {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button.primary,
.primary-link {
  border-color: #15130f;
  background: #15130f;
  color: #fff;
}
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.chip-row,
.tag-list,
.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.chip {
  border-radius: 999px;
  padding: 9px 13px;
}
.chip.active {
  border-color: #15130f;
  background: #15130f;
  color: #fff;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbf6e9;
  color: var(--gold);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
}
.tag button,
.attachment button {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}
.composer {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefa;
  overflow: hidden;
}
.composer.dragging {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(154, 118, 43, .12);
}
.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbf6e9;
}
.tool-btn {
  min-width: 38px;
  height: 36px;
  border-radius: 10px;
  padding: 0 10px;
}
#upload-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 36px;
}
.body-editor {
  border: 0;
  border-radius: 0;
  min-height: 430px;
  background: #fffefa;
  box-shadow: none !important;
}
.drop-zone {
  margin: 0 12px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 13px;
  color: var(--muted);
  text-align: center;
  background: #fcf8ee;
  font-size: 14px;
}
.attachment {
  width: calc(50% - 5px);
  min-width: 260px;
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}
.attachment img {
  width: 64px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0eadc;
}
.attachment .file-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f0eadc;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
}
.attachment a {
  flex: 1;
  min-width: 0;
  color: var(--gold);
  font-weight: 800;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-pane {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 88px;
}
.notice-panel,
.record-panel,
.gate {
  border-radius: 18px;
  padding: 20px;
}
.notice-panel.alert {
  border-color: #e1a950;
  background: #fff8ea;
}
.notice-panel h2,
.record-panel h2 {
  margin: 8px 0 0;
  font-size: 24px;
}
.record-list {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 2px;
}
.record-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefa;
  padding: 14px;
}
.record-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.record-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.35;
}
.record-head span,
.record-meta,
.review-box {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  background: #f4ecd8;
  color: var(--gold);
}
.status.draft { background: #f0eee7; color: #6d675d; }
.status.pending_review { background: #fff2df; color: var(--amber); }
.status.changes_requested,
.status.rejected { background: #fff0ee; color: var(--red); }
.status.published { background: #e8f4ee; color: var(--green); }
.record-body {
  color: #4f493f;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 128px;
  overflow: hidden;
}
.review-box {
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  background: #f9f3e5;
  padding: 10px 12px;
}
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.message {
  min-height: 22px;
  margin: 0 0 16px;
  color: var(--muted);
}
.message.ok { color: var(--green); }
.message.err { color: var(--red); }
.empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}
.gate {
  max-width: 720px;
  margin: 10vh auto 0;
  text-align: center;
}
.gate h1 { margin: 0 0 10px; }
.gate p { color: var(--muted); margin-bottom: 22px; }
.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 21, 16, .34);
}

.modal-card {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(35, 30, 20, .18);
  padding: 22px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.modal-head button {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}

.modal-card label {
  display: grid;
  gap: 8px;
}

.modal-card label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.modal-actions {
  justify-content: flex-end;
}

.modal-actions .primary {
  color: #fff;
  background: #15130f;
}

@media (max-width: 1080px) {
  .workbench {
    grid-template-columns: 1fr;
  }
  .side-pane {
    position: static;
  }
  .record-list {
    max-height: none;
  }
}
@media (max-width: 720px) {
  .topbar,
  .page-head,
  .record-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .nav-main,
  .nav-actions {
    justify-content: flex-start;
  }
  .field-grid {
    grid-template-columns: 1fr;
  }
  .form-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .form-actions button {
    flex: 1 1 auto;
  }
  textarea {
    min-height: 280px;
  }
  .attachment {
    width: 100%;
  }
  .body-editor {
    min-height: 320px;
  }
  .tool-btn {
    min-width: 36px;
  }
}
