:root {
  --bg: #f3efe6;
  --paper: #fffdf8;
  --ink: #1c1915;
  --muted: #6f675c;
  --line: #e4d9c8;
  --side: #172033;
  --side-text: #efe7da;
  --accent: #b8432f;
  --accent-ink: #fff8f4;
  --teal: #1f6b56;
  --gold: #8d6424;
  --warn: #fff4d6;
  --shadow: 0 12px 30px rgba(48, 32, 16, 0.06);
  --font: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 650; letter-spacing: 0.01em; }
h1 { font-size: 1.7rem; margin: 0.2rem 0; }
h2 { font-size: 1.1rem; margin: 0 0 0.8rem; }
button, input, select, textarea { font: inherit; color: inherit; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-text); padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; }
.sidebar a { color: var(--side-text); text-decoration: none; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand strong { display: block; font-size: 1.05rem; }
.brand small { color: #c9bfb0; }
.seal { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #d7b089; color: #f4efe4; font-family: "Songti SC", "SimSun", serif; font-size: 22px; }
.seal-lg { width: 72px; height: 72px; font-size: 36px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { padding: 8px 10px; border-radius: 8px; }
.sidebar nav a.on, .sidebar nav a:hover { background: rgba(255,255,255,0.08); }
.side-logout { margin-top: auto; }
.side-logout button { width: 100%; background: transparent; color: #d9d0c3; border: 1px solid rgba(255,255,255,0.18); border-radius: 8px; padding: 8px; cursor: pointer; }
.workspace { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; border-bottom: 1px solid var(--line); background: rgba(255,253,248,0.8); position: sticky; top: 0; z-index: 5; }
.who { display: flex; gap: 8px; align-items: center; }
.role { font-size: 12px; color: var(--gold); border: 1px solid #e4d3ae; padding: 2px 8px; border-radius: 999px; }
.nav-toggle, .filter-toggle { display: none; }
main { padding: 28px; max-width: 1180px; }
.page-head, .toolbar, .head-actions, .form-actions, .search-tools, .lib-tabs, .chips { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-head { justify-content: space-between; margin-bottom: 18px; }
.eyebrow { margin: 0; color: var(--gold); font-size: 13px; letter-spacing: 0.12em; }
.card, .auth-card, .record-card, .file-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.card { padding: 18px; margin-bottom: 16px; }
.stat-grid, .split-2, .detail-grid, .browse, .search-split { display: grid; gap: 16px; }
.stat-grid { grid-template-columns: repeat(3, 1fr); margin-bottom: 16px; }
.split-2 { grid-template-columns: 1fr 1fr; }
.detail-grid { grid-template-columns: 1.4fr 0.8fr; align-items: start; }
.browse { grid-template-columns: 250px 1fr; align-items: start; }
.search-split { grid-template-columns: 360px 1fr; align-items: start; }
.stat { padding: 16px; color: inherit; text-decoration: none; }
.stat strong { display: block; font-size: 2rem; font-variant-numeric: tabular-nums; }
.stat small, .muted, .meta-line { color: var(--muted); }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 8px 12px; cursor: pointer; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.btn:hover { text-decoration: none; border-color: #c9b89a; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-danger { color: var(--accent); }
.btn-small { padding: 4px 8px; font-size: 13px; }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.flash-ok { background: #e7f4ee; color: var(--teal); }
.flash-err { background: #fdeceb; color: #8d2d24; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #efe8dc; }
.badge-published { background: #e5f3ec; color: var(--teal); }
.badge-draft { background: #f3efe6; }
.badge-ready { background: #fff1d6; color: var(--gold); }
.badge-offline, .badge-deleted { background: #f6e4e1; color: #8d2d24; }
.filters { padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 8px; }
.filters fieldset { border: 0; padding: 0; margin: 0; }
.filters legend { font-size: 13px; color: var(--muted); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.check { flex-direction: row; align-items: center; gap: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
input, select, textarea { border: 1px solid #ddd2c2; border-radius: 8px; padding: 8px 10px; background: #fff; }
textarea { width: 100%; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.data-table th { color: var(--muted); font-weight: 600; }
.data-table tr[data-href] { cursor: pointer; }
.data-table tr[data-href]:hover { background: #faf6ef; }
.row-actions form { display: inline; }
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.record-card { display: block; padding: 14px; color: inherit; }
.record-card strong { display: block; margin: 8px 0; }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 32px; text-align: center; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.pager a.on { background: var(--side); color: white; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.span-2 { grid-column: 1 / -1; }
.field i { color: var(--accent); font-style: normal; }
.err, .warn-text { color: #9a3412; }
.low-conf input, .low-conf textarea, .low-conf select { background: #fff6d2; border-color: #e2c36a; }
.meter { height: 8px; background: #efe6d8; border-radius: 99px; width: 180px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--teal); width: 0; }
.meter-box { min-width: 180px; }
.dropzone { border: 1px dashed #c8b79a; border-radius: 12px; padding: 12px; margin: 8px 0; background: #fbf7f0; }
.dropzone.over { background: #fff6d2; }
.progress { height: 6px; background: #efe6d8; border-radius: 99px; margin-top: 8px; }
.progress span { display: block; height: 100%; background: var(--accent); width: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.preview-frame { width: 100%; height: 280px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.preview-img { max-width: 100%; border-radius: 8px; }
.auth-body { min-height: 100vh; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; }
.auth-panel { background: var(--side); color: #f6f0e6; padding: 64px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.auth-panel h1 { font-family: "Songti SC", "SimSun", serif; font-size: 2.4rem; font-weight: 500; }
.auth-card { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.captcha-row span { display: flex; gap: 8px; align-items: center; }
.captcha { height: 44px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line); }
.auth-links { display: flex; gap: 16px; }
.hp { position: absolute; left: -9999px; }
.narrow { max-width: 640px; }
.empty { padding: 28px; text-align: center; }
.search-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; position: relative; }
.search-bar input, .search-bar select { min-width: 140px; }
#q { flex: 1; min-width: 220px; }
.suggest { position: absolute; top: 48px; left: 0; right: 0; background: white; border: 1px solid var(--line); border-radius: 10px; z-index: 4; }
.suggest button { display: block; width: 100%; text-align: left; background: white; border: 0; padding: 8px 12px; cursor: pointer; }
.suggest button:hover { background: #faf6ef; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; color: inherit; }
.lib-tabs a { padding: 6px 10px; border-bottom: 2px solid transparent; color: var(--muted); }
.lib-tabs a.on { color: var(--ink); border-color: var(--accent); }
.hit { display: block; padding: 12px; border-bottom: 1px solid var(--line); color: inherit; }
.hit.on, .hit:hover { background: #fffaf2; text-decoration: none; }
.hit p, .hit small, .hit em { display: block; color: var(--muted); font-style: normal; }
.search-list { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: auto; max-height: 70vh; }
.summary-pane { min-height: 240px; }
mark { background: #ffe08a; color: inherit; padding: 0 2px; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
.warn-card { background: #fff8ea; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; transform: translateX(-105%); z-index: 20; transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .nav-toggle, .filter-toggle { display: inline-flex; }
  .stat-grid, .split-2, .detail-grid, .browse, .search-split, .form-grid, .auth-shell { grid-template-columns: 1fr; }
  .filters { display: none; }
  .filters.open { display: flex; }
  .auth-panel { padding: 32px; }
  main { padding: 16px; }
  .data-table thead { display: none; }
  .data-table tr { display: block; border-bottom: 8px solid var(--bg); }
  .data-table td { display: flex; justify-content: space-between; gap: 12px; }
  .data-table td::before { content: attr(data-label); color: var(--muted); }
}
