:root {
  --ink: #1f2933;
  --muted: #687681;
  --line: #d9e1e6;
  --paper: #f4f7f8;
  --white: #ffffff;
  --accent: #147d79;
  --accent-dark: #0d625f;
  --accent-soft: #e5f3f1;
  --danger: #b33f35;
  --shadow: 0 8px 24px rgba(31, 41, 51, .06);
  --admin-header-height: 70px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
.content-width { width: min(640px, calc(100% - 32px)); margin-inline: auto; }

/* Public page */
.account-page { padding: 20px 0 56px; }
.site-hero { margin: 0; }
.hero-image {
  width: calc(100% - var(--hero-margin-horizontal, 0px) - var(--hero-margin-horizontal, 0px));
  max-width: 100%;
  margin: var(--hero-margin-top, 0px) auto var(--hero-margin-bottom, 0px);
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.hero-image img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.paragraph-section { padding: 24px 4px 12px; }
.paragraph-list { display: grid; gap: 10px; }
.content-paragraph { margin: 0; line-height: 1.65; overflow-wrap: anywhere; }
.content-paragraph a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.item-section { padding: 18px 0 28px; }
.item-scroller {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.item-list {
  display: flex;
  width: max-content;
  min-width: 100%;
  justify-content: center;
  gap: 20px;
  padding: 4px 8px 12px;
}
.download-item {
  flex: 0 0 116px;
  margin: 0;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  scroll-snap-align: center;
  cursor: default;
}
.download-item[href] { cursor: pointer; }
.download-item p { text-decoration: underline; text-underline-offset: 3px; }
.download-item[href]:hover p, .download-item[href]:focus-visible p { color: var(--accent-dark); }
.download-item:focus-visible { outline: 3px solid rgba(20, 125, 121, .25); outline-offset: 4px; border-radius: 8px; }
.download-item img {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto 9px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 4px 12px rgba(31, 41, 51, .08);
}
.download-item p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.account-section { padding-top: 4px; }
.account-list { display: grid; gap: 14px; }
.account-card {
  padding: 6px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.credential-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 2px 0;
}
.credential-row + .credential-row { border-top: 1px solid var(--line); }
.account-label { color: var(--muted); font-size: 14px; font-weight: 700; white-space: nowrap; }
.account-value {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.copy-button {
  min-width: 60px;
  height: 36px;
  padding: 0 12px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.copy-button:hover, .copy-button:focus-visible { color: var(--white); background: var(--accent); }
.copy-status {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 28px;
  min-width: 132px;
  max-width: calc(100% - 32px);
  min-height: 0;
  margin: 0;
  padding: 11px 18px;
  color: var(--white);
  background: var(--accent-dark);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(13, 98, 95, .28);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .18s ease, transform .18s ease;
}
.copy-status.is-visible { opacity: 1; transform: translate(-50%, 0); }
.copy-status.is-error { background: var(--danger); }

/* Admin page */
.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  width: 100%;
  height: var(--admin-header-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
  color: #ffffff;
  background: #17212b;
  border-bottom: 1px solid #27343f;
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; font-weight: 750; }
.brand > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: #ffffff; background: var(--accent); font-weight: 800; }
.admin-link { color: #b6c2cc; font-size: 14px; }
.admin-top-actions { display: flex; align-items: center; gap: 20px; }
.admin-link-button { padding: 0; color: #b6c2cc; background: transparent; border: 0; font-size: 14px; cursor: pointer; }
.admin-link:hover, .admin-link:focus-visible, .admin-link-button:hover, .admin-link-button:focus-visible { color: #ffffff; }
.admin-nav, .admin-actions, .private-record-actions { display: flex; align-items: center; gap: 10px; }
.admin-main { width: min(980px, calc(100% - 36px)); margin-inline: auto; padding: calc(var(--admin-header-height) + 64px) 0 90px; }
body.admin-authenticated { background: #f5f7fa; }
body.admin-authenticated .admin-main { width: auto; max-width: none; margin: 0 0 0 240px; padding: calc(var(--admin-header-height) + 42px) 44px 90px; }
.admin-sidebar {
  position: fixed;
  z-index: 5;
  top: var(--admin-header-height);
  bottom: 0;
  left: 0;
  width: 240px;
  padding: 26px 14px;
  background: #17212b;
  border-right: 1px solid #27343f;
}
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  color: #b6c2cc;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.sidebar-link:hover, .sidebar-link:focus-visible { color: #ffffff; background: #263743; }
.sidebar-link.is-active { color: #ffffff; background: var(--accent); }
.sidebar-icon { display: grid; place-items: center; width: 20px; color: currentColor; font-size: 18px; line-height: 1; }
.login-panel { max-width: 480px; margin: 0 auto; padding: 34px; background: var(--white); border: 1px solid var(--line); }
.login-panel h1, .admin-heading h1 { margin: 0 0 10px; font-size: 40px; line-height: 1.2; }
.eyebrow { margin: 0 0 14px; color: var(--accent-dark); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.admin-description { margin: 0; color: var(--muted); }
.login-form { display: grid; gap: 18px; margin-top: 28px; }
.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
}
.button {
  min-height: 42px;
  padding: 9px 18px;
  color: var(--white);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-weight: 700;
  cursor: pointer;
}
.button:hover, .button:focus-visible { background: var(--accent-dark); border-color: var(--accent-dark); }
.button:disabled { opacity: .65; cursor: wait; }
.button-secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.button-secondary:hover, .button-secondary:focus-visible { color: var(--ink); background: var(--white); border-color: var(--ink); }
.editor-form { display: grid; gap: 28px; padding-top: 34px; }
.content-editor-form { padding-bottom: 100px; }
.editor-section { min-width: 0; padding-top: 26px; border-top: 1px solid var(--line); }
.account-editor-section { padding-top: 0; border-top: 0; }
.editor-section h2 { margin: 0; font-size: 22px; line-height: 1.3; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.item-style-grid { margin-top: 18px; }
.single-column { grid-template-columns: minmax(0, 1fr); }
label { display: grid; gap: 7px; color: var(--ink); font-size: 14px; font-weight: 700; }
input, textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-weight: 400;
}
input[type="color"] { min-height: 42px; padding: 4px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(214, 83, 59, .24); border-color: var(--accent); }
.repeaters { display: grid; gap: 16px; }
.repeater-card { min-width: 0; margin: 0; padding: 18px; background: var(--white); border: 1px solid var(--line); }
.repeater-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.repeater-heading legend { padding: 0; color: var(--ink); font-weight: 750; }
.paragraph-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.paragraph-fields label:first-child { grid-column: 1 / -1; }
.remove-button { min-height: 32px; padding: 5px 12px; color: var(--danger); background: transparent; border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.remove-button:hover, .remove-button:focus-visible { color: var(--white); background: var(--danger); border-color: var(--danger); }
.item-editor-body { display: flex; align-items: center; gap: 18px; }
.item-editor-fields { display: grid; flex: 1; gap: 14px; min-width: 0; }
.item-editor-body label { flex: 1; }
.item-preview { flex: 0 0 64px; width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; }
.account-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-button-label-field { margin-top: 18px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 18px; padding-top: 4px; }
.content-form-actions {
  position: fixed;
  z-index: 15;
  right: 0;
  bottom: 0;
  left: 240px;
  margin: 0;
  padding: 14px 44px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 18px rgba(31, 41, 51, .08);
}
.content-form-actions .save-status { margin: 0 auto 0 0; }
.save-status, .form-message { min-height: 24px; color: #29704c; font-size: 14px; }
.error-message, .form-message { color: var(--danger); }

/* Private records */
.private-main { max-width: 980px; }
.private-tool-section { padding-top: 30px; margin-top: 30px; border-top: 1px solid var(--line); }
.password-tool { padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.password-tool-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 16px; }
.password-tool-controls > label:first-child { width: 120px; }
.password-settings-save { align-self: end; }
.check-label { display: flex; align-items: center; gap: 8px; min-height: 42px; font-weight: 400; }
.check-label input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.password-tool-output { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; margin-top: 18px; }
.password-tool-output input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.password-sync-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.password-sync-empty { color: var(--muted); font-size: 14px; }
.private-record-list { display: grid; gap: 16px; }
.private-record-card { display: grid; gap: 14px; padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.private-record-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.private-record-heading strong { font-size: 17px; }
.private-record-card textarea { min-height: 150px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.6; }
.private-body-hidden { color: transparent; text-shadow: 0 0 8px rgba(31, 41, 51, .7); user-select: none; }
.private-record-updated { color: var(--muted); font-size: 12px; }
.private-view-button { color: var(--ink); }
.private-save-actions { margin-top: 20px; }
.nextin-node-card textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.nextin-link-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-top: 16px; }
.nextin-link-box input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.nextin-save-actions { margin-top: 20px; }
.nextin-node-input-label { display: grid; gap: 8px; margin-top: 20px; }
.nextin-node-input { min-height: 260px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55; }
.nextin-links { display: grid; gap: 14px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.nextin-links h2 { margin: 0; }
.nextin-links label { display: grid; gap: 8px; }
.nextin-links input { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.form-hint { color: var(--text-dim); font-size: 13px; line-height: 1.5; }

@media (max-width: 760px) {
  :root { --admin-header-height: 60px; }
  .content-width, .admin-main { width: min(100% - 28px, 980px); }
  .site-header { width: 100%; padding-inline: 14px; gap: 10px; }
  .account-page { padding: 14px 0 44px; }
  .paragraph-section { padding-top: 20px; }
  .item-section { padding-top: 16px; }
  .item-list { gap: 18px; }
  .account-card { padding-inline: 10px; }
  .credential-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; }
  .copy-button { min-width: 56px; padding-inline: 8px; }
  .site-header { height: 60px; }
  .site-header .brand { min-width: 0; font-size: 14px; }
  .admin-top-actions { min-width: 0; gap: 10px; }
  .admin-top-actions .admin-link, .admin-top-actions .admin-link-button { font-size: 12px; white-space: nowrap; }
  .admin-main { padding: calc(var(--admin-header-height) + 42px) 0 64px; }
  body.admin-authenticated .admin-main { width: auto; margin: 0; padding: 24px 14px 64px; }
  .admin-sidebar { position: static; width: auto; margin-top: var(--admin-header-height); padding: 10px 14px; border-right: 0; border-bottom: 1px solid #27343f; }
  .sidebar-nav { display: flex; gap: 6px; overflow-x: auto; }
  .sidebar-link { flex: 1 0 auto; justify-content: center; min-height: 42px; padding-inline: 12px; font-size: 13px; }
  .sidebar-icon { display: none; }
  .login-panel { padding: 24px 20px; }
  .login-panel h1, .admin-heading h1 { font-size: 32px; }
  .admin-heading, .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading > .button { width: 100%; }
  .admin-actions, .admin-nav { align-items: stretch; flex-wrap: wrap; }
  .admin-actions .button { flex: 1; }
  .editor-grid, .paragraph-fields, .account-fields { grid-template-columns: 1fr; }
  .paragraph-fields label:first-child { grid-column: auto; }
  .repeater-card { padding: 14px; }
  .item-editor-body { align-items: stretch; flex-direction: column; }
  .item-editor-fields { width: 100%; }
  .item-preview { flex-basis: auto; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .content-editor-form { padding-bottom: 124px; }
  .content-form-actions { right: 0; left: 0; padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); gap: 8px; flex-direction: row; }
  .content-form-actions .save-status { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .content-form-actions .button { width: auto; min-width: 0; flex: 0 0 auto; padding-inline: 12px; }
  .password-tool { padding: 14px; }
  .password-tool-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 10px; }
  .password-tool-controls > label:first-child { width: auto; }
  .password-settings-save { width: 100%; }
  .password-tool-output { grid-template-columns: 1fr; }
  .private-record-card { padding: 14px; }
  .private-record-heading { align-items: stretch; flex-direction: column; }
  .private-record-actions { justify-content: flex-start; flex-wrap: wrap; }
  .nextin-link-box { grid-template-columns: 1fr; }
}
