/* Admin panel: WXBot-style operations shell with V3 brand colors. */
:root {
  --brand-primary: #9a613b;
  --brand-primary-dark: #7b4423;
  --brand-primary-soft: #faeee6;
  --brand-primary-tint: #fff8f4;
  --wechat-bg: #ededed;
  --wechat-card: #ffffff;
  --wechat-text: #191919;
  --wechat-text-secondary: #888888;
  --wechat-text-hint: #b2b2b2;
  --wechat-line: #e5e5e5;
  --wechat-brand: #576b95;
  --danger: #fa5151;
  --success: #16a34a;
  --warning: #ffc300;
  --info: #10aeff;
  --sidebar-bg: #27231f;
  --sidebar-bg-raised: #332d28;
  --sidebar-muted: rgba(255, 255, 255, 0.62);
  --surface-l1: #ffffff;
  --surface-l2: #f7f7f7;
  --surface-l3: #ffffff;
  --surface-l4: #fafafa;
  --bg: #f0f0f0;
  --surface: var(--surface-l1);
  --ink: var(--wechat-text);
  --muted: var(--wechat-text-secondary);
  --line: var(--wechat-line);
  --accent: var(--brand-primary);
  --accent-light: var(--brand-primary-soft);
  --font-brand: 24px;
  --font-page-title: 16px;
  --font-card-title: 15px;
  --font-control-title: 14px;
  --font-body: 13px;
  --font-description: 13px;
  --font-compact: 12px;
  --font-meta: 12px;
  --font-stat: 20px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-title: 1.35;
  --line-height-body: 1.6;
  --line-height-meta: 1.5;
  --radius: 8px;
  --control-radius: 6px;
  --topbar-h: 56px;
  --sidebar-w: 150px;
  --shadow: 0 1px 2px rgba(25, 25, 25, 0.04), 0 8px 24px rgba(25, 25, 25, 0.04);
  --shadow-lg: 0 18px 46px rgba(25, 25, 25, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--wechat-text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-body);
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--wechat-line);
  border-radius: var(--control-radius);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--wechat-text-hint);
  font-size: var(--font-compact);
  font-weight: var(--font-weight-regular);
}

select {
  padding-right: 30px;
}

textarea {
  overflow-y: hidden;
  resize: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(154, 97, 59, 0.16);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: var(--wechat-text-hint);
  background: #f7f7f7;
}

.hidden {
  display: none !important;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(160deg, rgba(249, 228, 208, 0.54), rgba(240, 240, 240, 0) 46%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  display: grid;
  gap: 16px;
  padding: 32px;
  border: 1px solid rgba(154, 97, 59, 0.28);
  border-radius: 8px;
  background: var(--surface-l1);
  box-shadow: var(--shadow-lg);
}

.login-card h1,
.login-card p {
  margin: 0;
  text-align: center;
}

.login-card h1 {
  font-size: var(--font-page-title);
  font-weight: var(--font-weight-bold);
}

.login-card p {
  color: var(--muted);
  font-size: var(--font-body);
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: #fff;
  z-index: 30;
}

.sidebar-brand {
  min-height: var(--topbar-h);
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h1 {
  margin: 0;
}

.sidebar-brand h1 {
  font-size: var(--font-brand);
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-item {
  position: relative;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  padding: 0 14px 0 18px;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: var(--font-body);
  font-weight: var(--font-weight-semibold);
  text-align: left;
  line-height: var(--line-height-title);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item:focus {
  outline: 0;
}

.nav-item:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.nav-item.active {
  color: #fff;
  background: var(--brand-primary);
  box-shadow: none;
  outline: 0;
}

.nav-item.active:focus-visible {
  box-shadow: none;
}

.nav-group-start {
  margin-top: 14px;
}

.nav-group-start::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 10px;
  right: 10px;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--sidebar-bg-raised);
}

.miniprogram-switcher {
  display: grid;
  gap: 7px;
}

.miniprogram-switcher label {
  color: var(--sidebar-muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
}

.miniprogram-switcher select {
  min-width: 0;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.miniprogram-switcher option {
  color: var(--wechat-text);
}

.main {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(229, 229, 229, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.breadcrumb {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
}

.breadcrumb strong {
  color: var(--wechat-text);
  font-weight: var(--font-weight-bold);
}

.topbar-user,
.panel-actions,
.batch-actions,
.filter-bar,
.modal-actions,
.save-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-actions {
  justify-content: flex-end;
}

.topbar-user {
  justify-content: flex-end;
  color: var(--muted);
  font-size: var(--font-meta);
}

.admin-menu-btn {
  width: 38px;
  height: 38px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--wechat-text);
  cursor: pointer;
}

.admin-menu-btn:hover {
  border-color: rgba(154, 97, 59, 0.48);
  background: var(--brand-primary-tint);
}

.admin-menu-icon {
  width: 18px;
  height: 14px;
  position: relative;
  display: grid;
  align-content: space-between;
}

.admin-menu-icon span {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.admin-menu-btn[aria-expanded="true"] .admin-menu-icon {
  align-content: center;
}

.admin-menu-btn[aria-expanded="true"] .admin-menu-icon span:nth-child(1) {
  transform: translateY(2px) rotate(45deg);
}

.admin-menu-btn[aria-expanded="true"] .admin-menu-icon span:nth-child(2) {
  opacity: 0;
}

.admin-menu-btn[aria-expanded="true"] .admin-menu-icon span:nth-child(3) {
  transform: translateY(-2px) rotate(-45deg);
}

.content {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 24px 28px 56px;
}

.section {
  display: none;
  max-width: 1440px;
}

.section.active {
  display: block;
}

.section-page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.section-page-copy {
  min-width: 0;
}

.section > h2,
.section-page-copy > h2 {
  margin: 0 0 4px;
  color: var(--wechat-text);
  font-size: var(--font-page-title);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0;
}

.section-hint {
  max-width: 860px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: var(--font-description);
  line-height: var(--line-height-body);
}

.section-note {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: var(--font-description);
  line-height: var(--line-height-body);
}

.modal-hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-description);
  line-height: var(--line-height-body);
}

.section-page-copy > .section-hint {
  margin: 0;
}

.dashboard-page-head {
  display: block;
  margin-bottom: 4px;
}

.dashboard-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dashboard-page-head .section-page-copy > h2,
.dashboard-page-head .status {
  margin: 0;
}

.dashboard-page-head .status {
  text-align: left;
}

.panel,
.info-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  min-width: 0;
  margin-bottom: 16px;
  padding: 20px 24px 24px;
  background: var(--surface-l1);
  box-shadow: var(--shadow);
}

.panel:has(.data-table),
.panel:has(.content-edit-table) {
  overflow-x: auto;
}

.panel:has(.pool-table) {
  overflow-x: hidden;
}

.panel > h3,
.panel-header h3,
.info-block h3 {
  margin: 0;
  color: var(--wechat-text);
  font-size: var(--font-card-title);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-title);
}

.panel > h3 {
  padding-bottom: 12px;
}

.panel-header {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

/* L1 card header actions share the control-title hierarchy. */
.panel-header > :is(.btn-primary, .btn-outline, .btn-ghost, .btn-text),
.panel-header > :is(.panel-actions, .batch-actions) :is(.btn-primary, .btn-outline, .btn-ghost, .btn-text) {
  font-size: var(--font-control-title);
}

.toolbar {
  align-items: center;
}

.toolbar-filters {
  flex: 1 1 auto;
  min-width: 0;
}

.toolbar-filters-compact {
  flex: 0 1 220px;
  justify-content: flex-end;
}

.toolbar-filters select,
.toolbar-filters input {
  flex: 1 1 160px;
  width: auto;
  min-width: 140px;
}

.toolbar-filters input {
  flex-grow: 1.4;
}

.panel-subtitle,
.panel-tip,
.panel-note,
.setting-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-description);
  line-height: var(--line-height-body);
}

.status,
.toolbar-tip {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-meta);
  line-height: var(--line-height-meta);
}

.status {
  margin: 0 0 12px;
}

.status.status-inline {
  flex: 0 0 auto;
  margin: 0;
}

.panel-note {
  margin-top: 10px;
}

.panel-header .panel-subtitle {
  margin-top: 5px;
}

.status.ok {
  color: #0f7a3d;
}

.status.error {
  color: var(--danger);
}

.empty-panel {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-l2);
  color: var(--muted);
  font-size: var(--font-body);
  text-align: center;
}

.btn-primary,
.btn-outline,
.btn-ghost,
.btn-text {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 0 14px;
  border-radius: var(--control-radius);
  font-size: var(--font-body);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-title);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  border: 1px solid var(--brand-primary);
  background: var(--brand-primary);
  color: #fff;
}

.btn-primary:hover {
  border-color: var(--brand-primary-dark);
  background: var(--brand-primary-dark);
}

.btn-outline {
  border: 1px solid var(--brand-primary);
  background: #fff;
  color: var(--brand-primary);
}

.btn-outline:hover,
.btn-text:hover {
  background: var(--brand-primary-soft);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--wechat-text);
}

.btn-ghost:hover {
  border-color: rgba(154, 97, 59, 0.46);
  background: var(--brand-primary-tint);
}

.btn-text {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--brand-primary);
}

.btn-danger {
  color: var(--danger);
}

.btn-success {
  color: var(--success);
}

.btn-success:hover {
  border-color: rgba(22, 163, 74, 0.24);
  background: #effbf3;
}

.btn-danger:hover {
  border-color: rgba(250, 81, 81, 0.24);
  background: #fff1f0;
}

.btn-primary:disabled,
.btn-outline:disabled,
.btn-ghost:disabled,
.btn-text:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-text.btn-danger:disabled:hover {
  border-color: transparent;
  background: transparent;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 16px;
}

.form-grid .form-field:has(textarea) {
  grid-column: span 2;
}

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

.form-field label,
.inline-label {
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
}

.secret-input-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.secret-input-control:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(154, 97, 59, 0.16);
}

.secret-input-control > input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.secret-input-control > input:focus {
  border-color: transparent;
  box-shadow: none;
}

.secret-visibility-toggle {
  min-width: 52px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--brand-primary);
  font: inherit;
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
}

.secret-visibility-toggle:hover {
  background: var(--brand-primary-tint);
}

.secret-visibility-toggle:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}

.form-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--wechat-text);
  font-size: var(--font-body);
  cursor: pointer;
}

.form-row input[type="checkbox"],
.data-table input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-primary);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.dashboard-overview-grid {
  display: grid;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.dashboard-overview-grid > .panel {
  margin-bottom: 0;
}

.dashboard-hero-panel,
.dashboard-risk-panel {
  display: flex;
  flex-direction: column;
}

.dashboard-hero-panel .stats-row {
  flex: 1;
}

.stats-row-compact {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.stat-card {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-l2);
  text-align: center;
}

.stat-value {
  display: block;
  color: var(--wechat-text);
  font-size: var(--font-stat);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
}

.stats-row-compact .stat-card {
  min-height: 76px;
  padding: 12px;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: var(--font-compact);
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-l2);
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--brand-primary-tint);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
  font-size: var(--font-meta);
}

.table-pagination .btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-l1);
  color: var(--text);
  cursor: pointer;
}

.table-pagination .btn-icon:disabled {
  opacity: 0.45;
  cursor: default;
}

.data-table input:not([type="checkbox"]),
.data-table select,
.data-table textarea {
  min-width: 120px;
  min-height: 32px;
  padding: 6px 8px;
  font-size: var(--font-compact);
}

.data-table .btn-text {
  font-size: var(--font-compact);
}

.pool-table {
  width: 100%;
  table-layout: fixed;
  min-width: 0;
}

.pool-table th,
.pool-table td {
  padding-right: 8px;
  padding-left: 8px;
}

.pool-table th:nth-child(1),
.pool-table td:nth-child(1) { width: 4%; }
.pool-table th:nth-child(2),
.pool-table td:nth-child(2) { width: 9%; }
.pool-table th:nth-child(3),
.pool-table td:nth-child(3) { width: 30%; overflow-wrap: anywhere; }
.pool-table th:nth-child(4),
.pool-table td:nth-child(4),
.pool-table th:nth-child(5),
.pool-table td:nth-child(5),
.pool-table th:nth-child(6),
.pool-table td:nth-child(6),
.pool-table th:nth-child(7),
.pool-table td:nth-child(7),
.pool-table th:nth-child(8),
.pool-table td:nth-child(8),
.pool-table th:nth-child(9),
.pool-table td:nth-child(9) { width: 7%; }
.pool-table th:nth-child(10),
.pool-table td:nth-child(10) { width: 100px; white-space: normal; }

.content-edit-table {
  table-layout: fixed;
}

.content-edit-table input:not([type="checkbox"]),
.content-edit-table textarea {
  display: block;
  min-width: 0;
  min-height: 36px;
  height: 36px;
  padding: 5px 8px;
  line-height: 24px;
  vertical-align: middle;
}

.content-edit-table .col-id { width: 56px; }
.content-edit-table .col-count { width: 64px; }
.content-edit-table .col-status { width: 80px; }
.content-edit-table .col-actions { width: 100px; }
.content-table-blind-notes { min-width: 720px; }
.content-table-blind-notes .col-title { width: 112px; }
.content-table-blind-notes .col-copy { width: calc(100% - 332px); }
.content-table-blind-albums { min-width: 960px; }
.content-table-blind-albums .col-title { width: 112px; }
.content-table-blind-albums .col-image-ids { width: calc(100% - 492px); }
.content-table-blind-albums .col-preview { width: 144px; }
.content-table-blind-audios { min-width: 960px; }
.content-table-blind-audios .col-title { width: 112px; }
.content-table-blind-audios .col-audio-title { width: calc(100% - 636px); }
.content-table-blind-audios .col-audio-name { width: 200px; }
.content-table-blind-audios .col-duration { width: 80px; }
.content-table-blind-audios .col-size { width: 88px; }
.content-table-blind-audios .col-actions { width: 100px; }
.content-table-letters { min-width: 640px; }
.content-table-letters .col-copy { width: calc(100% - 268px); }
.content-table-letters .col-type { width: 112px; }
.content-table-diary { min-width: 1120px; }
.content-table-diary .col-date { width: 124px; }
.content-table-diary .col-mood { width: 112px; }
.content-table-diary .col-copy { width: calc(100% - 776px); }
.content-table-diary .col-image-ids { width: 160px; }
.content-table-diary .col-preview { width: 144px; }

/* Keep auxiliary columns compact; editable content receives the remaining table width. */
.content-edit-table th:nth-child(2),
.content-edit-table td:nth-child(2) {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
}

.content-table-blind-audios th:nth-child(3),
.content-table-blind-audios td:nth-child(3) { min-width: 280px; }

.content-table-blind-audios th:nth-child(4),
.content-table-blind-audios td:nth-child(4) {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
}

.content-table-blind-audios th:nth-last-child(1),
.content-table-blind-audios td:nth-last-child(1) {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}

.audio-original-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.content-row-actions .btn-text {
  flex: 0 0 auto;
  white-space: nowrap;
}

.content-table-diary th:nth-child(3),
.content-table-diary td:nth-child(3) {
  width: 124px;
  min-width: 124px;
  max-width: 124px;
}

.content-edit-table th:nth-last-child(1),
.content-edit-table td:nth-last-child(1) {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.badge-success { background: #e8f7ef; color: #0f7a3d; }
.badge-draft,
.badge-warning { background: #fff7d6; color: #8a5a00; }
.badge-info { background: #eef4ff; color: var(--wechat-brand); }
.badge-danger { background: #fff1f0; color: #b42318; }

.info-block {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--surface-l2);
  color: var(--muted);
  font-size: var(--font-body);
  line-height: var(--line-height-body);
}

.preflight-list,
.guardrails,
.input-list,
.image-editor-list,
.account-list,
.message-list,
.keyword-list {
  display: grid;
  gap: 10px;
}

.preflight-list-compact {
  max-height: 258px;
  overflow: auto;
  padding-right: 2px;
}

@media (min-width: 1081px) {
  .dashboard-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, 240px);
  }

  .dashboard-overview-grid > .panel {
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
  }

  .dashboard-overview-grid .dashboard-risk-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .dashboard-risk-panel {
    overflow: hidden;
  }

  .dashboard-risk-panel .preflight-list-compact {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}

.preflight-row {
  display: grid;
  grid-template-columns: auto minmax(88px, 0.45fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-l2);
}

.preflight-row strong {
  font-size: var(--font-compact);
  font-weight: var(--font-weight-semibold);
}

.preflight-row span:last-child {
  min-width: 0;
  color: var(--muted);
  font-size: var(--font-compact);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-title);
}

.toggle {
  position: relative;
  width: auto;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--wechat-text);
  font-size: var(--font-body);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  width: 1px;
  min-height: 0;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.toggle-slider {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 20px;
  border: 1px solid rgba(25, 25, 25, 0.08);
  border-radius: 999px;
  background: #d8d8d8;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(25, 25, 25, 0.16);
  transition: transform 0.16s ease;
}

.toggle input:checked + .toggle-slider {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
}

.toggle input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

.toggle input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(154, 97, 59, 0.2);
}

.compact-toggle {
  justify-content: flex-start;
}

.ads-page-grid {
  display: grid;
  gap: 16px;
}

.ads-page-grid > .panel {
  margin-bottom: 0;
}

.ad-page-card-title {
  align-items: flex-start;
}

.ad-page-card-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--font-description);
  line-height: var(--line-height-body);
}

.ad-page-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ad-page-card .ad-page-card-title {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.ad-page-card .ad-page-card-title h3 {
  font-size: var(--font-card-title);
  line-height: var(--line-height-title);
}

.ad-page-card .config-card + .config-card {
  margin-top: 0;
}

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

.ad-config-card-stacked .ad-config-id-field {
  grid-column: 1 / -1;
}

.config-list {
  display: grid;
  gap: 10px;
}

.config-card + .config-card {
  margin-top: 10px;
}

.config-card {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-l2);
}

.config-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.config-card-copy {
  min-width: 0;
}

.config-card-head strong {
  display: block;
  color: var(--ink);
  font-size: var(--font-control-title);
  font-weight: var(--font-weight-semibold);
}

.config-card-description {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--font-description);
  line-height: var(--line-height-body);
}

.config-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding-top: 2px;
}

.plain-rule-grid div {
  display: grid;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.config-note-grid dt {
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
}

.config-note-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: var(--font-body);
  line-height: var(--line-height-body);
}

.preflight-item,
.editor-item,
.message-item,
.account-item,
.keyword-row,
.config-row,
.ad-unit,
.image-editor-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-l2);
}

.editor-item,
.image-editor-item {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.editor-item p,
.message-item p,
.account-item p {
  margin: 0;
  line-height: var(--line-height-body);
}

.editor-item small,
.message-item small,
.account-item small,
.cell-note {
  display: block;
  color: var(--muted);
  font-size: var(--font-meta);
  line-height: var(--line-height-meta);
}

.message-source-cell {
  display: grid;
  gap: 3px;
}

.row-actions {
  white-space: nowrap;
}

.thumb-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.thumb-link {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(135deg, #d7b394, #9e765b);
  color: #fff;
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}

.thumb-link img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-link.has-image span {
  display: none;
}

.thumb-link span {
  position: relative;
  z-index: 1;
  max-width: 30px;
  overflow: hidden;
  padding: 1px 3px;
  border-radius: 999px;
  background: rgba(25, 25, 25, 0.52);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-error {
  border-color: rgba(250, 81, 81, 0.5);
  opacity: 0.65;
}

.trend-chart {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-l2);
}

.trend-chart canvas {
  display: block;
  width: 100%;
  height: 280px;
}

.trend-empty {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: var(--font-body);
  font-weight: var(--font-weight-semibold);
}

.trend-chart.is-empty .trend-empty {
  display: flex;
}

.trend-legend {
  display: none;
}

.trend-tooltip-row {
  display: grid;
  grid-template-columns: 9px minmax(64px, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
}

.trend-tooltip-row i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.trend-tooltip-row span {
  min-width: 0;
}

.trend-tooltip-row b {
  color: var(--wechat-text);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}

.trend-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 148px;
  padding: 10px 12px;
  border: 1px solid rgba(25, 25, 25, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: var(--font-meta);
  pointer-events: none;
}

.trend-tooltip[hidden] {
  display: none;
}

.trend-tooltip-date {
  display: block;
  margin-bottom: 6px;
  color: var(--wechat-text);
  font-size: var(--font-body);
  font-weight: var(--font-weight-semibold);
}

.trend-tooltip-list {
  display: grid;
  gap: 2px;
}

.pool-select-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pool-select-inline {
  width: auto;
  min-width: 150px;
}

.pool-row {
  cursor: pointer;
}

.pool-row.active {
  background: var(--brand-primary-tint);
}

.pool-row.active td:first-child {
  color: var(--brand-primary);
  font-weight: var(--font-weight-bold);
}

.settings-cluster {
  display: block;
}

.settings-cluster + .settings-cluster {
  margin-top: 16px;
}

.settings-subsection-stack,
.settings-subsection {
  display: grid;
  gap: 12px;
}

.settings-subsection .setting-subtitle {
  margin: 0;
}

.setting-subtitle {
  margin: 0 0 10px;
  color: var(--wechat-text);
  font-size: var(--font-control-title);
  font-weight: var(--font-weight-semibold);
}

.compact-check-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.paired-setting-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.setting-field-control {
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.setting-field-control:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(154, 97, 59, 0.16);
}

.setting-field-control > input {
  min-width: 0;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.setting-field-control > input:focus {
  border-color: transparent;
  box-shadow: none;
}

.form-field .setting-visibility-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  color: var(--wechat-text);
  font-size: var(--font-body);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
}

.setting-visibility-control input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-primary);
}

.system-rule-grid,
.plain-rule-grid,
.account-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.mini-program-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}

.copy-field-grid {
  display: grid;
  gap: 14px 16px;
}

.copy-field-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.copy-field-wide {
  grid-column: 1 / -1;
}

.form-field .field-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: var(--font-compact);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-meta);
}

.security-toggle-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.blind-box-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.global-feature-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.security-toggle-group .config-card + .config-card {
  margin-top: 0;
}

.input-row,
.keyword-row,
.image-url-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-row input,
.keyword-row input {
  flex: 1 1 220px;
}

.share-auto-panel {
  display: grid;
  gap: 18px;
}

.share-auto-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--wechat-text);
  font-size: var(--font-body);
}

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

.share-auto-grid > div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.share-auto-grid span {
  color: var(--muted);
  font-size: var(--font-compact);
}

.share-auto-grid strong {
  color: var(--wechat-text);
  font-size: var(--font-body);
}

.share-catalog {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.share-catalog-group {
  display: grid;
  gap: 12px;
}

.share-catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.share-catalog-head h3,
.share-catalog-head p {
  margin: 0;
}

.share-catalog-head p {
  color: var(--muted);
  font-size: var(--font-compact);
}

.share-preview-refresh {
  align-self: flex-start;
  width: auto;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  flex: 0 0 auto;
}

.share-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 272px);
  align-items: start;
  justify-content: start;
  gap: 12px;
}

.share-card-preview {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-l2);
}

.share-card-cover {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 4;
  container-type: inline-size;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-l2);
}

.share-card-template {
  position: relative;
  overflow: hidden;
}

.share-card-template > img {
  display: block;
  width: 100%;
  height: 100%;
  filter: brightness(calc(1 - var(--share-wash-opacity, 0.1)));
  object-fit: cover;
}

.share-card-template.is-plain > img {
  filter: none;
}

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

.share-card-case {
  color: var(--muted);
  font-size: var(--font-meta);
  line-height: 1.2;
}

.share-card-copy {
  position: absolute;
  display: grid;
  gap: calc((var(--share-divider-gap, 8cqi) - 0.8cqi) / 2);
  isolation: isolate;
  z-index: 1;
  color: var(--share-copy, #fff);
  text-shadow: 0 1px 2px rgba(23, 19, 15, 0.4);
}

.share-card-date {
  color: var(--share-date, #f0d9a8);
  font-size: var(--share-date-font-size, 7.74cqi);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.share-card-phrase {
  font-size: var(--share-copy-font-size, 8cqi);
  font-weight: var(--font-weight-bold);
  line-height: var(--share-copy-line-height, 10cqi);
  white-space: nowrap;
}

.template-centered .share-card-copy {
  top: calc(50% + var(--share-centered-offset-y, 0cqi));
  left: 50%;
  width: 85%;
  text-align: center;
  transform: translate(-50%, -50%);
}

.template-left-title .share-card-copy {
  top: calc(50% + var(--share-left-offset-y, 0cqi));
  left: 7.47%;
  width: 85%;
  transform: translateY(-50%);
}

.share-card-divider {
  display: block;
  width: var(--share-divider-length, 7.74cqi);
  height: 0.8cqi;
  background: var(--share-divider, #f0d9a8);
}

.template-centered .share-card-divider {
  margin-right: auto;
  margin-left: auto;
}

.share-card-template::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: '';
}

.template-centered::before {
  background: linear-gradient(
    to bottom,
    rgba(var(--share-reading-rgb, 28, 24, 19), 0) 0%,
    rgba(var(--share-reading-rgb, 28, 24, 19), var(--share-reading-opacity, 0.3)) calc(50% + var(--share-centered-offset-y, 0cqi)),
    rgba(var(--share-reading-rgb, 28, 24, 19), 0) 100%
  );
}

.template-left-title::before {
  background: linear-gradient(
    to right,
    rgba(var(--share-reading-rgb, 28, 24, 19), var(--share-reading-opacity, 0.3)) 0%,
    rgba(var(--share-reading-rgb, 28, 24, 19), 0) 100%
  );
}

.share-card-title {
  color: var(--wechat-text);
  font-size: var(--font-body);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-body);
}

@media (max-width: 720px) {
  .share-auto-grid,
  .share-card-grid {
    grid-template-columns: 1fr;
  }

  .share-card-preview {
    max-width: 272px;
  }

  .share-catalog-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.keyword-row {
  align-items: stretch;
}

.keyword-row textarea {
  flex: 1 1 320px;
  min-height: 82px;
}

.keyword-row .btn-text {
  align-self: center;
}

.compact-url-field {
  flex: 1 1 220px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
}

.image-table {
  min-width: 1080px;
}

.image-table th:nth-child(6),
.image-table td:nth-child(6),
.image-table th:nth-child(7),
.image-table td:nth-child(7) {
  min-width: 220px;
}

.image-table th:nth-child(8),
.image-table td:nth-child(8) {
  width: 72px;
  min-width: 72px;
  text-align: center;
}

.image-table td:nth-child(8) .btn-text {
  white-space: nowrap;
}

.image-url-input {
  min-width: 200px;
}

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 10;
  justify-content: flex-end;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.save-bar--top {
  position: static;
  z-index: auto;
  align-self: start;
  justify-content: flex-end;
  width: auto;
  min-width: 360px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(25, 25, 25, 0.38);
}

.modal-body {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.modal-body-wide {
  width: min(820px, 100%);
}

.single-content-modal-body {
  width: min(620px, 100%);
}

.single-content-fields {
  display: grid;
  gap: 14px;
}

.single-content-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.single-content-image-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.single-content-image-count {
  color: var(--muted);
  font-size: var(--font-meta);
}

.single-content-image-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, 72px);
  gap: 8px;
}

.single-content-audio-preview {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: var(--font-meta);
}

.single-content-audio-item {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.single-content-audio-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.single-content-image-item {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface-l2);
}

.single-content-image-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.single-content-image-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(25, 25, 25, 0.68);
  color: #fff;
  font: inherit;
  line-height: 24px;
  cursor: pointer;
}

.modal-body h3 {
  margin: 0;
  font-size: var(--font-card-title);
  font-weight: var(--font-weight-bold);
}

.confirm-message {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-body);
  line-height: var(--line-height-body);
}

.import-section-head {
  align-items: center;
}

.import-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.import-type-tab {
  min-width: 96px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: var(--font-control-title);
  cursor: pointer;
}

.import-type-tab:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.import-type-tab.active {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: #fff;
}

.import-source-panel {
  display: grid;
  gap: 14px;
}

.import-source-panel > .panel-header {
  margin: 0;
}

.import-source-panel .pool-select-row {
  margin-bottom: 0;
}

.import-source-head,
.import-preview-head,
.import-item,
.import-item-media {
  display: flex;
  align-items: center;
  gap: 12px;
}

.import-source-head,
.import-preview-head {
  justify-content: space-between;
}

.import-source-actions,
.import-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.import-preview-actions {
  justify-content: flex-end;
}

.import-source-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed rgba(154, 97, 59, 0.72);
  border-radius: var(--control-radius);
  background: var(--brand-primary-tint);
  color: var(--muted);
  font-size: var(--font-description);
}

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

.import-preview-panel {
  margin-bottom: 0;
}

.import-empty {
  padding: 38px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  font-size: var(--font-description);
}

.import-item {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-l2);
  content-visibility: auto;
  contain-intrinsic-size: auto 72px;
}

.import-item:hover {
  border-color: rgba(154, 97, 59, 0.5);
  background: var(--brand-primary-tint);
}

.import-item.has-error {
  border-color: rgba(196, 79, 79, 0.6);
  background: #fffafa;
}

.import-item-index {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #fff;
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
  text-align: center;
}

.import-item-content {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.import-item-content textarea {
  width: 100%;
}

.import-item-meta {
  min-width: 0;
  color: var(--muted);
  font-size: var(--font-meta);
  line-height: var(--line-height-meta);
}

.import-item.has-error .import-item-meta {
  color: var(--danger);
}

.import-item > .btn-text {
  flex: 0 0 auto;
}

.import-item-media {
  align-items: flex-start;
}

.import-item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.import-item-media .import-item-body > input {
  width: min(360px, 100%);
}

.import-diary-fields {
  display: grid;
  grid-template-columns: 132px minmax(120px, 180px) minmax(220px, 1fr);
  gap: 8px;
}

.import-diary-fields textarea {
  min-width: 0;
}

.import-thumb-list {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

.import-thumb-list img,
.import-thumb-list span {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-l2);
  object-fit: cover;
}

.import-thumb-list span {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: var(--font-meta);
}

@media (max-width: 720px) {
  .single-content-field-grid {
    grid-template-columns: 1fr;
  }

  .import-section-head,
  .import-source-head,
  .import-preview-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .import-source-actions,
  .import-preview-actions {
    width: 100%;
  }

  .import-source-actions .btn-primary,
  .import-source-actions .btn-ghost {
    flex: 1 1 0;
  }

  .import-preview-actions .btn-primary {
    margin-left: auto;
  }

  .import-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .import-item-content,
  .import-item-body {
    flex-basis: calc(100% - 44px);
  }

  .import-item > .btn-text {
    margin-left: 44px;
  }

  .import-diary-fields {
    grid-template-columns: 1fr 1fr;
  }

  .import-diary-fields textarea {
    grid-column: 1 / -1;
  }
}

.admin-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #27231f;
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: var(--font-body);
  font-weight: var(--font-weight-semibold);
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

.color-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-swatch {
  min-width: 104px;
  min-height: 70px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow);
}

body.mobile-nav-open {
  overflow: hidden;
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 1080px) {
  .dashboard-overview-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: var(--topbar-h) auto 0 0;
    width: min(72vw, 260px);
    height: auto;
    transform: translateX(-106%);
    transition: transform 0.2s ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar-overlay {
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 25;
    background: rgba(25, 25, 25, 0.28);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .admin-menu-btn {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .topbar {
    min-height: var(--topbar-h);
    padding: 0 14px;
  }

  .breadcrumb {
    flex: 1 1 auto;
  }

  .topbar-user {
    gap: 6px;
    flex: 0 0 auto;
  }

  .topbar-user > span {
    display: none;
  }

  .topbar-user .btn-ghost,
  .topbar-user .btn-text {
    min-width: 0;
    width: auto;
    padding: 0 8px;
    white-space: nowrap;
  }

  .content {
    padding: 18px 14px 44px;
  }

  .panel {
    padding: 16px;
  }

  .section-page-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .save-bar--top {
    min-width: 0;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-header > .btn-primary,
  .panel-header > .btn-ghost,
  .panel-header > .panel-actions,
  .panel-header > .batch-actions,
  .filter-bar {
    width: 100%;
    justify-content: flex-start;
  }

  .dashboard-risk-panel .panel-header {
    flex-direction: row;
    align-items: flex-start;
  }

  .dashboard-risk-panel .panel-header > .btn-primary {
    flex: 0 0 auto;
    width: auto;
  }

  .form-grid .form-field:has(textarea) {
    grid-column: auto;
  }

  .save-bar {
    position: static;
    width: 100%;
    margin-top: 16px;
    justify-content: stretch;
  }

  .save-bar .btn-primary,
  .save-bar .btn-ghost {
    flex: 1 1 0;
    width: auto;
  }

  .preflight-row {
    grid-template-columns: auto minmax(82px, 0.7fr);
  }

  .preflight-row span:last-child {
    grid-column: 1 / -1;
  }

  .config-card-head {
    align-items: flex-start;
  }

  .config-card-head .toggle {
    flex: 0 0 auto;
  }
}

@media (max-width: 560px) {
  .login-card {
    padding: 24px;
  }

  .topbar {
    gap: 8px;
    padding: 0 10px;
  }

  .topbar-user .btn-ghost,
  .topbar-user .btn-text {
    padding: 0 7px;
  }

  .content {
    padding: 14px 10px 36px;
  }

  .stats-row,
  .form-grid,
  .ad-config-card .form-grid,
  .system-rule-grid,
  .plain-rule-grid,
  .blind-box-type-grid,
  .global-feature-rule-grid,
  .ad-page-card,
  .mini-program-form-grid,
  .copy-field-grid,
  .config-note-grid,
  .security-config-grid,
  .account-edit-grid {
    grid-template-columns: 1fr;
  }

  .copy-field-wide {
    grid-column: auto;
  }

  .config-card-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .config-card {
    gap: 12px;
  }

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

  .stats-row-compact .stat-card {
    min-height: 76px;
    padding: 10px 8px;
  }

  .btn-primary,
  .btn-outline,
  .btn-ghost {
    min-width: 0;
  }

  .modal {
    padding: 10px;
  }

  .modal-body {
    padding: 18px;
  }

  .quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quick-actions .btn-primary,
  .quick-actions .btn-ghost {
    width: 100%;
  }

  .panel:has(.mobile-card-table) {
    overflow-x: visible;
  }

  .mobile-card-table,
  .mobile-card-table tbody,
  .mobile-card-table tr,
  .mobile-card-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table {
    min-width: 0;
  }

  .pool-table.mobile-card-table td:nth-child(n) {
    width: 100%;
  }

  .mobile-card-table tr {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-l2);
  }

  .mobile-card-table tr + tr {
    margin-top: 10px;
  }

  .mobile-card-table td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .mobile-card-table td + td {
    margin-top: 8px;
  }

  .mobile-card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--font-meta);
    font-weight: var(--font-weight-semibold);
  }

  .mobile-card-table input:not([type="checkbox"]),
  .mobile-card-table select,
  .mobile-card-table textarea {
    width: 100%;
    min-width: 0;
  }

  .mobile-card-table td[data-label="操作"],
  .pool-table.mobile-card-table td:nth-child(10) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
  }

  .mobile-card-table td[data-label="操作"]::before,
  .pool-table.mobile-card-table td:nth-child(10)::before {
    flex: 0 0 100%;
  }

  .mobile-card-table td[data-label="操作"] .btn-text,
  .pool-table.mobile-card-table td:nth-child(10) .btn-text {
    min-height: 32px;
    padding: 0 12px;
    border-color: var(--line);
    background: var(--surface-l1);
  }
}

.share-settings-stack {
  display: grid;
  gap: 16px;
}

.share-settings-stack > .panel {
  margin-bottom: 0;
}

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

.share-library-grid > .panel {
  margin-bottom: 0;
}

.share-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.share-type-tab {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--font-body);
}

.share-type-tab.active {
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  font-weight: var(--font-weight-semibold);
}

.share-library-panel {
  display: grid;
  gap: 12px;
}

.share-library-panel > .panel-header {
  align-items: flex-start;
  margin-bottom: 0;
}

.share-library-count {
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-regular);
}

.share-title-pool {
  width: 100%;
  min-height: 250px;
  line-height: 1.7;
}

.share-cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 220px);
  gap: 12px;
}

.share-background-panel {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.share-background-panel > .panel-header {
  margin-bottom: 0;
}

.share-cover-item {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.share-cover-item img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 4;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-l2);
}

.share-cover-item .btn-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  line-height: 1;
}

.share-cover-empty {
  display: grid;
  aspect-ratio: 5 / 4;
  padding: 10px;
  place-items: center;
  color: var(--muted);
  font-size: var(--font-meta);
  text-align: center;
}

.share-preview-section {
  display: grid;
  gap: 12px;
}

.share-style-panel {
  display: grid;
  gap: 12px;
}

.share-style-panel > .panel-header {
  margin-bottom: 0;
}

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

.share-style-actions {
  flex-wrap: nowrap;
}

.share-template-dropdown {
  position: relative;
}

.share-template-dropdown summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--wechat-text);
  cursor: pointer;
  list-style: none;
  font-size: var(--font-control-title);
  font-weight: var(--font-weight-regular);
  white-space: nowrap;
}

.share-template-dropdown summary::-webkit-details-marker {
  display: none;
}

.share-template-dropdown summary::after {
  width: 0;
  height: 0;
  border-top: 5px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  content: '';
}

.share-template-dropdown[open] summary {
  border-color: var(--brand-primary);
}

.share-template-summary {
  color: var(--muted);
  font-size: var(--font-meta);
  font-weight: var(--font-weight-regular);
}

.share-template-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  display: grid;
  width: 178px;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(25, 25, 25, 0.12);
}

.share-template-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 4px;
  color: var(--wechat-text);
  cursor: pointer;
  font-size: var(--font-compact);
}

.share-template-option:hover {
  background: var(--surface-subtle);
}

.share-template-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-primary);
}

.share-style-section {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-l2);
  box-shadow: none;
}

.share-style-section h4 {
  margin: 0;
  color: var(--wechat-text);
  font-size: var(--font-compact);
  font-weight: var(--font-weight-semibold);
}

.share-style-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--font-meta);
}

.share-style-field input {
  width: 100%;
  min-width: 0;
}

.share-style-color {
  grid-template-columns: minmax(0, 1fr) 134px;
}

.share-hex-control {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.share-color-palette {
  position: relative;
}

.share-color-palette summary {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 4px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  list-style: none;
}

.share-color-palette summary::-webkit-details-marker {
  display: none;
}

.share-color-palette[open] summary {
  border-color: var(--brand-primary);
}

.share-color-swatch,
.share-color-option {
  background: var(--share-color-value);
}

.share-color-swatch {
  display: block;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(25, 25, 25, 0.18);
  border-radius: 2px;
}

.share-color-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(5, 26px);
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(25, 25, 25, 0.12);
}

.share-color-option {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(25, 25, 25, 0.18);
  border-radius: 3px;
}

.share-color-option.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-primary);
}

.share-style-color .share-hex-color {
  height: 32px;
  padding: 0 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .share-library-grid {
    grid-template-columns: 1fr;
  }

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

  .panel-header > .share-style-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .share-cover-grid {
    grid-template-columns: 1fr;
  }
}
