:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #20242a;
  --muted: #6f7782;
  --line: #d8d4ca;
  --panel: #fffdf8;
  --panel-alt: #f9f7f1;
  --accent: #1f7a8c;
  --accent-dark: #155463;
  --danger: #9c3c36;
  --shadow: 0 18px 45px rgba(35, 38, 42, 0.12);
  --editor-col: minmax(300px, 0.95fr);
  --preview-col: minmax(360px, 1.25fr);
  --settings-col: minmax(260px, 0.65fr);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

textarea {
  resize: vertical;
}

.topbar {
  min-width: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.brand {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100vw - 360px);
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:disabled:hover {
  transform: none;
  border-color: var(--line);
}

.ghost-btn {
  background: #fffdf8;
  color: var(--ink);
}

.ghost-btn:hover {
  border-color: var(--accent);
}

.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.top-actions button {
  height: 34px;
  border-radius: 10px;
  flex: 0 0 auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.top-actions .ghost-btn {
  background: rgba(255, 253, 248, 0.86);
}

.top-actions .ghost-btn:hover {
  background: #fff;
}

.top-actions .primary-btn {
  padding-inline: 16px;
  box-shadow: 0 8px 18px rgba(31, 122, 140, 0.22);
}

.donate-top-btn {
  border-color: rgba(212, 91, 44, 0.28);
  color: #9b4a20;
  background: #fff6ec;
}

.follow-top-btn {
  border-color: rgba(31, 122, 140, 0.24);
  color: var(--accent-dark);
  background: #edf8f7;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.slim {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.editor-tools {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbf8ef 0%, #f6f2e9 100%);
  overflow: visible;
}

.editor-tool-group {
  display: flex;
  align-items: center;
  min-width: 0;
}

.format-tools {
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 6px;
}

.action-tools {
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.action-tools .ghost-btn {
  flex: 1 1 104px;
  min-width: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(32, 36, 42, 0.04);
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.full-btn {
  width: 100%;
  margin: 4px 0 14px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
}

.inline-actions button {
  flex: 1 1 72px;
  min-width: 0;
}

.head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.combo-head-actions {
  flex: 1 1 0;
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 4px;
}

.combo-head-actions .ghost-btn {
  min-width: 58px;
  padding-inline: 7px;
}

.combo-template-panel .block-template-head {
  align-items: flex-start;
}

.combo-template-panel .panel-toggle {
  flex: 0 0 auto;
}

.combo-template-panel .panel-toggle strong {
  white-space: nowrap;
}

.type-step-btn {
  width: 38px;
  padding: 0;
  font-weight: 800;
}

.style-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.style-section:first-child {
  padding-top: 8px;
}

.style-section:last-child {
  border-bottom: 0;
}

.style-section-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.style-section-head strong {
  font-size: 13px;
}

.settings-panel > .style-section:first-child {
  padding-top: 6px;
}

.field-grid,
.range-grid,
.toggle-grid,
.action-grid {
  display: grid;
  gap: 8px;
}

.two-cols,
.range-grid,
.toggle-grid,
.action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.range-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.range-field span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.range-field b {
  color: var(--ink);
  font-weight: 700;
}

.range-field input[type="range"] {
  width: 100%;
  min-height: 32px;
  padding: 0;
  accent-color: var(--accent);
}

.compact-range {
  align-self: end;
}

.action-grid {
  margin-top: 8px;
}

.action-grid button {
  width: 100%;
  min-width: 0;
}

.layout-preset-field {
  margin-bottom: 8px;
}

.layout-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.layout-control,
.layout-toggle-grid .compact-check {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.layout-control select {
  min-height: 34px;
}

.layout-control input[type="range"] {
  min-height: 28px;
}

.layout-toggle-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.layout-toggle-grid .compact-check {
  min-height: 38px;
  justify-content: flex-start;
}

.toggle-grid {
  margin-top: 8px;
}

.compact-check {
  min-height: 34px;
  margin: 0;
  padding: 0 2px;
  gap: 8px;
}

.compact-check span {
  font-size: 12px;
}

.image-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.image-actions button {
  width: 100%;
  min-width: 0;
  padding: 0 8px;
}

.structure-panel {
  display: grid;
  gap: 8px;
  margin: 2px 0 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.structure-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.structure-panel-head strong {
  font-size: 12px;
}

.structure-panel-head span,
.structure-panel p,
.structure-empty {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.structure-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.structure-item {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.structure-item b {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.structure-item.ok {
  border-color: rgba(31, 122, 140, 0.34);
  background: rgba(31, 122, 140, 0.07);
}

.structure-item.warn {
  border-color: rgba(156, 60, 54, 0.32);
  background: rgba(156, 60, 54, 0.07);
}

.favorite-template-panel,
.combo-template-panel,
.recent-template-panel,
.block-template-panel,
.component-library-panel,
.article-template-panel,
.template-variable-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.image-template-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.block-template-head,
.template-style-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.collapsible-work-panel {
  min-width: 0;
  border: 1px solid rgba(32, 36, 42, 0.08);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.collapsible-work-panel.collapsed {
  gap: 0;
}

.component-panel-body {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.component-panel-body[hidden] {
  display: none;
}

.panel-toggle {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.panel-toggle::before {
  content: "▾";
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
}

.collapsible-work-panel.collapsed .panel-toggle::before {
  content: "▸";
}

.component-search-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
}

.component-search-tools input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
}

.component-search-tools span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-search-tools button[hidden] {
  display: none;
}

.block-template-head strong {
  font-size: 12px;
}

.block-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.favorite-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.combo-template-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.combo-card {
  min-width: 0;
  min-height: 58px;
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 7px;
  overflow: hidden;
  padding: 8px;
  border: 1px solid rgba(31, 122, 140, 0.18);
  border-radius: 8px;
  border-color: rgba(31, 122, 140, 0.18);
  background: linear-gradient(180deg, #fff 0%, rgba(31, 122, 140, 0.045) 100%);
  text-align: left;
}

.combo-card-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.combo-card-open {
  min-width: 0;
  height: auto;
  min-height: 0;
  display: grid;
  gap: 3px;
  padding: 0 0 1px;
  border: 0;
  background: transparent;
  text-align: left;
}

.combo-card-open strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-card-open span,
.combo-card-open em {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-card-open em {
  color: var(--accent-dark);
}

.combo-card:hover {
  transform: none;
  border-color: var(--accent);
}

.combo-card:focus-within {
  border-color: rgba(31, 122, 140, 0.48);
  box-shadow: 0 0 0 2px rgba(31, 122, 140, 0.1);
}

.combo-card-open:focus-visible,
.combo-card-actions .ghost-btn:focus-visible {
  outline: 2px solid rgba(31, 122, 140, 0.28);
  outline-offset: 2px;
}

.combo-insert-btn {
  min-width: 60px;
  padding-inline: 8px;
}

.combo-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.combo-card-actions .ghost-btn {
  flex: 1 1 58px;
  min-width: 0;
  padding-inline: 8px;
}

.combo-mini-visual {
  min-width: 0;
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  overflow: hidden;
  margin-top: 2px;
  border: 1px solid rgba(32, 36, 42, 0.08);
  border-radius: 8px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.76);
}

.combo-mini-flow {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.combo-mini-flow span {
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 24px 12px;
  gap: 6px;
}

.combo-mini-flow b {
  min-width: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31, 122, 140, 0.14);
  border-radius: 999px;
  padding: 0 4px;
  color: var(--accent-dark);
  background: rgba(31, 122, 140, 0.06);
  font-size: 10px;
  line-height: 1.15;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-mini-flow i {
  display: block;
  min-width: 0;
  height: 12px;
  border-radius: 5px;
  background: rgba(31, 122, 140, 0.16);
}

.combo-mini-flow span:nth-child(2) i {
  background: rgba(31, 122, 140, 0.1);
}

.combo-mini-flow span:nth-child(3) i {
  background: rgba(216, 212, 202, 0.56);
}

.combo-mini-flow span:nth-child(4) i {
  background:
    linear-gradient(135deg, rgba(31, 122, 140, 0.22), rgba(212, 91, 44, 0.18)),
    linear-gradient(45deg, transparent 44%, rgba(255, 255, 255, 0.8) 45% 55%, transparent 56%);
}

.combo-mini-flow i.qrcode {
  background:
    linear-gradient(90deg, #24313a 18%, transparent 19% 31%, #24313a 32% 44%, transparent 45% 60%, #24313a 61% 74%, transparent 75%),
    #fff;
}

.combo-mini-flow i.compare {
  background:
    linear-gradient(90deg, rgba(31, 122, 140, 0.2) 0 48%, transparent 49% 51%, rgba(212, 91, 44, 0.18) 52%),
    #fff;
}

.combo-mini-flow i.steps {
  background:
    repeating-linear-gradient(90deg, rgba(31, 122, 140, 0.18) 0 12px, rgba(212, 91, 44, 0.13) 12px 24px),
    #fff;
}

.combo-mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  overflow: hidden;
  max-height: 20px;
}

.combo-mini-meta span {
  overflow: hidden;
  border: 1px solid rgba(31, 122, 140, 0.14);
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--accent-dark);
  background: rgba(31, 122, 140, 0.06);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 30px;
  gap: 4px;
}

.image-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.image-template-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.image-template-preview {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.image-template-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.image-template-preview-head strong {
  color: var(--ink);
  font-size: 12px;
}

.image-template-preview-head span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-template-visual {
  display: grid;
  gap: 7px;
  min-height: 96px;
  border: 1px solid rgba(32, 36, 42, 0.08);
  border-radius: 8px;
  padding: 9px;
  background: var(--panel-alt);
}

.image-template-visual i {
  display: block;
  min-height: 42px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(31, 122, 140, 0.24), rgba(212, 91, 44, 0.18)),
    linear-gradient(45deg, transparent 44%, rgba(255, 255, 255, 0.8) 45% 55%, transparent 56%);
}

.image-template-visual b {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
}

.image-template-visual span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.image-template-visual.card b,
.image-template-visual.qrcode b {
  font-size: 12px;
}

.image-template-visual.compare {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-template-visual.compare span {
  grid-column: 1 / -1;
}

.image-template-visual.steps {
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
}

.image-template-visual.steps i {
  min-height: 34px;
}

.image-template-visual.steps span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-template-visual.qrcode {
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
}

.image-template-visual.qrcode b,
.image-template-visual.qrcode span {
  grid-column: 1;
}

.image-template-visual.qrcode i {
  grid-column: 2;
  grid-row: 1 / span 2;
  aspect-ratio: 1;
  min-height: 0;
  background:
    linear-gradient(90deg, #24313a 20%, transparent 21% 30%, #24313a 31% 44%, transparent 45% 60%, #24313a 61% 73%, transparent 74%),
    linear-gradient(#24313a 18%, transparent 19% 31%, #24313a 32% 46%, transparent 47% 62%, #24313a 63% 78%, transparent 79%),
    #fff;
}

.image-chip-preview {
  height: 42px;
  display: grid;
  gap: 4px;
  padding: 5px;
  border-radius: 7px;
  background: var(--panel-alt);
  border: 1px solid rgba(32, 36, 42, 0.08);
}

.image-chip-preview i {
  display: block;
  min-width: 0;
  min-height: 0;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(31, 122, 140, 0.22), rgba(154, 59, 79, 0.18));
}

.image-chip-preview.cover {
  grid-template-columns: 1fr;
}

.image-chip-preview.cover i:nth-child(n + 2),
.image-chip-preview.card i:nth-child(3),
.image-chip-preview.qrcode i:nth-child(n + 2) {
  display: none;
}

.image-chip-preview.card {
  grid-template-rows: 1fr 8px;
}

.image-chip-preview.compare {
  grid-template-columns: 1fr 1fr;
}

.image-chip-preview.compare i:nth-child(3) {
  display: none;
}

.image-chip-preview.steps {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.image-chip-preview.steps i:first-child {
  grid-column: 1 / -1;
}

.image-chip-preview.qrcode {
  width: 42px;
  margin-inline: auto;
}

.block-chip {
  min-width: 0;
  min-height: 42px;
  height: auto;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px;
  text-align: left;
  background: #fff;
}

.favorite-chip,
.image-chip {
  min-width: 0;
  min-height: 42px;
  height: auto;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px 8px;
  text-align: left;
  background: #fff;
}

.favorite-card .favorite-chip {
  width: 100%;
}

.favorite-action {
  min-width: 0;
  height: auto;
  padding: 0;
  font-size: 11px;
}

.block-chip strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-chip strong,
.image-chip strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-chip span,
.favorite-chip span,
.image-chip span,
.template-style-hint span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-chip:hover {
  transform: none;
  border-color: var(--accent);
}

.favorite-chip:hover,
.image-chip:hover {
  transform: none;
  border-color: var(--accent);
}

.image-chip.active {
  border-color: var(--accent);
  background: rgba(31, 122, 140, 0.08);
}

.favorite-template-grid .template-empty {
  grid-column: 1 / -1;
}

.template-variable-panel {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.template-variable-grid,
.combo-variable-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-variable-grid input,
.combo-variable-grid input {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
}

.template-variable-grid input.missing,
.combo-variable-grid input.missing {
  border-color: rgba(156, 60, 54, 0.46);
  background: rgba(156, 60, 54, 0.05);
}

.template-variable-grid input.ready,
.combo-variable-grid input.ready {
  border-color: rgba(29, 143, 100, 0.34);
  background: rgba(29, 143, 100, 0.05);
}

.template-variable-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-variable-hints span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.template-variable-hints span.missing {
  border-color: rgba(156, 60, 54, 0.28);
  background: rgba(156, 60, 54, 0.06);
  color: var(--danger);
}

.template-variable-hints span.ready {
  border-color: rgba(29, 143, 100, 0.25);
  background: rgba(29, 143, 100, 0.07);
  color: #1d6f51;
}

.template-library-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) auto;
  gap: 8px;
  margin: 8px 0 10px;
}

.template-library-tools input,
.template-library-tools select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
}

.template-library-tools button.active {
  border-color: var(--accent);
  background: rgba(31, 122, 140, 0.08);
  color: var(--accent-dark);
}

.template-favorite-check {
  grid-column: 1 / -1;
  min-height: 28px;
}

.article-template-panel .template-favorite-check {
  grid-column: auto;
  min-height: 32px;
  justify-content: flex-start;
}

.component-quick-grid,
.template-card-grid {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.component-quick-grid {
  gap: 9px;
}

.component-group {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.component-group-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.component-group-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.template-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#stylePresetGrid.template-card-grid {
  grid-template-columns: minmax(0, 1fr);
}

.style-preset-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 8px 0 10px;
}

.style-preset-search {
  min-width: 0;
}

.style-preset-search input {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
}

.style-preset-tool-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(48px, 1fr));
  gap: 6px;
}

.style-preset-count {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.style-preset-group {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.style-preset-group-head {
  width: 100%;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
}

.style-preset-group-head b {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
}

.style-preset-group-head::before {
  content: "▾";
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 11px;
  transform: translateY(-1px);
}

.style-preset-group.collapsed .style-preset-group-head::before {
  content: "▸";
}

.style-preset-group-head span {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.style-preset-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.template-package-preview {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.template-package-preview[hidden] {
  display: none;
}

.template-package-head,
.template-package-row,
.template-package-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-package-head strong {
  font-size: 12px;
}

.template-package-head span,
.template-package-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-package-list {
  display: grid;
  gap: 5px;
}

.template-package-row {
  border-top: 1px solid var(--line);
  padding-top: 5px;
}

.template-package-row b {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 11px;
}

.template-package-actions button {
  flex: 1 1 0;
  min-width: 0;
}

.quick-chip,
.template-card {
  min-height: 48px;
  height: auto;
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px;
  text-align: left;
  background: #fff;
}

.quick-chip {
  min-height: 44px;
  padding: 7px 8px;
}

.quick-chip strong,
.template-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-chip span,
.template-card span,
.template-card em {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card em {
  color: var(--accent-dark);
}

.quick-chip:hover,
.template-card:hover {
  transform: none;
  border-color: var(--accent);
}

.template-card.active {
  border-color: var(--accent);
  background: rgba(31, 122, 140, 0.08);
}

.template-card.favorite:not(.active) {
  border-color: rgba(31, 122, 140, 0.26);
}

.template-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  text-align: center;
}

.template-preview {
  display: grid;
  gap: 7px;
  margin: 8px 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cover-maker {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cover-maker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cover-maker-head strong {
  font-size: 12px;
}

.cover-maker-head select {
  max-width: 96px;
  height: 30px;
}

.cover-preview {
  min-height: 86px;
}

.cover-preview-card {
  overflow: hidden;
  display: grid;
  gap: 7px;
  min-height: 92px;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid rgba(32, 36, 42, 0.08);
}

.cover-preview-card span {
  width: fit-content;
  max-width: 100%;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
}

.cover-preview-card strong {
  overflow: hidden;
  color: inherit;
  font-size: 17px;
  line-height: 1.22;
  text-overflow: ellipsis;
}

.cover-preview-card small {
  overflow: hidden;
  display: -webkit-box;
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.template-preview-head {
  display: grid;
  gap: 3px;
}

.template-preview-head strong {
  color: var(--ink);
  font-size: 13px;
}

.template-preview-head span,
.template-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.template-outline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.template-visual-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.template-fragment {
  height: auto;
  min-height: 58px;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-alt);
  text-align: left;
}

.template-fragment:hover {
  transform: none;
  border-color: var(--accent);
}

.template-fragment b {
  color: var(--ink);
  font-size: 11px;
}

.template-fragment span {
  overflow: hidden;
  display: -webkit-box;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.template-fit {
  display: grid;
  gap: 5px;
}

.template-fit span {
  overflow: hidden;
  border-left: 3px solid var(--accent);
  padding-left: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-outline span {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--accent-dark);
  background: rgba(31, 122, 140, 0.07);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-mini-preview {
  min-width: 0;
  border: 1px solid rgba(32, 36, 42, 0.08);
  border-radius: 8px;
  padding: 8px;
  background: linear-gradient(180deg, #fff 0%, #faf7ef 100%);
}

.template-mini-sheet {
  overflow: hidden;
  display: grid;
  gap: 8px;
  min-height: 230px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(32, 36, 42, 0.06);
}

.template-mini-title {
  display: grid;
  gap: 7px;
  border-bottom: 1px solid rgba(32, 36, 42, 0.08);
  padding-bottom: 9px;
}

.template-mini-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-mini-title p {
  overflow: hidden;
  display: -webkit-box;
  margin: 0;
  border-left: 3px solid var(--accent);
  padding-left: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.template-mini-section {
  display: grid;
  gap: 6px;
}

.template-mini-section b {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border-left: 4px solid var(--accent);
  background: rgba(31, 122, 140, 0.07);
  padding: 5px 8px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-mini-section p {
  height: 7px;
  margin: 0;
  border-radius: 999px;
  background: #ece8dd;
}

.template-mini-section p:last-child {
  width: 72%;
}

.template-mini-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.35;
}

.template-mini-list li {
  min-width: 0;
}

.template-mini-table {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 10px;
}

.template-mini-table span,
.template-mini-table b {
  min-width: 0;
  overflow: hidden;
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-mini-table span:nth-last-child(-n + 2),
.template-mini-table b:nth-last-child(-n + 1) {
  border-bottom: 0;
}

.template-mini-table span {
  background: var(--panel-alt);
  color: var(--muted);
}

.template-mini-table b {
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

.template-mini-image {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px dashed rgba(31, 122, 140, 0.38);
  border-radius: 8px;
  padding: 7px;
  background: rgba(31, 122, 140, 0.05);
}

.template-mini-image span {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(31, 122, 140, 0.2), rgba(212, 91, 44, 0.18)),
    linear-gradient(45deg, transparent 44%, rgba(255, 255, 255, 0.8) 45% 55%, transparent 56%);
}

.template-mini-image.qrcode span {
  aspect-ratio: 1;
  background:
    linear-gradient(90deg, #24313a 20%, transparent 21% 30%, #24313a 31% 44%, transparent 45% 60%, #24313a 61% 73%, transparent 74%),
    linear-gradient(#24313a 18%, transparent 19% 31%, #24313a 32% 46%, transparent 47% 62%, #24313a 63% 78%, transparent 79%),
    #fff;
}

.template-mini-image b {
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-mini-tail {
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-alt);
  padding: 4px 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-style-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.template-style-hint span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-style-hint button {
  flex: 0 0 auto;
}

.template-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
}

.template-actions button {
  width: 100%;
  min-width: 0;
}

.outline-panel {
  display: none;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
  overflow-x: auto;
}

.outline-empty,
.outline-item {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  white-space: nowrap;
  font-size: 12px;
}

.outline-empty {
  color: var(--muted);
}

.outline-item {
  background: #fff;
  color: var(--ink);
}

.outline-item.level-1 {
  font-weight: 800;
}

.outline-item.level-2 {
  color: var(--accent-dark);
}

.outline-item.level-3 {
  color: var(--muted);
}

.find-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
}

.find-panel input[type="search"],
.find-panel input[type="text"] {
  min-width: 96px;
  flex: 1 1 112px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
  font-size: 13px;
}

.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.mini-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

#findSummary {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.find-panel button {
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: var(--editor-col) 8px var(--preview-col) 8px var(--settings-col);
  gap: 10px;
  overflow-x: hidden;
  padding: 18px 18px 10px;
  min-height: calc(100vh - 72px);
}

.column-resizer {
  position: sticky;
  top: 90px;
  z-index: 4;
  height: calc(100vh - 108px);
  align-self: start;
  border-radius: 999px;
  cursor: col-resize;
  background: transparent;
}

.column-resizer::before {
  content: "";
  display: block;
  width: 2px;
  height: 100%;
  margin: 0 auto;
  border-radius: 999px;
  background: rgba(32, 36, 42, 0.12);
  transition: width 0.16s ease, background 0.16s ease;
}

.column-resizer:hover::before,
.column-resizer.dragging::before {
  width: 4px;
  background: var(--accent);
}

body.resizing-columns {
  cursor: col-resize;
  user-select: none;
}

.editor-pane,
.preview-pane,
.settings-pane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.editor-pane,
.preview-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 90px;
  height: calc(100vh - 108px);
  max-height: calc(100vh - 108px);
}

.settings-pane {
  align-self: start;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  background: linear-gradient(180deg, #fffdf8 0%, #fbf8ef 100%);
  scrollbar-gutter: stable;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  position: sticky;
  top: 49px;
  z-index: 4;
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(12px);
}

.settings-tab {
  height: 34px;
  min-width: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-tab.active {
  border-color: var(--accent);
  background: rgba(31, 122, 140, 0.1);
  color: var(--accent-dark);
}

.tab-badge {
  position: absolute;
  top: -7px;
  right: -5px;
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.settings-tab.active .tab-badge,
.tab-badge.warn {
  background: var(--accent);
  color: #fff;
}

.tab-badge.warn {
  background: var(--danger);
}

.settings-panel {
  min-height: 320px;
  padding: 12px 14px 14px;
}

.settings-panel[hidden] {
  display: none;
}

.pane-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.pane-head h2 {
  margin: 0;
  font-size: 15px;
}

.pane-head span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.settings-pane > .pane-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 253, 248, 0.97);
  backdrop-filter: blur(12px);
}

.preview-pane .pane-head {
  flex-wrap: wrap;
}

.preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.sync-scroll-toggle {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.sync-scroll-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.sync-scroll-toggle:has(input:checked) {
  color: var(--accent-dark);
  border-color: rgba(31, 122, 140, 0.32);
  background: rgba(31, 122, 140, 0.08);
}

.segmented-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
}

.segment-btn {
  height: 26px;
  min-width: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.segment-btn:hover {
  transform: none;
  color: var(--accent-dark);
}

.segment-btn.active {
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(32, 36, 42, 0.12);
}

#source {
  flex: 1;
  min-height: 560px;
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  padding: 18px;
  background: #fffdf8;
  color: var(--ink);
  line-height: 1.75;
  font-size: 15px;
}

.status-strip {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  background: var(--panel-alt);
}

.phone-shell {
  flex: 1;
  overflow: auto;
  padding: 22px 22px 20px;
  background: #ede8dd;
  scroll-padding-bottom: 20px;
}

.wechat-preview {
  width: min(100%, 677px);
  min-height: 720px;
  margin: 0 auto 8px;
  padding: 32px 28px 34px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(32, 36, 42, 0.16);
  overflow-wrap: anywhere;
}

.wechat-preview [data-md-start] {
  cursor: pointer;
  transition: background-color 0.16s ease, outline-color 0.16s ease;
}

.wechat-preview [data-md-start]:hover {
  background-color: rgba(31, 122, 140, 0.06);
  outline: 1px solid rgba(31, 122, 140, 0.22);
  outline-offset: 3px;
}

.wechat-preview img[data-md-start]:hover,
.wechat-preview [data-md-type="image"]:hover img {
  outline: 2px solid rgba(31, 122, 140, 0.35);
  outline-offset: 3px;
}

.phone-shell[data-preview-mode="mobile"] .wechat-preview {
  width: min(100%, 390px);
}

.phone-shell[data-preview-mode="compact"] .wechat-preview {
  width: min(100%, 335px);
}

.field {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.compact-field {
  margin: 0;
}

.field span,
.check-field span {
  font-size: 13px;
  color: var(--muted);
}

.field b {
  color: var(--ink);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.field textarea {
  min-height: 74px;
  padding: 9px 10px;
  line-height: 1.55;
}

.small-textarea {
  max-height: 130px;
}

.field input[type="color"] {
  height: 42px;
  padding: 5px;
}

.field input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.check-field {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 18px;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.tips {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.tips strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

.tips p {
  margin: 0;
}

.checks,
.snapshots,
.asset-manager,
.handoff-confirm {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.publish-overview {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.publish-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.publish-overview-head strong {
  font-size: 13px;
}

.publish-overview-head span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.publish-required-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.publish-required-summary span,
.rule-note {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.publish-required-summary span.ok {
  border-color: rgba(29, 143, 100, 0.25);
  background: rgba(29, 143, 100, 0.07);
  color: #1d6f51;
}

.publish-required-summary span.warn,
.rule-note.warn {
  border-color: rgba(156, 60, 54, 0.28);
  background: rgba(156, 60, 54, 0.06);
  color: var(--danger);
}

.rule-note {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 12px;
  border-radius: 8px;
}

.settings-panel > .checks:first-child,
.settings-panel > .snapshots:first-child,
.settings-panel > .asset-manager:first-child,
.settings-panel > .handoff-confirm:first-child {
  margin-top: 8px;
  border-top: 0;
  padding-top: 0;
}

.checks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.checks-head strong {
  font-size: 13px;
}

.checks-head span {
  color: var(--muted);
  font-size: 12px;
}

.check-list {
  display: grid;
  gap: 8px;
}

.handoff-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ebe6dc;
}

.handoff-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.handoff-list {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.handoff-item {
  display: grid;
  grid-template-columns: 38px 52px minmax(0, 1fr) 48px;
  gap: 7px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.handoff-item span {
  display: inline-grid;
  place-items: center;
  height: 22px;
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.1);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.handoff-item.warn span {
  background: rgba(156, 60, 54, 0.08);
  color: var(--danger);
}

.handoff-item b {
  color: var(--ink);
  font-size: 12px;
}

.handoff-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.handoff-item button {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

.asset-section {
  padding-bottom: 10px;
}

.asset-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 12px;
  cursor: pointer;
  list-style: none;
}

.asset-summary::-webkit-details-marker {
  display: none;
}

.asset-summary::after {
  content: "展开";
  color: var(--muted);
  font-size: 12px;
}

.asset-section[open] .asset-summary::after {
  content: "收起";
}

.asset-summary strong {
  font-size: 13px;
}

.asset-summary span {
  color: var(--muted);
  font-size: 12px;
}

.mini-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 8px 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
}

.mini-segment {
  height: 28px;
  min-width: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mini-segment:hover {
  transform: none;
  color: var(--accent-dark);
}

.mini-segment.active {
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(32, 36, 42, 0.12);
}

.image-asset-list,
.link-asset-list,
.sensitive-hit-list,
.brand-term-list,
.package-preview {
  display: grid;
  gap: 8px;
}

.image-asset-list,
.link-asset-list,
.sensitive-hit-list,
.brand-term-list,
.check-list,
.snapshot-list,
.handoff-list {
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.package-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.package-card b {
  display: block;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.package-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.package-lines {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.package-lines div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.package-lines span {
  color: var(--muted);
  font-size: 12px;
}

.package-lines b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12px;
}

.package-details {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(156, 60, 54, 0.24);
  border-radius: 8px;
  background: rgba(156, 60, 54, 0.05);
}

.package-details strong {
  color: var(--danger);
  font-size: 12px;
}

.package-details span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.image-asset-empty,
.link-asset-empty,
.sensitive-hit-empty,
.brand-term-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.image-asset-row,
.link-asset-row,
.sensitive-hit-row,
.brand-term-row {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-asset-row {
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
}

.link-asset-row,
.sensitive-hit-row,
.brand-term-row {
  grid-template-columns: 1fr;
}

.image-asset-thumb {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-alt);
  object-fit: cover;
}

.image-asset-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 16px;
}

.image-asset-meta,
.link-asset-meta,
.sensitive-hit-meta {
  min-width: 0;
}

.image-asset-title,
.image-asset-url,
.link-asset-title,
.link-asset-url,
.sensitive-hit-title,
.sensitive-hit-context,
.brand-term-title,
.brand-term-context {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-asset-title,
.link-asset-title,
.sensitive-hit-title,
.brand-term-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.brand-term-title span {
  color: var(--accent-dark);
  font-weight: 600;
}

.image-asset-url,
.link-asset-url,
.sensitive-hit-context,
.brand-term-context {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.image-asset-tags,
.link-asset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.image-asset-tag,
.link-asset-tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.image-asset-tag.warn,
.link-asset-tag.warn {
  border-color: rgba(156, 60, 54, 0.3);
  color: var(--danger);
  background: rgba(156, 60, 54, 0.06);
}

.image-asset-actions,
.link-asset-actions,
.sensitive-hit-actions,
.brand-term-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.image-asset-actions button,
.link-asset-actions button,
.sensitive-hit-actions button,
.brand-term-actions button {
  height: 28px;
  flex: 1;
  padding: 0 8px;
  font-size: 12px;
}

.snapshot-list {
  display: grid;
  gap: 8px;
}

.snapshot-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.snapshot-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.snapshot-meta {
  min-width: 0;
}

.snapshot-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snapshot-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.snapshot-actions {
  display: flex;
  gap: 8px;
}

.snapshot-actions button {
  height: 28px;
  flex: 1;
  padding: 0 8px;
  font-size: 12px;
}

.check-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 8px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.check-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.check-row.ok .check-dot {
  background: #1d8f64;
}

.check-row.warn .check-dot {
  background: var(--danger);
}

.check-row.info .check-dot {
  background: var(--accent);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 36, 42, 0.42);
}

.modal-overlay[hidden] {
  display: none;
}

.copy-confirm-modal {
  width: min(460px, 100%);
  max-height: min(620px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.modal-card {
  width: min(420px, 100%);
  max-height: min(620px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.combo-confirm-preview {
  display: grid;
  gap: 5px;
  margin: 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.combo-confirm-preview strong {
  color: var(--ink);
  font-size: 13px;
}

.combo-confirm-preview span {
  overflow: hidden;
  display: -webkit-box;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.donate-body {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donate-body p {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.donate-body small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.donate-qr {
  overflow: hidden;
  width: 148px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31, 122, 140, 0.16);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #f8fbf8 100%);
}

.donate-qr-crop {
  overflow: hidden;
  width: 124px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(34, 180, 100, 0.12) 10px, transparent 10px) 0 0 / 22px 22px,
    linear-gradient(rgba(34, 180, 100, 0.12) 10px, transparent 10px) 0 0 / 22px 22px,
    #f7fff9;
}

.donate-qr-crop img {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  object-fit: cover;
  object-position: center;
}

.donate-qr-crop img.loaded {
  opacity: 1;
}

.donate-qr-crop img[hidden] {
  display: none;
}

.donate-qr-crop span {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 1px solid rgba(31, 122, 140, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 20px rgba(31, 122, 140, 0.12);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-head strong {
  font-size: 15px;
}

.modal-head span {
  color: var(--muted);
  font-size: 12px;
}

.modal-actions {
  margin: 12px 0 0;
}

.modal-actions button {
  flex: 1 1 0;
  min-width: 0;
}

.copy-risk-group {
  display: grid;
  gap: 7px;
}

.copy-risk-group + .copy-risk-group {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.copy-risk-group strong {
  font-size: 12px;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .column-resizer {
    display: none;
  }

  .find-panel .mini-check,
  #findSummary {
    justify-content: flex-start;
  }

  .settings-pane {
    order: -1;
    position: static;
    max-height: none;
    overflow: visible;
  }

  .editor-pane,
  .preview-pane {
    position: static;
    height: auto;
    max-height: none;
  }

  #source {
    min-height: 380px;
  }
}

.app-footer {
  width: 100%;
  min-height: 42px;
  max-width: none;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0;
  padding: 0 18px;
  color: rgba(103, 113, 125, 0.72);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.app-footer span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.app-footer i {
  width: 3px;
  height: 3px;
  display: inline-block;
  border-radius: 50%;
  background: rgba(103, 113, 125, 0.38);
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    max-width: 100%;
  }

  .top-actions button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .editor-tools {
    padding: 9px 10px;
  }

  .format-tools {
    gap: 6px;
  }

  .action-tools {
    gap: 7px;
  }

  .action-tools .ghost-btn {
    flex-basis: calc(50% - 4px);
  }

  .icon-btn {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
  }

  .phone-shell {
    padding: 10px 10px 18px;
  }

  .preview-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .wechat-preview {
    margin-bottom: 8px;
    padding: 24px 18px 30px;
  }
}
