:root {
  color-scheme: light;
  --ink: #18323f;
  --muted: #657983;
  --line: #d8e2e5;
  --canvas: #f3f6f7;
  --paper: #fff;
  --blue: #087e9e;
  --blue-dark: #075b72;
  --blue-soft: #e5f3f5;
  --green: #287a59;
  --red: #a13d36;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #e7f3f4, #f7f8f7 58%, #edf2f3); }
.login-panel { width: min(100%, 410px); padding: 38px 40px 34px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; }
.login-brand { display: inline-flex; height: 66px; margin-bottom: 24px; }
.login-brand img { max-width: 190px; height: 66px; object-fit: contain; object-position: left center; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font: 700 11px/1.4 Arial, sans-serif; }
.login-panel h1 { margin: 0 0 28px; font-size: 25px; font-weight: 650; }
.login-panel > label, .password-dialog label { display: grid; gap: 8px; margin: 0 0 17px; color: #425963; font-size: 13px; font-weight: 600; }
.login-panel input, .password-dialog input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 3px; background: #fff; outline: none; }
.login-panel input:focus, .password-dialog input:focus, .text-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(8,126,158,.12); }
.primary-button, .secondary-button, .icon-text-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding: 0 14px; border: 1px solid transparent; border-radius: 3px; text-decoration: none; font-size: 13px; font-weight: 650; white-space: nowrap; }
.primary-button { color: #fff; background: var(--blue); }
.primary-button:hover { background: var(--blue-dark); }
.primary-button:disabled, .secondary-button:disabled, button:disabled { cursor: wait; opacity: .6; }
.login-panel .primary-button { width: 100%; margin-top: 5px; }
.secondary-button { color: var(--blue-dark); border-color: #bfd5dc; background: #fff; }
.secondary-button:hover { border-color: var(--blue); background: #f2fafb; }
.icon-text-button { color: #435b66; border-color: var(--line); background: transparent; }
.icon-text-button:hover { color: var(--blue-dark); background: #f0f6f7; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 13px; }

.admin-header { position: sticky; z-index: 5; top: 0; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 26px; background: var(--paper); border-bottom: 1px solid var(--line); }
.admin-brand { display: flex; min-width: 210px; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 700; }
.admin-brand img { width: 95px; height: 42px; object-fit: contain; object-position: left center; }
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.save-status { margin-right: 4px; color: var(--muted); font-size: 12px; }
.save-button { min-width: 94px; }
.admin-layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.admin-sidebar { position: sticky; top: 68px; align-self: start; min-height: calc(100vh - 68px); padding: 24px 14px; background: #edf2f3; border-right: 1px solid var(--line); }
.admin-sidebar > p { margin: 0 10px 12px; color: #7a8c92; font-size: 11px; font-weight: 700; }
.admin-sidebar nav { display: grid; gap: 3px; }
.section-button { display: flex; min-height: 40px; align-items: center; width: 100%; padding: 0 10px; color: #445b64; text-align: left; border: 0; border-radius: 3px; background: transparent; font-size: 13px; }
.section-button:hover { background: #e2eaec; }
.section-button.is-active { color: var(--blue-dark); background: #fff; box-shadow: inset 3px 0 var(--blue); font-weight: 700; }
.editor-main { width: min(100%, 1120px); margin: 0 auto; padding: 34px 42px 70px; }
.editor-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 27px; }
.editor-heading .eyebrow { margin-bottom: 6px; }
.editor-heading h1 { margin: 0; font-size: 25px; line-height: 1.3; font-weight: 650; }
.dirty-indicator { color: #9c6921; font-size: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { min-width: 0; }
.field-label { display: grid; gap: 7px; color: #405761; font-size: 12px; font-weight: 650; }
.field-caption { display: block; margin-bottom: 8px; color: #405761; font-size: 12px; font-weight: 650; }
.text-input { width: 100%; min-height: 40px; padding: 9px 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; outline: none; background: #fff; font-size: 13px; font-weight: 400; }
.text-area { min-height: 84px; resize: vertical; line-height: 1.6; }
.nested-group { padding: 0 0 23px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.nested-group:last-child { border-bottom: 0; }
.nested-group > h2, .repeat-group > h2 { margin: 0 0 15px; font-size: 15px; font-weight: 700; }
.repeat-list { display: grid; gap: 12px; }
.repeat-item { padding: 17px 18px 19px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.repeat-item h3 { margin: 0 0 16px; color: #35515c; font-size: 13px; font-weight: 700; }
.repeat-item .field-grid { gap: 14px 18px; }
.repeat-item .field { margin-bottom: 0; }
.repeat-item .image-field { grid-column: 1 / -1; }
.repeat-group { margin-bottom: 24px; }
.image-row { display: flex; min-width: 0; align-items: start; gap: 12px; }
.image-preview { flex: 0 0 136px; width: 136px; height: 92px; object-fit: contain; border: 1px solid var(--line); border-radius: 3px; background: #f4f7f8; }
.image-controls { display: grid; flex: 1; min-width: 0; gap: 8px; justify-items: start; }
.image-controls .image-path { width: 100%; }
.upload-button { min-width: 90px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; color: #fff; background: #236a55; border-radius: 3px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; font-size: 13px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #9d403b; }
.password-dialog { width: min(100% - 32px, 420px); padding: 24px; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 20px 70px rgba(20,45,55,.2); }
.password-dialog::backdrop { background: rgba(14,36,46,.45); }
.password-dialog form { display: grid; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.dialog-heading h2 { margin: 0; font-size: 18px; }
.close-button { width: 32px; height: 32px; border: 0; border-radius: 3px; color: #586c73; background: #eef3f4; font-size: 19px; }
.password-dialog small { color: var(--muted); font-size: 11px; font-weight: 400; }

@media (max-width: 900px) {
  .admin-header { align-items: flex-start; padding: 10px 16px; }
  .admin-brand { min-width: auto; }
  .admin-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .editor-main { padding: 30px 24px 60px; }
  .header-right { gap: 6px; }
}
@media (max-width: 650px) {
  .admin-header { position: static; display: grid; gap: 8px; padding: 8px 14px 12px; }
  .admin-brand { height: 40px; }
  .admin-brand img { width: 80px; height: 36px; }
  .header-right { justify-content: flex-start; }
  .save-status { width: 100%; }
  .admin-layout { display: block; min-height: 0; }
  .admin-sidebar { position: static; min-height: 0; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-sidebar > p { display: none; }
  .admin-sidebar nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .section-button { width: auto; flex: 0 0 auto; min-height: 36px; padding: 0 11px; border: 1px solid transparent; }
  .section-button.is-active { border-color: #bfdae0; box-shadow: none; }
  .editor-main { padding: 25px 16px 48px; }
  .editor-heading { align-items: start; flex-direction: column; gap: 7px; margin-bottom: 20px; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .repeat-item { padding: 15px 13px; }
  .image-row { flex-direction: column; }
  .image-preview { width: min(100%, 240px); height: 140px; flex-basis: auto; }
  .image-controls { width: 100%; }
  .login-panel { padding: 30px 24px 24px; }
}
