:root {
  color-scheme: light;
  --black: #111111;
  --ink: #202020;
  --muted: #707070;
  --line: #dedede;
  --soft: #f4f4f2;
  --white: #ffffff;
  --danger: #9b2424;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f1f1ef; color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 24px; background: var(--white); box-shadow: 0 20px 60px rgba(0,0,0,.07); }
.login-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--black); color: white; font-weight: 750; }
.eyebrow { margin: 24px 0 6px; color: var(--muted); font-size: 11px; letter-spacing: .16em; }
.login h1, .toolbar h1, .dialog-head h2 { margin: 0; color: var(--black); letter-spacing: -.035em; }
.login-copy { color: var(--muted); line-height: 1.75; }
.login form { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #555; font-size: 13px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); padding: 11px 12px; }
textarea { min-height: 104px; resize: vertical; line-height: 1.6; }

.admin { min-height: 100vh; grid-template-columns: 238px minmax(0,1fr); }
.admin:not([hidden]) { display: grid; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-right: 1px solid #222; background: #111; color: white; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 24px; }
.brand > span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #3a3a3a; border-radius: 12px; font-weight: 700; }
.brand div { display: grid; gap: 2px; }
.brand small { color: #8d8d8d; }
#siteNav { display: grid; gap: 6px; }
#siteNav button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; color: #aaa; cursor: pointer; text-align: left; }
#siteNav button:hover, #siteNav button.is-active { background: white; color: #111; }
#siteNav small { opacity: .6; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 2px; padding-top: 20px; border-top: 1px solid #292929; }
.text-button { padding: 9px 8px; border: 0; background: transparent; color: #aaa; cursor: pointer; text-align: left; text-decoration: none; font-size: 13px; }
.text-button:hover { color: white; }
.file-button input { display: none; }

.workspace { min-width: 0; padding: 26px clamp(18px,4vw,54px) 60px; }
.toolbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; max-width: 1180px; margin: 0 auto 20px; }
.toolbar .eyebrow { margin-top: 0; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); cursor: pointer; text-decoration: none; }
.button:hover { border-color: #999; }
.button.primary { border-color: var(--black); background: var(--black); color: white; }
.button.danger { color: var(--danger); }
.notice { max-width: 1180px; margin: 0 auto 16px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72); color: var(--muted); font-size: 13px; }
.notice.is-error { border-color: #e0b3b3; color: var(--danger); background: #fff7f7; }
.editor { max-width: 1180px; margin: auto; display: grid; gap: 16px; }
.overview-card { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr); gap: 20px; padding: 22px; border: 1px solid #d6d6d4; border-radius: 18px; background: linear-gradient(135deg,#fff 0%,#f7f7f5 100%); }
.overview-copy { min-width: 0; }
.overview-kicker { margin: 0 0 8px; color: #777; font-size: 10px; letter-spacing: .16em; }
.overview-copy h2 { margin: 0; color: var(--black); font-size: 22px; letter-spacing: -.035em; }
.overview-copy > p:not(.overview-kicker) { max-width: 640px; margin: 9px 0 14px; color: #686868; line-height: 1.65; }
.overview-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.overview-chips span { padding: 5px 9px; border: 1px solid #ddd; border-radius: 999px; background: #fff; color: #686868; font-size: 11px; }
.overview-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; align-content: stretch; }
.stat-card { display: grid; align-content: center; min-height: 86px; padding: 12px 14px; border: 1px solid #e0e0de; border-radius: 13px; background: rgba(255,255,255,.78); }
.stat-card strong { color: var(--black); font-size: 25px; letter-spacing: -.04em; }
.stat-card span { margin-top: 2px; color: #444; font-size: 12px; }
.stat-card small { margin-top: 3px; color: #8a8a8a; font-size: 11px; }
.empty-state { padding: 48px 28px; border: 1px solid var(--line); border-radius: 18px; background: white; text-align: center; }
.empty-state p { color: var(--muted); }
.object-card, .array-card { border: 1px solid var(--line); border-radius: 18px; background: white; overflow: hidden; }
.card-head { min-height: 66px; padding: 17px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-head h2, .card-head h3 { margin: 0; color: var(--black); font-size: 16px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.fields { padding: 20px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.field-wide { grid-column: 1 / -1; }
.image-field { align-content: start; }
.image-field-preview { display: block; width: 100%; height: 92px; padding: 7px; overflow: hidden; border: 1px dashed #d5d5d2; border-radius: 11px; background: #f7f7f5; }
.image-field-preview[hidden] { display: none; }
.image-field-preview img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 7px; background: #e9e9e6; }
.image-field-preview.is-error::after { display: block; margin-top: -58px; position: relative; color: #888; font-size: 11px; text-align: center; content: "图片无法加载，请检查地址"; }
.nested { padding: 0 20px 20px; display: grid; gap: 14px; }
.array-items { padding: 14px; display: grid; gap: 10px; }
.array-item { border: 1px solid #e4e4e4; border-radius: 14px; background: #fafafa; }
.item-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #e4e4e4; }
.item-head strong { font-size: 13px; }
.item-actions { display: flex; gap: 4px; }
.mini-button { border: 1px solid #ddd; border-radius: 8px; padding: 5px 8px; background: white; color: #555; cursor: pointer; font-size: 12px; }
.mini-button.danger { color: var(--danger); }
.primitive-array { padding: 14px; display: grid; gap: 8px; }
.primitive-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

dialog { width: min(900px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 100px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.5); }
.dialog-card { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; }
.dialog-head .eyebrow { margin-top: 0; }
.dialog-card > p { color: var(--muted); }
.dialog-card textarea { min-height: 55vh; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.icon-close { border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.form-status { min-height: 20px; color: var(--danger); font-size: 13px; }

@media (max-width: 780px) {
  .admin:not([hidden]) { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .brand { padding: 4px 4px 12px; }
  #siteNav { display: flex; overflow-x: auto; }
  #siteNav button { width: auto; flex: 0 0 auto; }
  #siteNav small, .sidebar-bottom { display: none; }
  .workspace { padding: 20px 14px 50px; }
  .toolbar { align-items: flex-start; }
  .overview-card { grid-template-columns: 1fr; padding: 17px; }
  .fields { grid-template-columns: 1fr; padding: 16px; }
  .field-wide { grid-column: auto; }
}
