:root {
  --bg: #f3efe5;
  --surface: #fffaf0;
  --ink: #20302a;
  --muted: #747a70;
  --line: #d9d1c1;
  --brand: #c25434;
  --brand-dark: #9d3f27;
  --danger: #9d2f22;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { margin: 0 0 6px; font: 10px/1.4 "Consolas", "Courier New", monospace; letter-spacing: 0.16em; color: var(--brand); }
h1, h2, h3 { margin: 0; font-family: "Songti SC", "Noto Serif SC", Georgia, serif; }
h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 22px; line-height: 1.3; }
h3 { font-size: 16px; }
p { margin: 0; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 20%, #e4d2b6 0, transparent 45%), var(--bg); }
.login-card { width: min(400px, 100%); padding: 34px 30px 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 24px 70px rgba(32, 48, 42, 0.12); display: flex; flex-direction: column; gap: 10px; }
.login-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--surface); font-family: Georgia, serif; font-size: 23px; font-style: italic; }
.login-card h1 { margin-top: 4px; }
.login-card .muted { margin-bottom: 14px; font-size: 13px; line-height: 1.7; }

.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--surface); font-family: Georgia, serif; font-style: italic; font-size: 17px; }
.brand strong { display: block; font-size: 14px; }
.brand .muted { display: block; margin-top: 2px; font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.status { font-size: 11px; color: var(--muted); }

.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { padding: 22px 16px; border-right: 1px solid var(--line); background: #f8f3e8; }
.sidebar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 6px 14px; }
.sidebar-head h2 { font-size: 20px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 20px; line-height: 1; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.new-page { display: flex; gap: 8px; padding: 0 6px 14px; }
.new-page .input { min-width: 0; }
.page-list { display: flex; flex-direction: column; gap: 6px; }
.page-item { width: 100%; padding: 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; }
.page-item:hover { background: #efe6d5; }
.page-item.active { border-color: var(--line); background: var(--surface); box-shadow: 0 4px 18px rgba(32, 48, 42, 0.05); }
.page-item strong { display: block; font-size: 13px; font-weight: 600; }
.page-item span { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); }
.empty { padding: 14px 8px; font-size: 12px; line-height: 1.7; }

.editor { min-width: 0; padding: 28px; }
.editor-empty { max-width: 520px; margin: 12vh auto 0; text-align: center; }
.editor-empty h2 { margin: 8px 0 10px; }
.editor-empty .muted { font-size: 13px; line-height: 1.8; }
.page-form { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.editor-head h2 { font-size: 28px; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 11px; }
.card h3 { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.card-head h3 { padding: 0; border: 0; }
.field-label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--muted); }
.input { width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf8; font-size: 13px; }
.input:focus { outline: 2px solid rgba(194, 84, 52, 0.25); border-color: var(--brand); }
.input.color { padding: 4px; height: 40px; }
.row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hint { color: var(--muted); font-size: 10px; line-height: 1.7; }
.btn { height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.btn-primary:hover { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(157, 47, 34, 0.3); color: var(--danger); background: transparent; }
.btn-danger:hover { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 11px; }
.upload-label { display: inline-flex; align-items: center; justify-content: center; }
.asset-list { display: flex; flex-direction: column; gap: 7px; }
.asset { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: #fffdf8; }
.asset-preview { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 6px; background: #eee6d7; color: var(--muted); font: 9px/1.2 monospace; overflow: hidden; }
.asset-preview img { width: 100%; height: 100%; object-fit: cover; }
.asset-name { min-width: 0; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta { margin-top: 2px; color: var(--muted); font-size: 9px; }
.asset-delete { border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.asset-delete:hover { color: var(--danger); }
.publish-card { gap: 10px; }
.publish-body { display: flex; flex-direction: column; gap: 12px; }
.publish-link { color: var(--brand); font-size: 12px; text-decoration: none; }
.publish-link:hover { text-decoration: underline; }
.qr-wrap { display: flex; align-items: center; gap: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
.qr-box { width: 132px; height: 132px; flex: 0 0 132px; display: grid; place-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-box img { width: 100%; height: 100%; display: block; }
.qr-side { display: flex; flex-direction: column; gap: 8px; }
.qr-side .btn { align-self: flex-start; }
.error { min-height: 18px; margin: 0; color: var(--danger); font-size: 11px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 15px; border-radius: 10px; background: var(--ink); color: var(--surface); font-size: 12px; opacity: 0; transform: translateY(8px); transition: opacity 0.18s, transform 0.18s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .page-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor { padding: 18px; }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 14px; }
  .brand .muted, .status { display: none; }
  .editor-head { flex-direction: column; }
  .editor-actions { width: 100%; justify-content: flex-start; }
  .page-list { grid-template-columns: 1fr; }
}
