:root {
  --bg: #f4f6f8;
  --panel: #f9fbfc;
  --panel-strong: #ffffff;
  --ink: #1b222c;
  --muted: #66717f;
  --line: #d8e0e7;
  --accent: #d5485f;
  --accent-strong: #b92842;
  --teal: #18857a;
  --blue: #276a91;
  --shadow: 0 18px 45px rgba(32, 44, 58, 0.12);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #e8f0ef;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.brand h1 {
  font-size: 18px;
  margin: 0;
  line-height: 1.2;
}

.brand p,
.small-muted {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(216, 224, 231, 0.85);
  border-radius: 8px;
  padding: 10px;
}

.stat b {
  display: block;
  font-size: 20px;
}

.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.note-row {
  text-align: left;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 58px 12px 12px;
  color: var(--ink);
  position: relative;
  width: 100%;
}

.note-row.active {
  border-color: var(--accent);
  background: white;
}

.note-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-row span {
  color: var(--muted);
  font-size: 12px;
}

.note-row .note-delete {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 40px;
  min-height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff0f2;
  color: #d71735;
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 36, 66, 0.16);
}

.note-row .note-delete:hover {
  background: #ff2442;
  color: #fff;
}

.main {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 460px);
  gap: 24px;
  align-items: start;
}

.panel,
.phone,
.qr-panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h2,
.section-title {
  margin: 0;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.simple {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 13px;
  color: #3d4148;
  font-weight: 650;
}

.field input,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  min-width: 0;
  background: #fbfcfd;
}

.field textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.65;
}

.bulk-textarea {
  min-height: 360px;
}

.pack-guide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.compact-guide {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0;
  margin: 0 0 14px;
  overflow: hidden;
}

.compact-guide summary {
  min-height: 42px;
  padding: 11px 14px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  list-style-position: inside;
}

.compact-guide[open] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
}

.compact-guide[open] summary {
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line);
}

.pack-guide > div,
.import-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.pack-guide b,
.import-result b {
  display: block;
  margin-bottom: 8px;
}

.pack-guide pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #39414c;
  font-size: 12px;
  line-height: 1.55;
  font-family: "Cascadia Mono", Consolas, monospace;
}

.compact-guide pre {
  max-height: 132px;
  overflow: auto;
}

.import-result {
  margin-top: 14px;
}

.import-result p {
  margin: 0;
  color: var(--muted);
}

.import-result ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #8c5d18;
  font-size: 13px;
}

.folder-queue {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
  color: var(--ink);
}

.folder-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.client-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.client-picker-row select {
  min-width: 0;
  height: 44px;
}

.folder-picker-row input {
  min-width: 0;
}

.folder-queue.empty {
  color: var(--muted);
  font-size: 13px;
}

.folder-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #e4e9ee;
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.folder-chip b,
.folder-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-chip span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.folder-chip .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.inline-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.inline-tools .btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

.media-manager {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.media-manager-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.media-manager-head strong {
  font-size: 14px;
}

.media-manager-head span {
  color: var(--muted);
  font-size: 12px;
}

.media-sort-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 118px));
  gap: 8px;
}

.media-sort-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  padding: 6px;
  display: grid;
  gap: 6px;
  cursor: grab;
}

.media-sort-item:active {
  cursor: grabbing;
}

.media-sort-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  background: #111;
  overflow: hidden;
}

.media-sort-thumb img,
.media-sort-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-sort-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.media-sort-meta b {
  color: var(--accent);
}

.media-sort-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.media-sort-actions .btn {
  min-height: 26px;
  padding: 4px 3px;
  font-size: 10px;
}

.qr-batch {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}

.compact-head {
  margin-bottom: 14px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.qr-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 7px;
}

.qr-card img {
  width: 100%;
  aspect-ratio: 13 / 15;
  object-fit: contain;
  border-radius: 8px;
  background: #fff7f8;
}

.qr-card strong {
  font-size: 12px;
  color: #1b222c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}

.qr-card-actions .btn {
  min-height: 30px;
  padding: 6px 5px;
  font-size: 11px;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: -4px 0 18px;
  padding-bottom: 12px;
}

.tab {
  min-height: 38px;
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--ink);
  background: #e8edf2;
}

.tab.active {
  background: var(--ink);
  color: white;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.actions.compact {
  margin-top: 0;
}

.btn {
  border-radius: 8px;
  padding: 10px 14px;
  background: #e8e0d5;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.danger {
  background: #f4d6d9;
  color: #8c1f2c;
}

.right-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 18px;
}

.qr-panel {
  padding: 16px;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.qr-panel img {
  width: 156px;
  aspect-ratio: 13 / 15;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.qr-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  margin: 8px 0;
}

.phone {
  overflow: hidden;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #111827;
  color: white;
  border-radius: 999px;
  padding: 11px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.toast.show {
  opacity: 1;
}

.customer-page {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: white;
}

.xhs-body {
  background: #f1f1f1;
}

.xhs-customer {
  max-width: 480px;
  background: #fff;
}

.xhs-note {
  background: #fff;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
}

.xhs-admin-preview {
  min-height: 760px;
  max-height: 860px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.xhs-statusbar {
  height: 46px;
  padding: 12px 18px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0;
  background: #fff;
}

.xhs-system-icons {
  display: flex;
  align-items: center;
  gap: 5px;
}

.xhs-system-icons span {
  width: 7px;
  height: 16px;
  border-radius: 3px;
  background: #111;
  display: block;
}

.xhs-system-icons span:nth-child(1) {
  height: 10px;
}

.xhs-system-icons span:nth-child(2) {
  height: 13px;
}

.xhs-system-icons b {
  min-width: 34px;
  height: 20px;
  padding: 1px 5px;
  border-radius: 7px;
  background: #111;
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
}

.xhs-author-bar {
  height: 56px;
  padding: 9px 16px;
  display: grid;
  grid-template-columns: 26px 36px minmax(0, 1fr) auto 28px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #f1f1f1;
  background: #fff;
}

.xhs-author-bar strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 800;
}

.xhs-icon-btn,
.xhs-share {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #303238;
  font-size: 34px;
  line-height: 1;
  padding: 0;
}

.xhs-share {
  font-size: 23px;
  font-weight: 800;
}

.xhs-avatar,
.xhs-mini-avatar {
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #fff4f4;
  color: #ff2442;
  border: 1px solid #ffe0e4;
  font-weight: 900;
}

.xhs-avatar {
  width: 36px;
  height: 36px;
  font-size: 18px;
}

.xhs-mini-avatar {
  width: 34px;
  height: 34px;
  font-size: 16px;
}

.xhs-avatar img,
.xhs-mini-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.xhs-follow {
  height: 30px;
  min-width: 62px;
  border: 1.5px solid #ff2442;
  border-radius: 999px;
  background: #fff;
  color: #ff2442;
  font-size: 14px;
  font-weight: 800;
  padding: 0 15px;
}

.xhs-media-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f7f7f7;
}

.xhs-media {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  background: #f7f7f7;
  scrollbar-width: none;
  width: 100%;
  height: 100%;
}

.xhs-media::-webkit-scrollbar {
  display: none;
}

.xhs-media img,
.xhs-media video,
.xhs-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex: 0 0 100%;
  scroll-snap-align: start;
  background: #f7f7f7;
}

.xhs-media video {
  object-fit: contain;
  background: #111;
}

.xhs-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 34px;
  height: 54px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.44);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 34px;
  line-height: 1;
  padding: 0 0 4px;
}

.xhs-nav-left {
  left: 8px;
}

.xhs-nav-right {
  right: 8px;
}

.xhs-placeholder {
  display: grid;
  place-items: center;
  color: #888;
  background: linear-gradient(135deg, #fff8e8, #f7f7f7);
}

.xhs-dots {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
}

.xhs-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d8d8d8;
}

.xhs-dots span.active {
  width: 8px;
  height: 8px;
  background: #ff2442;
}

.xhs-media-count {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  min-width: 36px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(0,0,0,.42);
  color: #fff;
  font-size: 13px;
  text-align: center;
}

.xhs-commentbar {
  grid-column: 1 / -1;
  height: 42px;
  border-radius: 22px;
  background: #f5f5f5;
  color: #999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 15px;
}

.xhs-commentbar > span:first-child { color: #777; font-size: 21px; }

.xhs-copy {
  padding: 0 18px 118px;
  background: #fff;
}

.xhs-copy h1,
.xhs-copy h2 {
  margin: 8px 0 12px;
  color: #333;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 900;
}

.xhs-copy div {
  white-space: pre-wrap;
  color: #333;
  font-size: 17px;
  line-height: 1.72;
  word-break: break-word;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Noto Emoji", sans-serif;
}

.xhs-actionbar {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  min-height: 68px;
  padding: 9px 13px 12px;
  display: grid;
  grid-template-columns: minmax(132px, 0.86fr) auto;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.12);
  z-index: 3;
}

.xhs-link-pill {
  height: 44px;
  min-width: 0;
  border-radius: 999px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
}

.xhs-link-pill b {
  display: block;
  color: #333;
  font-size: 15px;
  line-height: 1.05;
}

.xhs-link-pill span {
  color: #777;
  font-size: 12px;
}

.xhs-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
  font-size: 18px;
  white-space: nowrap;
}

.xhs-actions span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.xhs-actions b {
  font-size: 14px;
  font-weight: 700;
}

.xhs-customer .xhs-actionbar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  width: min(100vw, 480px);
  transform: translateX(-50%);
}

.xhs-admin-preview .xhs-actionbar {
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    grid-template-columns: 1fr;
  }

  .right-rail {
    position: static;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .form-grid,
  .qr-panel,
  .pack-guide,
  .folder-picker-row,
  .client-picker-row {
    grid-template-columns: 1fr;
  }

  .qr-panel img {
    width: 180px;
    height: 180px;
  }
}

/* Premium Xiaohongshu-style admin refresh */
:root {
  --bg: #f6f6f7;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --ink: #14161a;
  --muted: #7b808a;
  --line: #ececf0;
  --line-strong: #dedfe5;
  --accent: #ff2442;
  --accent-strong: #df1735;
  --accent-soft: #fff1f3;
  --gold: #b99368;
  --cream: #f7f2eb;
  --shadow: 0 18px 45px rgba(18, 20, 28, 0.08);
  --shadow-tight: 0 8px 24px rgba(18, 20, 28, 0.07);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(246, 246, 247, 0.96)),
    repeating-linear-gradient(90deg, rgba(20, 22, 26, 0.025) 0 1px, transparent 1px 80px);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  padding: 24px 18px 150px;
  gap: 18px;
  box-shadow: 10px 0 30px rgba(18, 20, 28, 0.035);
}

.brand {
  padding: 2px 0 8px;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(255, 36, 66, 0.24);
}

.brand h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.brand p,
.small-muted {
  color: var(--muted);
  font-size: 12px;
}

.stats {
  gap: 10px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-tight);
  padding: 12px 10px;
}

.stat b {
  font-size: 22px;
  color: var(--ink);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.search {
  border-color: var(--line);
  background: #fff;
  min-height: 44px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.search:focus,
.field input:focus,
.field textarea:focus,
.qr-panel input:focus {
  outline: 0;
  border-color: rgba(255, 36, 66, 0.58);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.09);
}

.note-list {
  gap: 8px;
  flex: 1;
  min-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.note-row {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  box-shadow: 0 8px 18px rgba(18, 20, 28, 0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.note-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(18, 20, 28, 0.07);
}

.note-row.active {
  border-color: rgba(255, 36, 66, 0.34);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.note-row strong {
  font-size: 14px;
}

.main {
  padding: 24px;
  grid-template-columns: minmax(520px, 1fr) minmax(380px, 460px);
  gap: 24px;
}

.panel,
.phone,
.qr-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2,
.section-title {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0;
}

.tabs {
  gap: 6px;
  border-bottom-color: var(--line);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.tab {
  background: #f3f4f6;
  border: 1px solid var(--line);
  color: #4d535c;
  font-weight: 800;
  min-height: 40px;
}

.tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.field label {
  color: #2b2f36;
  font-weight: 800;
}

.field input,
.field textarea {
  border-color: var(--line);
  background: #fff;
  min-height: 46px;
}

.field textarea {
  min-height: 190px;
  line-height: 1.72;
}

.pack-guide > div,
.import-result,
.folder-queue {
  background: #fff;
  border-color: var(--line);
}

.pack-guide > div {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.folder-chip {
  border-color: var(--line);
  background: #fafafa;
}

.btn {
  border-radius: 8px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  min-height: 42px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(18, 20, 28, 0.08);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(255, 36, 66, 0.18);
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.danger {
  background: #fff0f2;
  color: #c81732;
}

.qr-batch {
  border-top-color: var(--line);
  margin-top: 22px;
}

.qr-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 470px;
}

.qr-card {
  border-color: var(--line);
  background: #fff;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(18, 20, 28, 0.055);
}

.qr-card img {
  border: 1px solid #ffe0e5;
  background: linear-gradient(180deg, #fff8f9, #fff);
}

.qr-card strong {
  font-size: 13px;
  color: var(--ink);
}

.qr-card-actions {
  grid-template-columns: 1fr;
  gap: 6px;
}

.qr-card-actions .btn {
  min-height: 32px;
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.right-rail {
  gap: 18px;
  top: 20px;
}

.qr-panel {
  padding: 16px;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 16px;
}

.qr-panel img {
  width: 144px;
  border-color: #ffe0e5;
  background: #fff8f9;
}

.qr-panel input {
  border-color: var(--line);
  background: #fff;
}

.xhs-admin-preview {
  min-height: 760px;
  max-height: 860px;
  border-color: var(--line);
  box-shadow: 0 18px 45px rgba(18, 20, 28, 0.12);
}

.xhs-author-bar {
  height: 54px;
  border-bottom-color: #f1f1f3;
}

.xhs-media-shell {
  background: #0f0f12;
}

.xhs-media {
  background: #0f0f12;
}

.xhs-media img,
.xhs-media video,
.xhs-placeholder {
  background: #0f0f12;
}

.xhs-media video {
  object-fit: cover;
}

.xhs-nav {
  background: rgba(20, 22, 26, 0.54);
  backdrop-filter: blur(8px);
}

.xhs-dots {
  min-height: 26px;
}

.xhs-actionbar {
  box-shadow: 0 -12px 28px rgba(18, 20, 28, 0.14);
}

.toast {
  background: rgba(20, 22, 26, 0.94);
  box-shadow: 0 14px 32px rgba(18, 20, 28, 0.2);
}

@media (max-width: 1180px) {
  .main {
    grid-template-columns: 1fr;
  }

  .right-rail {
    position: static;
  }
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
    padding-bottom: 16px;
  }

  .compact-auth {
    position: static;
    width: 100%;
    margin-top: 12px;
  }

  .note-library-layout {
    grid-template-columns: 1fr;
  }

  .note-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .note-table-row {
    grid-template-columns: 30px 64px minmax(0, 1fr);
  }

  .row-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .xhs-media-shell .xhs-nav {
    display: none !important;
  }

  .main,
  .sidebar,
  .panel {
    padding: 16px;
  }

  .qr-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }

  .library-shell,
  .note-library-shell {
    width: calc(100vw - 24px);
    padding-top: 14px;
  }

  .library-topbar,
  .library-toolbar,
  .note-toolbar,
  .library-bulkbar {
    grid-template-columns: 1fr;
  }

  .library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Dedicated library pages */
.qr-library-page,
.note-library-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 36, 66, 0.09), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f6f6f7 56%, #f1f2f4 100%);
}

.list-hint {
  min-height: 18px;
  margin: 8px 0 0;
}

.note-library-shell {
  width: min(1560px, calc(100vw - 40px));
}

.note-library-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}

.batch-panel,
.client-panel,
.note-table-panel {
  min-height: 520px;
}

.batch-panel,
.client-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 14px;
}

.batch-panel-head,
.client-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.batch-panel-head strong,
.client-panel-head strong {
  font-size: 18px;
}

.client-panel-head > div {
  display: flex;
  gap: 8px;
}

.compact-btn {
  min-height: 32px;
  padding: 6px 10px;
}

.batch-list,
.client-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
  padding-top: 12px;
}

.batch-row,
.client-row {
  width: 100%;
  min-height: 72px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 11px 12px;
  box-shadow: var(--shadow-tight);
  cursor: pointer;
}

.batch-row:hover,
.batch-row.active,
.client-row:hover,
.client-row.active {
  border-color: rgba(255, 36, 66, 0.45);
  background: #fff7f8;
}

.batch-row strong,
.batch-row span,
.client-row strong,
.client-row span {
  display: block;
}

.batch-row strong,
.client-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.batch-row span,
.client-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.client-row {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.client-row.archived {
  opacity: 0.62;
}

.client-row-main {
  min-width: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.client-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.client-row-actions button {
  min-height: 26px;
  border-radius: 999px;
  background: #f5f1eb;
  color: #5b5148;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.client-row-actions [data-delete-client] {
  background: #fff0f2;
  color: #d71735;
}

.note-toolbar {
  grid-template-columns: minmax(220px, 1fr) 220px 160px 140px auto;
}

.note-table {
  display: grid;
  gap: 10px;
}

.note-table-row {
  display: grid;
  grid-template-columns: 34px 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(18, 20, 28, 0.05);
}

.note-table-row.selected {
  border-color: rgba(255, 36, 66, 0.5);
  background: #fff8f9;
}

.row-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.row-cover {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: #f3f4f6;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.row-main {
  min-width: 0;
}

.row-main strong {
  color: var(--accent);
  font-size: 13px;
}

.row-main h2 {
  margin: 4px 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  line-height: 1.25;
}

.row-main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions .btn {
  min-height: 34px;
  padding: 7px 10px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 16px;
}

.pager span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.dashboard-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.dashboard-row {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow-tight);
}

.dashboard-row strong,
.dashboard-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-row span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dashboard-actions .btn {
  min-height: 32px;
  padding: 6px 10px;
}

/* Auth and account management */
.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 36, 66, 0.16), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f7f7f8 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(420px, 100%);
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-card .mark {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
}

.auth-card h1 {
  margin: 0;
  font-size: 28px;
}

.auth-card p {
  margin: 8px 0 22px;
  color: var(--muted);
}

.auth-form,
.account-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.auth-box {
  display: grid;
  gap: 7px;
}

.auth-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-form input,
.account-form input,
.account-form select,
.auth-box input,
.card-output {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
}

.auth-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.compact-auth {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 256px;
  z-index: 20;
  margin-top: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 38px rgba(18, 20, 28, 0.14);
}

.auth-box b,
.auth-box span {
  display: block;
}

.compact-auth b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.auth-box span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.auth-links button[hidden] + button {
  margin-left: auto;
}

.auth-links button,
.auth-redeem-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.auth-links button:hover,
.auth-redeem-link:hover {
  color: var(--accent);
}

.auth-redeem-link {
  display: inline-block;
  margin-top: 8px;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.account-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.account-form button {
  grid-column: 1 / -1;
}

.access-url-options {
  display: grid;
  gap: 8px;
  margin: -4px 0 14px;
}

.access-url-option {
  width: 100%;
  text-align: left;
  overflow-wrap: anywhere;
}

.account-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
}

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow-tight);
}

.account-row strong,
.account-row span {
  display: block;
}

.account-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.card-output {
  min-height: 120px;
  margin-bottom: 14px;
  resize: vertical;
  font-family: "Cascadia Mono", Consolas, monospace;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .account-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .account-form,
  .account-row,
  .auth-box form {
    grid-template-columns: 1fr;
  }
}

.library-shell {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.library-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.library-back {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f3f4f6;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.library-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library-topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

.library-topbar span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.library-top-actions,
.library-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.library-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.library-stats article {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-tight);
}

.library-stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.library-stats b {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.library-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 18px;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 220px auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.library-input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.library-input:focus {
  outline: 0;
  border-color: rgba(255, 36, 66, 0.58);
  box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.09);
}

.library-bulkbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
}

.library-bulkbar strong {
  display: block;
  font-size: 16px;
}

.library-bulkbar span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.library-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.library-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 12px 28px rgba(18, 20, 28, 0.06);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.library-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(18, 20, 28, 0.1);
}

.library-card.selected {
  border-color: rgba(255, 36, 66, 0.5);
  background: #fff8f9;
}

.library-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(18, 20, 28, 0.08);
}

.library-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.library-qr-preview {
  grid-row: span 2;
  display: block;
  border: 1px solid #ffe0e5;
  border-radius: 8px;
  background: #fff8f9;
  overflow: hidden;
}

.library-qr-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 13 / 15;
  object-fit: contain;
}

.library-card-body {
  min-width: 0;
  padding: 30px 2px 0;
}

.library-card-body strong,
.library-card-body h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card-body strong {
  display: block;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.library-card-body h2 {
  margin: 7px 0 8px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.library-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.library-card-actions {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-self: end;
}

.library-card-actions .btn {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.btn.ghost {
  background: #f4f5f7;
}

.library-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
}

.library-empty b {
  color: var(--ink);
  font-size: 20px;
}

.library-empty p {
  margin: 0;
}

@media (max-width: 980px) {
  .library-topbar,
  .library-bulkbar,
  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .library-top-actions,
  .library-bulk-actions {
    justify-content: flex-start;
  }

  .library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .library-shell {
    width: min(100vw - 24px, 560px);
    padding-top: 14px;
  }

  .library-topbar,
  .library-panel {
    padding: 14px;
  }

  .library-topbar h1 {
    font-size: 24px;
  }

  .library-card-grid {
    grid-template-columns: 1fr;
  }

  .library-card {
    grid-template-columns: 102px minmax(0, 1fr);
  }

  .library-card-actions {
    grid-template-columns: 1fr 1fr;
  }
}

.rich-editor { min-height: 180px; max-height: 360px; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; white-space: pre-wrap; line-height: 1.65; outline: none; }
.rich-editor:empty::before { content: attr(data-placeholder); color: #98a2b3; pointer-events: none; }
.rich-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(213,72,95,.12); }
.rich-editor h1, .rich-editor h2, .rich-editor h3 { margin: 0.45em 0 0.25em; }

/* Mobile note preview: preserve the source image ratio like a native note page. */
.xhs-customer .xhs-media-shell { height: auto; min-height: 0; }
.xhs-customer .xhs-media { height: 100%; overflow-x: auto; overflow-y: hidden; display: flex; scroll-snap-type: x mandatory; scrollbar-width: none; }
.xhs-actionbar { grid-template-columns: minmax(0, 1fr) auto; }
.xhs-copy-btn { height: 40px; padding: 0 12px; border: 1px solid #ff2442; border-radius: 999px; background: #fff; color: #ff2442; font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.xhs-copy-btn:active { transform: none; background: #fff1f3; }
.xhs-footer-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.xhs-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: #656a74; }
.xhs-action-preview { min-width: 32px; display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 1px !important; color: inherit; font-size: 9px; line-height: 1.1; }
.xhs-action-preview svg { display: block; width: 17px; height: 17px; }
.xhs-actions .xhs-action-preview b { font-size: 9px; font-weight: 550; line-height: 1.2; }
.xhs-action-preview:first-child { color: #e94359; }
@media (max-width: 420px) {
  .xhs-actionbar { grid-template-columns: minmax(94px, 1fr) auto; gap: 5px; padding-inline: 8px; }
  .xhs-footer-actions { gap: 5px; }
  .xhs-actions { gap: 4px; }
  .xhs-action-preview { min-width: 25px; font-size: 8px; }
  .xhs-action-preview svg { width: 15px; height: 15px; }
  .xhs-actions .xhs-action-preview b { font-size: 8px; }
  .xhs-copy-btn { height: 34px; padding-inline: 8px; font-size: 10px; }
}

.xhs-link-pill b { white-space: nowrap; }

/* Customer note preview: phone-first content with a desktop device frame. */
.xhs-body {
  min-height: 100vh;
  background: #f3f4f6;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", Arial, sans-serif;
}

.xhs-customer {
  width: min(100%, 480px);
  min-height: 100dvh;
  overflow: clip;
  background: #fff;
}

.xhs-customer .xhs-note {
  min-height: inherit;
  background: #fff;
}

.xhs-customer .xhs-author-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  flex: 0 0 56px;
  min-width: 0;
  padding-inline: 12px;
  box-shadow: 0 1px 0 rgba(20,22,26,.035);
}

.xhs-customer .xhs-author-bar strong { font-size: 14px; font-weight: 700; }
.xhs-customer .xhs-author-bar .xhs-follow { min-width: 58px; height: 29px; padding-inline: 13px; font-size: 12px; }
.xhs-customer .xhs-author-bar .xhs-share { font-size: 21px; }

.xhs-customer .xhs-media-shell {
  flex: 0 0 auto;
  min-height: 240px;
  max-height: min(72dvh, 720px);
  overflow: hidden;
  background: #f4f4f5;
}

.xhs-customer .xhs-media img { object-fit: contain; background: #f4f4f5; }
.xhs-customer .xhs-media video { object-fit: contain; }
.xhs-customer .xhs-dots { min-height: 28px; }

.xhs-customer .xhs-copy {
  flex: 1 0 auto;
  padding: 0 20px calc(100px + env(safe-area-inset-bottom));
}

.xhs-customer .xhs-copy h1 { margin: 7px 0 12px; font-size: 20px; line-height: 1.45; font-weight: 750; }
.xhs-customer .xhs-copy > div { font-size: 15px; line-height: 1.8; color: #34363b; }
.xhs-customer #noteCopy { scroll-margin-top: 68px; }

.xhs-customer .xhs-actionbar {
  min-height: 64px;
  padding: 8px 12px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(20,22,26,.06);
  border-radius: 15px 15px 0 0;
  box-shadow: 0 -5px 20px rgba(20,22,26,.09);
}

.xhs-customer .xhs-link-pill {
  height: 42px;
  padding-inline: 9px;
  gap: 8px;
  background: #f6f6f7;
  text-decoration: none;
}

.xhs-customer .xhs-link-pill b { font-size: 13px; font-weight: 650; }
.xhs-customer .xhs-link-pill span { font-size: 10px; }
.xhs-customer .xhs-copy-btn { height: 37px; padding-inline: 11px; font-size: 12px; }

.xhs-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 24px;
  text-align: center;
  color: #f5f1f2;
  background: radial-gradient(ellipse at 50% 38%, #38363c, #1a1a1f 72%);
}

.xhs-placeholder::before {
  content: "▧";
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 3px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: #ff7a8d;
  font-size: 25px;
}

.xhs-placeholder span { font-size: 13px; font-weight: 650; }
.xhs-placeholder small { color: rgba(255,255,255,.62); font-size: 11px; line-height: 1.5; }
.xhs-customer .xhs-placeholder { background: radial-gradient(ellipse at 50% 38%, #fff, #f4f4f5 74%); color: #515662; }
.xhs-customer .xhs-placeholder::before { border-color: #ffe1e5; background: #fff4f5; color: #f43a55; }
.xhs-customer .xhs-placeholder small { color: #858b96; }

.xhs-admin-preview { container-type: inline-size; }
.xhs-admin-preview .xhs-copy { padding: 13px 16px 16px; }
.xhs-admin-preview .xhs-copy h2 { margin: 0 0 7px; font-size: 15px; }
.xhs-admin-preview .xhs-copy > div { font-size: 12px; line-height: 1.65; }
.xhs-admin-preview .xhs-actionbar { grid-template-columns: minmax(0,1fr) auto; min-height: 58px; padding: 7px 10px; }
.xhs-admin-preview .xhs-link-pill { height: 40px; padding-inline: 8px; gap: 7px; }
.xhs-admin-preview .xhs-link-pill b { font-size: 12px; }
.xhs-admin-preview .xhs-footer-actions { gap: 4px; }
.xhs-admin-preview .xhs-actions { gap: 6px; }
.xhs-admin-preview .xhs-action-preview { min-width: 26px; font-size: 8px; }
.xhs-admin-preview .xhs-action-preview svg { width: 15px; height: 15px; }
.xhs-admin-preview .xhs-actions .xhs-action-preview b { font-size: 8px; }

/* Compact Xiaohongshu-style engagement metrics: icon and count share one line. */
.xhs-actions .xhs-action-preview { flex-direction: row; min-width: 0; gap: 4px !important; font-size: 13px; line-height: 1; color: #343434; }
.xhs-actions .xhs-action-preview svg { width: 21px; height: 21px; flex: 0 0 auto; }
.xhs-actions .xhs-action-preview b { font-size: 13px; font-weight: 600; line-height: 1; }
.xhs-actions .xhs-action-like svg { color: #ff2442; }
.xhs-actions .xhs-action-favorite svg { color: #f5b942; }
.xhs-actions .xhs-action-comment svg { color: #373737; }
.xhs-customer .xhs-actionbar,
.xhs-admin-preview .xhs-actionbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.xhs-customer .xhs-link-pill,
.xhs-admin-preview .xhs-link-pill { width: 100%; }
.xhs-customer .xhs-footer-actions,
.xhs-admin-preview .xhs-footer-actions { width: 100%; justify-content: space-evenly; }
.xhs-customer .xhs-actions,
.xhs-admin-preview .xhs-actions { width: 100%; justify-content: space-evenly; }
.xhs-admin-preview .xhs-actions .xhs-action-preview { gap: 3px !important; font-size: 9px; }
.xhs-admin-preview .xhs-actions .xhs-action-preview svg { width: 15px; height: 15px; }
.xhs-admin-preview .xhs-actions .xhs-action-preview b { font-size: 9px; }
@container (max-width: 390px) {
  .xhs-admin-preview .xhs-actions .xhs-action-preview { gap: 2px !important; font-size: 8px; }
  .xhs-admin-preview .xhs-actions .xhs-action-preview svg { width: 14px; height: 14px; }
  .xhs-admin-preview .xhs-actions .xhs-action-preview b { font-size: 8px; }
}

@container (max-width: 390px) {
  .xhs-admin-preview .xhs-actionbar { grid-template-columns: minmax(0,1fr) auto; gap: 5px; padding-inline: 8px; }
  .xhs-admin-preview .xhs-footer-actions { gap: 4px; }
  .xhs-admin-preview .xhs-actions { gap: 4px; }
  .xhs-admin-preview .xhs-action-preview { min-width: 24px; font-size: 7px; }
  .xhs-admin-preview .xhs-action-preview svg { width: 14px; height: 14px; }
  .xhs-admin-preview .xhs-actions .xhs-action-preview b { font-size: 7px; }
  .xhs-admin-preview .xhs-author-bar { grid-template-columns: 24px 32px minmax(0,1fr) auto 24px; gap: 6px; padding-inline: 9px; }
  .xhs-admin-preview .xhs-avatar { width: 32px; height: 32px; }
  .xhs-admin-preview .xhs-author-bar strong { font-size: 13px; }
}

@media (min-width: 600px) {
  .xhs-body { padding: 28px 16px; }
  .xhs-customer {
    min-height: min(920px, calc(100dvh - 56px));
    border: 1px solid #e9e9ed;
    border-radius: 18px;
    box-shadow: 0 14px 44px rgba(25,30,42,.1);
  }
  .xhs-customer .xhs-note { min-height: min(920px, calc(100dvh - 56px)); }
  .xhs-customer .xhs-actionbar { position: sticky; left: auto; bottom: 0; width: 100%; transform: none; }
}

@media (max-width: 599px) {
  .xhs-body { background: #fff; }
  .xhs-customer, .xhs-customer .xhs-note { min-height: 100dvh; }
  .xhs-customer .xhs-media-shell { max-height: none; }
  .xhs-customer .xhs-copy { padding-inline: 16px; }
}

/* Keep both footer zones balanced even inside the admin's narrow preview container. */
.xhs-admin-preview .xhs-actionbar,
.xhs-customer .xhs-actionbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.xhs-admin-preview .xhs-link-pill,
.xhs-customer .xhs-link-pill { width: 100%; }
.xhs-admin-preview .xhs-footer-actions,
.xhs-customer .xhs-footer-actions { width: 100%; justify-content: space-evenly; }
.xhs-admin-preview .xhs-actions,
.xhs-customer .xhs-actions { width: 100%; justify-content: space-evenly; }
.xhs-author-bar .xhs-share { display: grid; place-items: center; font-size: 0; color: #303238; }
.xhs-author-bar .xhs-share svg { display: block; width: 25px; height: 25px; }
.xhs-author-bar .xhs-follow { min-width: 60px; height: 30px; padding: 0 14px; border-width: 1px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.xhs-author-bar strong { font-size: 13px; font-weight: 650; }
.xhs-customer .xhs-author-bar strong { font-size: 13px; }
.xhs-admin-preview .xhs-author-bar strong { font-size: 13px; }

@media (max-width: 600px) {
  .xhs-customer .xhs-author-bar {
    grid-template-columns: 24px 34px minmax(0, 1fr) 54px 24px;
    gap: 6px;
    height: 52px;
    padding-inline: 10px;
  }
  .xhs-customer .xhs-author-bar .xhs-follow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    min-width: 54px;
    height: 28px;
    padding: 0;
    border-width: 1px;
    font-size: 12px;
    font-weight: 600;
  }
  .xhs-customer .xhs-author-bar .xhs-share svg { width: 23px; height: 23px; }
  .xhs-customer .xhs-actionbar {
    grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
    gap: 6px;
    padding-inline: 8px;
  }
  .xhs-customer .xhs-link-pill {
    min-width: 0;
    height: 48px;
    gap: 6px;
    padding: 5px 8px;
  }
  .xhs-customer .xhs-link-pill .xhs-mini-avatar { width: 40px; height: 40px; flex: 0 0 40px; }
  .xhs-customer .xhs-link-pill b { overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
  .xhs-customer .xhs-footer-actions { min-width: 0; width: auto; gap: 6px; justify-content: flex-end; }
  .xhs-customer .xhs-actions { min-width: 0; width: auto; flex: 0 0 auto; gap: 7px; justify-content: flex-start; }
  .xhs-customer .xhs-actions .xhs-action-preview { gap: 3px !important; font-size: 12px; }
  .xhs-customer .xhs-actions .xhs-action-preview svg { width: 22px; height: 22px; }
  .xhs-customer .xhs-actions .xhs-action-preview b { font-size: 12px; }
  .xhs-customer .xhs-copy-btn { flex: 0 0 auto; height: 38px; padding-inline: 9px; font-size: 12px; }
}
@media (max-width: 360px) {
  .xhs-customer .xhs-actionbar { grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: 4px; padding-inline: 6px; }
  .xhs-customer .xhs-link-pill { gap: 4px; padding-inline: 5px; }
  .xhs-customer .xhs-link-pill .xhs-mini-avatar { width: 27px; height: 27px; flex-basis: 27px; }
  .xhs-customer .xhs-link-pill b { font-size: 11px; }
  .xhs-customer .xhs-footer-actions { gap: 3px; }
  .xhs-customer .xhs-actions .xhs-action-preview svg { width: 15px; height: 15px; }
  .xhs-customer .xhs-actions .xhs-action-preview b { font-size: 9px; }
  .xhs-customer .xhs-copy-btn { padding-inline: 6px; font-size: 10px; }
}

/* The public note preview scrolls inside its own viewport; media fills a stable frame. */
.xhs-customer {
  height: calc(100dvh - 56px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.xhs-customer::-webkit-scrollbar { display: none; }
.xhs-customer .xhs-note { min-height: 100%; overflow: visible; }
.xhs-customer .xhs-media-shell {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto !important;
  overflow: hidden;
  background: #f4f4f5;
}
.xhs-customer .xhs-media { height: auto; align-items: flex-start; }
.xhs-customer .xhs-media img,
.xhs-customer .xhs-media video {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: #f4f4f5;
}
@media (max-width: 599px) {
  .xhs-customer { height: 100dvh; }
}

/* WeChat iOS may collapse native controls only while the document itself scrolls. */
html.wechat-browser,
html.wechat-browser body.xhs-body { height:auto; min-height:100%; overflow-x:hidden; overflow-y:auto; }
html.wechat-browser .xhs-customer { height:auto; min-height:100dvh; overflow:visible; overscroll-behavior-y:auto; }
html.wechat-browser .xhs-customer .xhs-note { min-height:100dvh; overflow:visible; }

/* Refine the compact mobile footer spacing and keep its CTA easy to tap. */
@media (max-width: 599px) {
  .xhs-customer .xhs-actionbar {
    grid-template-columns: minmax(0, .64fr) minmax(0, 1.36fr);
    bottom: -6px;
  }
  .xhs-customer .xhs-copy-btn {
    font-size: 13px;
    padding-inline: 10px;
  }
}
@media (max-width: 360px) {
  .xhs-customer .xhs-actionbar {
    grid-template-columns: minmax(0, .62fr) minmax(0, 1.38fr);
    bottom: -5px;
  }
  .xhs-customer .xhs-copy-btn {
    font-size: 11px;
    padding-inline: 7px;
  }
}
/* Explicit mobile footer layout: compact left-aligned metrics, CTA pinned right. */
@media (max-width: 599px) {
  .xhs-customer .xhs-actionbar {
    grid-template-columns: minmax(0, .34fr) minmax(0, .66fr);
    bottom: -10px;
  }
  .xhs-customer .xhs-footer-actions {
    width: 100%;
    min-width: 0;
    gap: 5px;
    justify-content: flex-start;
  }
  .xhs-customer .xhs-actions {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    gap: clamp(5px, 1.8vw, 9px);
    justify-content: flex-start;
  }
  .xhs-customer .xhs-copy-btn {
    height: 42px;
    margin-left: auto;
    padding-inline: 10px;
    font-size: 14px;
  }
}
@media (max-width: 360px) {
  .xhs-customer .xhs-actionbar { bottom: -8px; }
  .xhs-customer .xhs-actions { gap: 4px; }
  .xhs-customer .xhs-copy-btn { height: 40px; padding-inline: 8px; font-size: 12px; }
}
/* Reserve intrinsic image space before download; prevent flex shrink/snap drift. */
.xhs-customer .xhs-media img, .xhs-customer .xhs-media video {
  flex: 0 0 100%; min-width: 100%; scroll-snap-align: start;
  overflow-anchor: none;
}
.xhs-customer .xhs-media { overflow-anchor: none; }
