:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --surface: #fff;
  --ink: #1f2328;
  --muted: #655d55;
  --line: #ded7cd;
  --accent: #a84c25;
  --soft: #f1e9df;
  --error: #aa2939;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.65; }
header, main, footer { width: min(100% - 48px, 1000px); margin-inline: auto; }
header { display: flex; justify-content: space-between; gap: 20px; align-items: center; min-height: 86px; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); font-size: 24px; font-weight: 750; letter-spacing: -.03em; text-decoration: none; }
.wordmark span { font-size: 12px; font-weight: 500; letter-spacing: 0; margin-left: 14px; color: var(--muted); }
#save-state { font-size: 12px; color: var(--muted); text-align: right; }
.intro { margin: 54px 0 34px; }
h1 { font-size: 38px; line-height: 1.3; font-weight: 650; letter-spacing: -.025em; margin: 0 0 18px; }
p { color: var(--muted); }
.toolbar, .section-heading { display: flex; gap: 16px; justify-content: space-between; align-items: center; }
.toolbar { padding-bottom: 20px; font-size: 13px; color: var(--muted); }
button, input { font: inherit; border: 1px solid var(--line); color: var(--ink); background: var(--surface); border-radius: 8px; padding: 9px 14px; }
button { cursor: pointer; font-size: 13px; transition: background .18s, border-color .18s; }
button:hover { border-color: var(--accent); background: var(--soft); }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
section { border-top: 1px solid var(--line); padding: 28px 0; }
h2 { margin: 0 0 18px; font-size: 19px; font-weight: 600; }
.section-heading h2 { margin: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.field { padding: 13px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.field dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.field dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 14px; }
.field.wide { grid-column: 1 / -1; }
dl { margin: 0; }
.error { color: var(--error); }
details { border-block: 1px solid var(--line); padding: 20px 0; }
summary { cursor: pointer; color: var(--accent); }
pre { font: 12px/1.65 ui-monospace, monospace; overflow: auto; max-height: 560px; padding: 16px; background: var(--soft); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
footer { padding-block: 28px; font-size: 12px; color: var(--muted); }
.admin-intro { margin-top: 40px; }
.login { max-width: 420px; padding: 24px 0; }
.login label { display: block; margin-bottom: 8px; }
.login input { width: 100%; margin-bottom: 16px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.record { width: 100%; text-align: left; display: grid; gap: 6px; margin-bottom: 10px; padding: 18px; }
.record strong { font-weight: 600; }
.record span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-layout { display: grid; grid-template-columns: 300px 1fr; gap: 32px; margin-top: 24px; align-items: start; }
.record[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); }
.admin-detail { min-width: 0; }
.admin-detail .fields { grid-template-columns: 1fr; }
.admin-detail section:first-child { padding-top: 0; border-top: 0; }
.detail-actions { display: flex; gap: 10px; margin-bottom: 20px; }
@media (prefers-color-scheme: dark) {
  :root { --bg: #16181b; --surface: #212429; --ink: #ede7dd; --muted: #c1b7ab; --line: #3a3d41; --accent: #efa27d; --soft: #302820; --error: #ff9ca9; }
}
@media (max-width: 700px) {
  header, main, footer { width: calc(100% - 32px); }
  header { min-height: 72px; }
  .wordmark span { display: block; margin-left: 0; font-size: 11px; }
  .intro { margin-top: 36px; }
  h1 { font-size: 30px; }
  .fields, .admin-layout { grid-template-columns: 1fr; }
  .toolbar { align-items: flex-start; }
  .admin-layout { gap: 24px; }
  #record-list { max-height: 340px; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
.local-test-notice { width: min(100% - 32px, 1000px); margin: 16px auto; padding: 16px; border: 1px solid var(--accent); border-radius: 10px; background: var(--soft); }
.local-test-notice strong { display: block; margin-bottom: 8px; }
.local-test-notice p { margin: 8px 0; font-size: 13px; }
.local-test-notice .fields { margin: 12px 0; }
.local-test-notice a { color: var(--accent); margin-left: 14px; font-size: 13px; }
#local-tracking-notice {
  display: none;
}