:root {
  --font-ui: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Source Serif 4", "Noto Serif SC", Georgia, serif;
  --sidebar-w: 320px;
  --warn: #b86a1c;
  --danger: #b63d3d;
  --panel: #ffffff;

  /* 默认：绛纱 wine —— 其余见 [data-admin-theme] */
  --ink: #221a1d;
  --muted: #6b5c62;
  --line: #ddd2d6;
  --paper: #f5f1f3;
  --sidebar: #1a1216;
  --sidebar-text: #d4c5cb;
  --sidebar-active: #c45a72;
  --accent: #9b3d52;
  --accent-soft: #f5e8ec;
  --ok: #9b3d52;
  --accent-rgb: 155, 61, 82;
  --active-rgb: 196, 90, 114;
  --sidebar-rgb: 26, 18, 22;
  --sidebar-text-rgb: 212, 197, 203;
  --login-0: #f3eef0;
  --login-1: #e7dce1;
  --login-2: #d4c5cb;
  --th-bg: #f3eef0;
  --row-hover: #f8f3f5;
  --badge-bg: #ebe4e7;
  --bar-track: #e7dce1;
  --soft-bg: #f8f3f5;
  --hover-border: #d4a8b4;
  --foot-link: #b8949e;
  --brand-fg: #f7f1f3;
  --sub-active-fg: #f5e8ec;
  --shadow: 0 1px 2px rgba(26, 18, 22, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: var(--accent);
  color: #fff;
  min-height: 38px;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
}
button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.55; cursor: wait; }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost:hover { background: var(--accent-soft); }
button.danger { background: var(--danger); }
button.sm { min-height: 32px; padding: 0.25rem 0.65rem; font-size: 0.85rem; }
button.sm.is-muted { opacity: 0.45; filter: grayscale(0.35); }

input, select, textarea {
  min-height: 38px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  width: 100%;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  accent-color: var(--accent);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(var(--accent-rgb), 0.25);
  border-color: var(--accent);
}
input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: 2px solid rgba(var(--accent-rgb), 0.35);
  outline-offset: 2px;
  border-color: transparent;
}

.hidden { display: none !important; }

/* —— Login —— */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(var(--accent-rgb), 0.16), transparent 55%),
    linear-gradient(160deg, var(--login-0) 0%, var(--login-1) 45%, var(--login-2) 100%);
}
.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(var(--sidebar-rgb), 0.1);
  padding: 1.5rem 1.5rem 1.35rem;
}
.login-brand {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.25rem;
}
.login-sub {
  margin: 0 0 0.95rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.login-form { display: grid; gap: 0.45rem; }
.login-form label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.login-form input {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
}
.login-form button { width: 100%; margin-top: 0.2rem; min-height: 36px; }
.login-status { min-height: 1.1rem; margin: 0.45rem 0 0; font-size: 0.9rem; color: var(--accent); }
.login-status.err { color: var(--danger); }
.login-hint { margin: 1rem 0 0; font-size: 0.8rem; color: var(--muted); }

/* —— Shell —— */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100%;
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  padding: 1.1rem 0.75rem 1rem;
}
.sidebar-brand {
  padding: 0.4rem 0.65rem 1.1rem;
  border-bottom: 1px solid rgba(var(--sidebar-text-rgb), 0.12);
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.sidebar-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--brand-fg);
  font-weight: 600;
}
.sidebar-brand span {
  font-size: 0.75rem;
  opacity: 0.7;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0.15rem;
}
.nav button {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 0.92rem;
}
.nav button:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav button.active {
  background: rgba(var(--active-rgb), 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--sidebar-active);
}
.nav-ico {
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
  font-size: 0.85rem;
}
.nav button.nav-section-start,
.nav-group.nav-section-start {
  position: relative;
  margin-top: 0.55rem;
}
.nav button.nav-section-start::before,
.nav-group.nav-section-start::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  top: -0.35rem;
  height: 1px;
  background: rgba(var(--sidebar-text-rgb), 0.22);
  pointer-events: none;
}
.nav-group { margin-top: 0.35rem; }
.nav-group-head {
  all: unset;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 0.92rem;
  font-weight: 600;
  box-sizing: border-box;
}
.nav-group-head:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
/* 可折叠标识：收起 ▸ / 展开 ▾ */
.nav-group-head::after {
  content: "▸";
  margin-left: auto;
  flex: none;
  width: 1.1rem;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.55;
  color: rgba(var(--sidebar-text-rgb), 0.95);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-group-head:hover::after {
  opacity: 0.9;
  color: #fff;
}
.nav-group.open .nav-group-head::after {
  content: "▾";
  opacity: 0.85;
}
.nav-group-head .nav-fold-hint {
  display: none;
}
.nav-sub {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem 0 0.35rem 1.55rem;
  border-left: 2px solid rgba(var(--active-rgb), 0.28);
  margin-left: 1.05rem;
  padding-left: 0.55rem;
}
.nav-group.open .nav-sub { display: flex; }
.nav-sub button {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  color: rgba(var(--sidebar-text-rgb), 0.88);
  font-size: 0.78rem;
  line-height: 1.35;
  background: rgba(255, 255, 255, 0.04);
}
.nav-sub button > span {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.nav-sub button small {
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}
.nav-sub button:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}
.nav-sub button.active {
  background: rgba(var(--active-rgb), 0.16);
  color: var(--sub-active-fg);
  box-shadow: inset 3px 0 0 rgba(var(--active-rgb), 0.75);
}

/* 原始数据：按表名英文前两字母着色（同前缀同色） */
#rawNavSub button {
  border-left: 3px solid rgba(255, 255, 255, 0.18);
  padding-left: calc(0.55rem - 1px);
}
#rawNavSub button[data-pfx] {
  border-left-color: var(--raw-pfx, rgba(255, 255, 255, 0.28));
  color: color-mix(in srgb, var(--raw-pfx, #ccc) 42%, rgba(var(--sidebar-text-rgb), 1));
}
#rawNavSub button[data-pfx]:hover {
  color: color-mix(in srgb, var(--raw-pfx, #ccc) 28%, #fff);
}
#rawNavSub button[data-pfx].active {
  border-left-color: var(--raw-pfx, rgba(var(--active-rgb), 0.75));
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--raw-pfx, #fff) 70%, rgba(var(--active-rgb), 1));
  color: var(--sub-active-fg);
}
#rawNavSub button > span.raw-en {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  word-break: break-all;
}
#rawNavSub button > span.raw-zh {
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
  opacity: 0.92;
}
#rawNavSub button > small {
  flex: 0 0 auto;
  margin-left: 0.35rem;
}
.row-actions { white-space: nowrap; display: flex; gap: 0.35rem; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--sidebar-rgb), 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 50;
}
.modal-card {
  width: min(640px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.1rem 1.1rem;
}
.modal-card--wide {
  width: min(920px, 100%);
}
.raw-row {
  cursor: pointer;
}
.raw-row:hover {
  background: color-mix(in srgb, var(--accent, #8b4557) 6%, transparent);
}
.modal-form textarea.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.modal-form {
  display: grid;
  gap: 0.4rem;
}
.modal-form label {
  display: grid;
  gap: 0.18rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.modal-form input,
.modal-form select,
.modal-form textarea {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
}
.modal-form label.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  min-height: 1.6rem;
}
.modal-form label.check input { width: auto; min-height: auto; }
.modal-form small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  margin: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.sidebar-foot {
  padding: 0.75rem 0.65rem 0;
  border-top: 1px solid rgba(var(--sidebar-text-rgb), 0.12);
  font-size: 0.8rem;
  flex-shrink: 0;
}
.sidebar-foot .user { color: var(--brand-fg); margin-bottom: 0.5rem; }
.sidebar-foot button {
  all: unset;
  cursor: pointer;
  color: var(--foot-link);
  font-size: 0.85rem;
}
.sidebar-foot button:hover { color: #fff; }

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}
.topbar .meta { color: var(--muted); font-size: 0.85rem; }
.content {
  padding: 1.25rem 1.5rem 2rem;
  flex: 1;
}
.panel { display: none; }
.panel.active { display: block; }

.page-desc {
  margin: -0.25rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem;
}
.stat.is-link {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.stat.is-link:hover,
.stat.is-link:focus-visible {
  border-color: var(--accent, #1d4ed8);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #1d4ed8) 18%, transparent);
  outline: none;
}
.stat .label { color: var(--muted); font-size: 0.8rem; }
.stat .value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  margin-top: 0.2rem;
  letter-spacing: 0.01em;
}
.stat .sub { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }

.cards-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.card h3 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 650;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.toolbar input, .toolbar select { width: auto; min-width: 10rem; flex: 1; }
.toolbar .grow { flex: 2; min-width: 14rem; }

.table-wrap { overflow: auto; border: 1px solid var(--line); background: #fff; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  background: var(--th-bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--row-hover); }

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--ink);
}
.badge.ok { background: var(--accent-soft); color: var(--ok); }
.badge.warn { background: #f8edd9; color: var(--warn); }
.badge.danger { background: #f6e4e4; color: var(--danger); }
.badge.muted { background: var(--badge-bg); color: var(--muted); }

.bars { display: grid; gap: 0.55rem; }
.bar-row { display: grid; grid-template-columns: 5.5rem 1fr 2.5rem; gap: 0.5rem; align-items: center; font-size: 0.85rem; }
.bar-track {
  height: 8px;
  background: var(--bar-track);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--sidebar-active));
  border-radius: 999px;
  min-width: 2px;
}
.bar-row .n { color: var(--muted); text-align: right; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
.quick-actions button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  text-align: left;
  font-weight: 550;
  padding: 0.7rem 0.85rem;
}
.quick-actions button:hover { background: var(--accent-soft); border-color: var(--hover-border); }
.quick-actions button small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.tpl-sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.85rem;
}
.tpl-sample-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 11rem;
  padding: 1rem 1.05rem;
  background: #fff;
  border: 1px solid var(--line);
}
.tpl-sample-card h3 {
  margin: 0.2rem 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 650;
}
.tpl-sample-card__code {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}
.tpl-sample-card__style {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.tpl-sample-card__desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.55;
}
.tpl-sample-card__actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.tpl-sample-card__actions .btn-link {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.85rem;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
}
.tpl-sample-card__actions .btn-link:hover {
  filter: brightness(1.05);
}

.tpl-sample-detail {
  display: grid;
  gap: 0.85rem;
}
.tpl-sample-detail__meta {
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
}
.tpl-sample-detail__meta h3 {
  margin: 0.15rem 0 0.4rem;
  font-size: 1.15rem;
}
.tpl-sample-url-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0.85rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
.tpl-sample-url {
  color: var(--accent);
  word-break: break-all;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tpl-sample-url:hover {
  filter: brightness(1.08);
}
.tpl-sample-frame {
  width: 100%;
  min-height: min(78vh, 920px);
  height: min(78vh, 920px);
  border: 1px solid var(--line);
  background: #fff;
}
.preset-thumb {
  width: 3.25rem;
  height: 2.15rem;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--line);
  display: block;
  background: var(--paper-2, #eee);
}
.preset-credit {
  margin-top: 0.25rem;
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--muted);
  max-width: 9rem;
}
.preset-credit a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 1px;
}
.tpl-palette-block {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.tpl-palette-label {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.tpl-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 5.75rem);
  gap: 0.45rem;
  justify-content: start;
}
.tpl-palette-swatch {
  all: unset;
  box-sizing: border-box;
  display: grid;
  gap: 0.35rem;
  width: 5.75rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  background: var(--panel, #fff);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tpl-palette-swatch:hover {
  border-color: var(--hover-border, var(--accent));
  background: var(--accent-soft, #f5f8f7);
}
.tpl-palette-swatch.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(30, 90, 110, 0.18);
}
.tpl-palette-swatch__chips {
  display: flex;
  gap: 0.2rem;
  height: 0.85rem;
}
.tpl-palette-swatch__chips span {
  flex: 1;
  border-radius: 2px;
  min-width: 0;
}
.tpl-palette-swatch__name {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}
.toolbar .ghost.sm,
.toolbar .btn-link.sm {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.toolbar .btn-link.sm {
  min-height: 2rem;
  padding: 0 0.85rem;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
}
.toolbar .btn-link.sm:hover {
  filter: brightness(1.05);
}
.nav-sub-row {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
}
.nav-sub-row > button {
  flex: 1;
  min-width: 0;
}
.nav-sub-ext {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  border-radius: 6px;
  color: rgba(var(--sidebar-text-rgb), 0.9);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
  font-size: 0.85rem;
}
.nav-sub-ext:hover {
  background: rgba(var(--active-rgb), 0.28);
  color: #fff;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
  max-width: 36rem;
}
.form-grid label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.field-with-action {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
}
.field-with-action input,
.field-with-action textarea {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
}
.field-with-action > button {
  flex: 0 0 auto;
  white-space: nowrap;
}
.field-with-action--top {
  align-items: flex-start;
}
.field-with-action--top > button {
  margin-top: 0.2rem;
}
.company-suggest-wrap #companySuggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  max-height: 240px;
  overflow: auto;
}
.company-suggest-wrap #companySuggest button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: none;
}
.company-suggest-wrap #companySuggest button:hover {
  background: #f1f5f9;
  filter: none;
}
.company-suggest-wrap #companySuggest button strong { color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  background: var(--sidebar);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  max-width: min(28rem, calc(100vw - 2rem));
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  font-size: 0.9rem;
}
.toast.err { background: var(--danger); }
.empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.detail-box {
  margin-top: 0.85rem;
  padding: 0.85rem;
  background: var(--soft-bg);
  border: 1px dashed var(--line);
  font-size: 0.88rem;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow: auto;
}

.llm-chat {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.llm-chat__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--soft-bg);
}
.llm-chat__head strong {
  font-size: 0.95rem;
}
.llm-chat__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
.llm-chat__model {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 14rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.llm-chat__model select {
  flex: 1;
  min-width: 12rem;
  width: auto;
}
.llm-chat__log {
  height: min(42vh, 28rem);
  overflow: auto;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.03), transparent 8rem),
    var(--paper);
}
.llm-chat__empty {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  margin: 3rem 1rem;
}
.llm-chat__msg {
  max-width: min(42rem, 92%);
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.55;
}
.llm-chat__msg--user {
  margin-left: auto;
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.25);
}
.llm-chat__msg--assistant {
  margin-right: auto;
}
.llm-chat__msg--error {
  margin-right: auto;
  border-color: rgba(182, 61, 61, 0.35);
  background: #fdf4f4;
  color: var(--danger);
}
.llm-chat__role {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.llm-chat__compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: end;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.llm-chat__compose textarea {
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
  max-height: 12rem;
}
@media (max-width: 720px) {
  .llm-chat__compose {
    grid-template-columns: 1fr;
  }
}

.pager {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
  }
  .sidebar-brand { border: 0; margin: 0; padding: 0.25rem 0.5rem; flex: 1; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .sidebar-foot { border: 0; padding: 0.25rem 0.5rem; margin-left: auto; }
}

/* AI 建站进度 */
.onboard-progress {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: var(--soft-bg);
}
.onboard-progress__head {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.55rem;
  font-size: 0.9rem;
}
.onboard-progress__head strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--accent);
}
.onboard-progress__head span {
  color: var(--muted);
  text-align: right;
  flex: 1;
}
.onboard-progress__track {
  height: 8px;
  background: var(--bar-track);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.85rem;
}
.onboard-progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--sidebar-active));
  border-radius: 999px;
  transition: width 0.35s ease;
}
.onboard-captcha-banner {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--soft-bg));
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  align-items: baseline;
}
.onboard-captcha-banner.hidden { display: none; }
.onboard-captcha-banner.is-active {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.onboard-captcha-banner strong {
  color: var(--accent);
  font-size: 0.95rem;
}
.onboard-captcha-banner span {
  flex: 1 1 14rem;
  color: var(--ink);
  font-size: 0.88rem;
}
.onboard-progress.is-captcha .onboard-progress__bar {
  background: linear-gradient(90deg, #c27a2c, var(--accent));
  animation: onboard-captcha-pulse 1.4s ease-in-out infinite;
}
.onboard-steps .step-captcha .step-mark {
  background: #c27a2c;
  box-shadow: 0 0 0 3px color-mix(in srgb, #c27a2c 25%, transparent);
}
@keyframes onboard-captcha-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.onboard-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.86rem;
}
.onboard-steps li {
  display: grid;
  grid-template-columns: 1rem 1fr;
  gap: 0.55rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--line);
  color: var(--ink);
}
.onboard-steps li:last-child { border-bottom: 0; }
.onboard-steps .step-mark {
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.4rem;
  border-radius: 50%;
  background: var(--login-2);
}
.onboard-steps .step-running .step-mark {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}
.onboard-steps .step-done .step-mark { background: var(--ok); }
.onboard-steps .step-failed {
  color: var(--danger);
}
.onboard-steps .step-failed .step-mark { background: var(--danger); }

.onboard-findings {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}
.onboard-findings h4 {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 650;
}
.onboard-findings__list {
  max-height: none;
  overflow: visible;
  display: grid;
  gap: 0.55rem;
}
.onboard-findings__list--crawl {
  max-height: 12rem;
  overflow: auto;
}
.finding-item {
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
}
.finding-item header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
}
.finding-item header b {
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.finding-item header span { color: var(--ink); font-weight: 550; }
.finding-item header a { margin-left: auto; font-size: 0.75rem; }
.finding-item header small {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.finding-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}
.finding-llm--ok {
  border-left: 3px solid #2f9e6e;
}
.finding-llm--fail {
  border-left: 3px solid var(--danger, #c0392b);
}
.llm-tabs {
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}
.llm-tabs__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line);
  background: #f7f4f5;
}
.llm-tabs__tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 550;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  border-radius: 4px;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.llm-tabs__tab:hover {
  background: #efe8eb;
}
.llm-tabs__tab.is-active {
  background: #fff;
  border-color: var(--line);
  color: var(--accent);
  box-shadow: 0 1px 0 #fff;
}
.llm-tabs__tab--fail {
  color: var(--danger, #c0392b);
}
.llm-tabs__panel {
  display: none;
  padding: 0.75rem 0.85rem 1rem;
}
.llm-tabs__panel.is-active {
  display: block;
}
.llm-tabs__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: baseline;
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
}
.llm-tabs__meta strong {
  font-weight: 650;
}
.llm-tabs__meta small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.llm-tabs__error {
  margin: 0 0 0.75rem;
  color: var(--danger, #c0392b);
  font-size: 0.8rem;
}
.llm-call-block {
  margin-top: 0.65rem;
}
.llm-call-block label {
  display: block;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 0.3rem;
  letter-spacing: 0.02em;
}
.llm-call-block--reply label {
  color: var(--accent);
}
.llm-call-block pre {
  margin: 0;
  min-height: 10rem;
  max-height: 28rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  line-height: 1.5;
  background: #141414;
  color: #ececec;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  border: 1px solid #2a2a2a;
}
.llm-call-block--reply pre {
  min-height: 14rem;
  max-height: 36rem;
  background: #0f1a14;
  border-color: #1e3a2a;
}
.finding-error {
  margin: 0.35rem 0 0;
  color: var(--danger, #c0392b);
  font-size: 0.75rem;
}
.finding-item--error {
  border-color: #f0c2c2;
  background: #fff8f8;
}
.finding-item--error header span {
  color: var(--danger, #c0392b);
}
.onboard-progress.is-failed .onboard-progress__bar {
  background: var(--danger, #c0392b);
}

/* 批量建站 */
.batch-onboard-form {
  max-width: 44rem;
}
.batch-onboard-form textarea {
  width: 100%;
  min-height: 10rem;
  resize: vertical;
  font: inherit;
  line-height: 1.5;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.batch-onboard-opts {
  align-items: flex-end;
  gap: 0.75rem 1rem;
}
.batch-onboard-opt {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 10rem;
}
.batch-onboard-opt select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.batch-onboard-palette-hint {
  font-size: 0.85rem;
  padding-bottom: 0.35rem;
}
.batch-onboard-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.45rem;
  max-height: 22rem;
  overflow: auto;
}
.batch-onboard-item {
  display: grid;
  grid-template-columns: 1.5rem 1fr auto;
  gap: 0.55rem 0.75rem;
  align-items: start;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.86rem;
}
.batch-onboard-item__idx {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}
.batch-onboard-item__body strong {
  display: block;
  font-weight: 600;
}
.batch-onboard-item__meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  word-break: break-word;
}
.batch-onboard-item.is-running {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: var(--accent-soft);
}
.batch-onboard-item.is-ok {
  border-left: 3px solid var(--ok);
}
.batch-onboard-item.is-fail,
.batch-onboard-item.is-skip {
  border-left: 3px solid var(--danger, #c0392b);
}
.batch-onboard-item.is-skip {
  border-left-color: #c4a35a;
}
.batch-onboard-item.is-pending {
  opacity: 0.78;
}

/* —— 10 套后台配色（系统配置可选） —— */
[data-admin-theme="wine"] {
  --ink: #221a1d; --muted: #6b5c62; --line: #ddd2d6; --paper: #f5f1f3;
  --sidebar: #1a1216; --sidebar-text: #d4c5cb; --sidebar-active: #c45a72;
  --accent: #9b3d52; --accent-soft: #f5e8ec; --ok: #9b3d52;
  --accent-rgb: 155, 61, 82; --active-rgb: 196, 90, 114; --sidebar-rgb: 26, 18, 22;
  --sidebar-text-rgb: 212, 197, 203;
  --login-0: #f3eef0; --login-1: #e7dce1; --login-2: #d4c5cb;
  --th-bg: #f3eef0; --row-hover: #f8f3f5; --badge-bg: #ebe4e7; --bar-track: #e7dce1;
  --soft-bg: #f8f3f5; --hover-border: #d4a8b4; --foot-link: #b8949e;
  --brand-fg: #f7f1f3; --sub-active-fg: #f5e8ec;
  --shadow: 0 1px 2px rgba(26, 18, 22, 0.06);
}
[data-admin-theme="teal"] {
  --ink: #1a2421; --muted: #5a6b66; --line: #d4ddd9; --paper: #f2f5f3;
  --sidebar: #12201c; --sidebar-text: #c5d5cf; --sidebar-active: #2f9a82;
  --accent: #0f6b5c; --accent-soft: #e6f3f0; --ok: #0f6b5c;
  --accent-rgb: 15, 107, 92; --active-rgb: 47, 154, 130; --sidebar-rgb: 18, 32, 28;
  --sidebar-text-rgb: 197, 213, 207;
  --login-0: #eef3f1; --login-1: #dde7e3; --login-2: #c5d5cf;
  --th-bg: #eef3f1; --row-hover: #f4f8f6; --badge-bg: #e4ebe8; --bar-track: #dde7e3;
  --soft-bg: #f4f8f6; --hover-border: #a8cfc3; --foot-link: #8fb8a8;
  --brand-fg: #f2f7f5; --sub-active-fg: #e6f3f0;
  --shadow: 0 1px 2px rgba(18, 32, 28, 0.06);
}
[data-admin-theme="ocean"] {
  --ink: #1a222c; --muted: #5c6b7a; --line: #d5dde8; --paper: #f2f5f9;
  --sidebar: #141c28; --sidebar-text: #c5d0dc; --sidebar-active: #3d8fd9;
  --accent: #1e6fbf; --accent-soft: #e8f1fa; --ok: #1e6fbf;
  --accent-rgb: 30, 111, 191; --active-rgb: 61, 143, 217; --sidebar-rgb: 20, 28, 40;
  --sidebar-text-rgb: 197, 208, 220;
  --login-0: #eef2f7; --login-1: #dde5ef; --login-2: #c5d2e0;
  --th-bg: #eef2f7; --row-hover: #f6f8fb; --badge-bg: #e6ebf2; --bar-track: #e2e8f0;
  --soft-bg: #f6f8fb; --hover-border: #b5cce3; --foot-link: #8fadc4;
  --brand-fg: #f2f6fa; --sub-active-fg: #e8f2fa;
  --shadow: 0 1px 2px rgba(20, 28, 40, 0.06);
}
[data-admin-theme="dusk"] {
  --ink: #1a1e2a; --muted: #5c6478; --line: #d4d8e4; --paper: #f1f3f8;
  --sidebar: #12162a; --sidebar-text: #c4cadc; --sidebar-active: #6b7fd7;
  --accent: #3d4f9c; --accent-soft: #e8ebf6; --ok: #3d4f9c;
  --accent-rgb: 61, 79, 156; --active-rgb: 107, 127, 215; --sidebar-rgb: 18, 22, 42;
  --sidebar-text-rgb: 196, 202, 220;
  --login-0: #eef0f7; --login-1: #dde1ef; --login-2: #c4cadc;
  --th-bg: #eef0f7; --row-hover: #f5f6fb; --badge-bg: #e4e7f0; --bar-track: #dde1ef;
  --soft-bg: #f5f6fb; --hover-border: #aeb8de; --foot-link: #8f9ac4;
  --brand-fg: #f2f4fa; --sub-active-fg: #e8ebf6;
  --shadow: 0 1px 2px rgba(18, 22, 42, 0.06);
}
[data-admin-theme="forest"] {
  --ink: #1a2218; --muted: #5a6756; --line: #d5ddd2; --paper: #f2f5f0;
  --sidebar: #141c12; --sidebar-text: #c8d4c2; --sidebar-active: #5a9a4a;
  --accent: #3d6b32; --accent-soft: #eaf3e6; --ok: #3d6b32;
  --accent-rgb: 61, 107, 50; --active-rgb: 90, 154, 74; --sidebar-rgb: 20, 28, 18;
  --sidebar-text-rgb: 200, 212, 194;
  --login-0: #eef3eb; --login-1: #dde7d8; --login-2: #c8d4c2;
  --th-bg: #eef3eb; --row-hover: #f5f8f2; --badge-bg: #e4ebe0; --bar-track: #dde7d8;
  --soft-bg: #f5f8f2; --hover-border: #a8c9a0; --foot-link: #8fb888;
  --brand-fg: #f2f7f0; --sub-active-fg: #eaf3e6;
  --shadow: 0 1px 2px rgba(20, 28, 18, 0.06);
}
[data-admin-theme="ink"] {
  --ink: #1c1e20; --muted: #5e646b; --line: #d6d9dd; --paper: #f3f4f5;
  --sidebar: #151719; --sidebar-text: #c8ced4; --sidebar-active: #7a8490;
  --accent: #3d4550; --accent-soft: #eceef0; --ok: #3d4550;
  --accent-rgb: 61, 69, 80; --active-rgb: 122, 132, 144; --sidebar-rgb: 21, 23, 25;
  --sidebar-text-rgb: 200, 206, 212;
  --login-0: #eef0f2; --login-1: #dfe2e6; --login-2: #c8ced4;
  --th-bg: #eef0f2; --row-hover: #f6f7f8; --badge-bg: #e4e7ea; --bar-track: #dfe2e6;
  --soft-bg: #f6f7f8; --hover-border: #b0b7c0; --foot-link: #8f97a0;
  --brand-fg: #f2f4f5; --sub-active-fg: #eceef0;
  --shadow: 0 1px 2px rgba(21, 23, 25, 0.06);
}
[data-admin-theme="copper"] {
  --ink: #241c16; --muted: #6b5e52; --line: #ddd4ca; --paper: #f4f1ed;
  --sidebar: #1a1410; --sidebar-text: #d4c8ba; --sidebar-active: #c4893f;
  --accent: #8a5a28; --accent-soft: #f3ebe0; --ok: #8a5a28;
  --accent-rgb: 138, 90, 40; --active-rgb: 196, 137, 63; --sidebar-rgb: 26, 20, 16;
  --sidebar-text-rgb: 212, 200, 186;
  --login-0: #f2ede6; --login-1: #e5dbcf; --login-2: #d4c8ba;
  --th-bg: #f2ede6; --row-hover: #f8f4ef; --badge-bg: #ebe4db; --bar-track: #e5dbcf;
  --soft-bg: #f8f4ef; --hover-border: #d4b48a; --foot-link: #b89a72;
  --brand-fg: #f7f2ec; --sub-active-fg: #f3ebe0;
  --shadow: 0 1px 2px rgba(26, 20, 16, 0.06);
}
[data-admin-theme="slate"] {
  --ink: #1a2224; --muted: #5a686c; --line: #d2dcde; --paper: #f1f4f5;
  --sidebar: #12191b; --sidebar-text: #c2d0d4; --sidebar-active: #4a9aaa;
  --accent: #2a6f7c; --accent-soft: #e5f1f3; --ok: #2a6f7c;
  --accent-rgb: 42, 111, 124; --active-rgb: 74, 154, 170; --sidebar-rgb: 18, 25, 27;
  --sidebar-text-rgb: 194, 208, 212;
  --login-0: #eaf1f2; --login-1: #d7e3e5; --login-2: #c2d0d4;
  --th-bg: #eaf1f2; --row-hover: #f3f7f8; --badge-bg: #e0e8ea; --bar-track: #d7e3e5;
  --soft-bg: #f3f7f8; --hover-border: #9ec5cd; --foot-link: #7a9aa3;
  --brand-fg: #f0f5f6; --sub-active-fg: #e5f1f3;
  --shadow: 0 1px 2px rgba(18, 25, 27, 0.06);
}
[data-admin-theme="clay"] {
  --ink: #241a18; --muted: #6b5a56; --line: #ddd4d1; --paper: #f4f0ee;
  --sidebar: #1a1312; --sidebar-text: #d4c6c2; --sidebar-active: #b87a5c;
  --accent: #8a4f3a; --accent-soft: #f3e9e4; --ok: #8a4f3a;
  --accent-rgb: 138, 79, 58; --active-rgb: 184, 122, 92; --sidebar-rgb: 26, 19, 18;
  --sidebar-text-rgb: 212, 198, 194;
  --login-0: #f2ebe8; --login-1: #e5d9d4; --login-2: #d4c6c2;
  --th-bg: #f2ebe8; --row-hover: #f8f3f1; --badge-bg: #ebe3df; --bar-track: #e5d9d4;
  --soft-bg: #f8f3f1; --hover-border: #d4b0a0; --foot-link: #b89080;
  --brand-fg: #f7f1ef; --sub-active-fg: #f3e9e4;
  --shadow: 0 1px 2px rgba(26, 19, 18, 0.06);
}
[data-admin-theme="rosewood"] {
  --ink: #221816; --muted: #6b5654; --line: #ddd2d0; --paper: #f4f0ef;
  --sidebar: #181210; --sidebar-text: #d4c4c1; --sidebar-active: #a85a58;
  --accent: #7a3836; --accent-soft: #f3e7e6; --ok: #7a3836;
  --accent-rgb: 122, 56, 54; --active-rgb: 168, 90, 88; --sidebar-rgb: 24, 18, 16;
  --sidebar-text-rgb: 212, 196, 193;
  --login-0: #f2eaea; --login-1: #e5d8d7; --login-2: #d4c4c1;
  --th-bg: #f2eaea; --row-hover: #f8f2f1; --badge-bg: #ebe2e1; --bar-track: #e5d8d7;
  --soft-bg: #f8f2f1; --hover-border: #d4a8a6; --foot-link: #b88886;
  --brand-fg: #f7f0ef; --sub-active-fg: #f3e7e6;
  --shadow: 0 1px 2px rgba(24, 18, 16, 0.06);
}

/* 老板后台专用：纯蓝，与运营 wine 绛纱区分 */
[data-admin-theme="boss"] {
  --ink: #152033; --muted: #5a6b82; --line: #d2dcea; --paper: #f1f5fb;
  --sidebar: #10182a; --sidebar-text: #c5d2e6; --sidebar-active: #4a90e2;
  --accent: #1e6fd9; --accent-soft: #e8f1fc; --ok: #1e6fd9;
  --accent-rgb: 30, 111, 217; --active-rgb: 74, 144, 226; --sidebar-rgb: 16, 24, 42;
  --sidebar-text-rgb: 197, 210, 230;
  --login-0: #eaf1fb; --login-1: #d8e4f5; --login-2: #c4d4ec;
  --th-bg: #eaf1fb; --row-hover: #f5f8fd; --badge-bg: #e0e8f4; --bar-track: #d8e4f5;
  --soft-bg: #f5f8fd; --hover-border: #a8c4eb; --foot-link: #7a9fd0;
  --brand-fg: #f0f5fc; --sub-active-fg: #e8f1fc;
  --shadow: 0 1px 2px rgba(16, 24, 42, 0.06);
}

/* 主题选择器 */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.65rem;
}
.theme-swatch {
  all: unset;
  box-sizing: border-box;
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--panel);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.theme-swatch:hover { border-color: var(--hover-border); background: var(--accent-soft); }
.theme-swatch.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.22);
}
.theme-swatch__chips {
  display: flex;
  gap: 0.25rem;
  height: 1.15rem;
}
.theme-swatch__chips span {
  flex: 1;
  border-radius: 3px;
  min-width: 0;
}
.theme-swatch__name {
  font-size: 0.88rem;
  font-weight: 650;
}
.theme-swatch__id {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Prompt 提示词面板 */
.prompt-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  min-height: 28rem;
}
.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: calc(100vh - 12rem);
  overflow: auto;
  padding-right: 0.25rem;
}
.prompt-list__item {
  all: unset;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid transparent;
  box-sizing: border-box;
}
.prompt-list__item strong {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text, #1a1a1a);
}
.prompt-list__item span {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.prompt-list__item:hover {
  background: rgba(0, 0, 0, 0.06);
}
.prompt-list__item.active {
  background: color-mix(in srgb, var(--accent, #2a6) 12%, #fff);
  border-color: color-mix(in srgb, var(--accent, #2a6) 35%, transparent);
}
.prompt-detail {
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #fafafa;
  padding: 1rem 1.1rem;
}
.prompt-detail__head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.prompt-detail__head .muted {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  word-break: break-all;
}
.prompt-detail__body {
  margin: 0;
  padding: 0.85rem 1rem;
  max-height: calc(100vh - 16rem);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  background: #111;
  color: #e8e8e8;
  border-radius: 6px;
}
@media (max-width: 900px) {
  .prompt-layout {
    grid-template-columns: 1fr;
  }
  .prompt-list {
    max-height: 12rem;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* —— Build-site layout/palette modal —— */
.build-site-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0.65rem;
}
.build-site-modal.hidden { display: none !important; }
.build-site-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 28, 0.5);
}
.build-site-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.35rem 1rem;
  border-radius: 10px;
}
.build-site-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}
.build-site-modal__head h3 { font-size: 1.25rem; }
.build-site-modal__close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin: -0.15rem -0.25rem 0 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #6b7280);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.build-site-modal__close:hover {
  background: var(--surface-2, #f3f4f6);
  color: var(--ink, #111827);
}
.build-site-modal__body {
  display: grid;
  grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}
.build-site-modal__controls {
  min-width: 0;
  overflow: auto;
  padding-right: 0.25rem;
}
.build-site-modal__preview {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.build-site-modal__block { margin-top: 1rem; }
.build-site-modal__panel > .row { flex-shrink: 0; }

/* —— Preset company picker modal —— */
.preset-pick-panel {
  max-width: min(52rem, 100%);
  max-height: min(40rem, calc(100vh - 1.3rem));
  height: auto;
  margin: auto;
  display: flex;
  flex-direction: column;
}
.preset-pick-table {
  flex: 1;
  min-height: 12rem;
  max-height: min(22rem, 50vh);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.preset-pick-table table {
  width: 100%;
}
.preset-pick-table tbody tr {
  cursor: pointer;
}
.preset-pick-table tbody tr:hover {
  background: var(--surface-2, #f3f4f6);
}
.preset-pick-table tbody tr.is-selected {
  background: color-mix(in srgb, var(--accent, #2f6b4f) 12%, #fff);
}
.preset-pick-table .pick-cell {
  width: 2.2rem;
  text-align: center;
}
.preset-pick-table .yn-yes { color: var(--accent, #2f6b4f); }
.preset-pick-table .yn-no { color: var(--muted); }

.locale-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.locale-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line, #d8dde3);
  border-radius: 8px;
  background: var(--paper, #fff);
  cursor: pointer;
  font-size: 0.86rem;
  line-height: 1.25;
  user-select: none;
}
.locale-check input { margin-top: 0.15rem; }
.locale-check span { display: flex; flex-direction: column; gap: 0.1rem; }
.locale-check small {
  font-size: 0.72rem;
  color: var(--ink-soft, #6b7280);
  font-weight: 400;
}
.locale-check.is-on {
  border-color: var(--accent, #1f6b4a);
  background: color-mix(in srgb, var(--accent, #1f6b4a) 10%, #fff);
}
.locale-check:has(input:disabled) {
  opacity: 0.85;
  cursor: default;
}
.build-site-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}
.build-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.65rem;
  max-width: 28rem;
}
.build-layout-card {
  text-align: left;
  border: 1px solid var(--line, #ddd);
  background: var(--panel, #fff);
  color: var(--ink, #221a1d);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  font-weight: 500;
  min-height: 0;
  filter: none;
}
.build-layout-card:hover {
  filter: none;
  background: var(--accent-soft, #f5f8f7);
  border-color: var(--hover-border, var(--accent));
}
.build-layout-card strong {
  display: block;
  font-size: 1rem;
  color: var(--ink, #221a1d);
  font-weight: 700;
}
.build-layout-card small {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted, #6b5c62);
  line-height: 1.4;
  font-weight: 400;
}
.build-layout-card.is-active {
  border-color: var(--accent, #0d5c4c);
  box-shadow: inset 0 0 0 1px var(--accent, #0d5c4c);
  background: var(--accent-soft, #f5f8f7);
  color: var(--ink, #221a1d);
}
.build-layout-card.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}
.build-layout-card.is-locked::after {
  content: "即将开放";
  position: absolute;
  top: 0.4rem;
  right: 0.45rem;
  font-size: 0.68rem;
  color: var(--muted, #888);
  background: color-mix(in srgb, var(--panel, #fff) 82%, #ccc);
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}
.locale-check.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.locale-check.is-locked small {
  color: var(--muted, #888);
}
.build-site-modal .tpl-palette-grid {
  grid-template-columns: repeat(auto-fill, 6.25rem);
  gap: 0.55rem;
  max-width: none;
}
.build-site-modal .build-layout-grid {
  max-width: none;
}
.build-site-modal .tpl-palette-swatch {
  width: 6.25rem;
  padding: 0.55rem 0.55rem 0.5rem;
}
.build-site-modal .tpl-palette-swatch__chips {
  height: 1.15rem;
}
.build-site-modal .tpl-palette-swatch__name {
  font-size: 0.82rem;
}
@media (max-width: 960px) {
  .build-site-modal {
    padding: 0.4rem;
  }
  .build-site-modal__body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .build-site-modal__preview {
    min-height: 22rem;
  }
  .build-site-frame {
    min-height: 20rem;
  }
}

/* Admin visual editor (portal-parity) */
#panel-visual.panel.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 7rem);
}
.boss-visual-frame-wrap {
  flex: 1;
  min-height: 60vh;
  border: 1px solid var(--line, #e5dfe2);
  background: #fff;
  overflow: hidden;
  margin-top: 0.5rem;
}
#visual-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 12rem);
  min-height: 480px;
  border: 0;
  background: #fff;
}
.boss-status {
  min-height: 1.2rem;
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: var(--muted, #6b5c62);
  white-space: pre-wrap;
}
.boss-status.err { color: var(--danger, #b63d3d); }
.boss-status.ok { color: var(--ok, #1f7a4c); }
.nav .hidden { display: none !important; }
