:root {
  --bg: #f5f6fc;
  --panel: #ffffff;
  --panel-2: #f8f9fe;
  --border: #e9ebf6;
  --border-strong: #dfe3f2;
  --text: #1d2538;
  --muted: #6b7280;
  --accent: #6157f6;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(97, 87, 246, 0.08);
  --accent-soft-2: #efedff;
  --grad: linear-gradient(135deg, #6458f7 0%, #8b5cf6 100%);
  --success: #0f9d76;
  --danger: #e5484d;
  --warning: #c26a00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29, 37, 56, .04);
  --shadow-pop: 0 18px 40px rgba(37, 33, 90, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px; background: #f0f1fa; padding: 1px 5px; border-radius: 5px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* —— 外壳 —— */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.globalbar {
  height: 58px; flex: 0 0 58px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px 0 16px;
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 18;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 14px rgba(100, 88, 247, .28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; font-weight: 700; letter-spacing: .3px; }
.brand-text small { font-size: 10.5px; color: var(--muted); }

.globalbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.menu-wrap { position: relative; }
.ws-switch {
  display: flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--border-strong);
  padding: 5px 10px; border-radius: 999px; cursor: pointer; color: var(--text);
}
.ws-switch:hover { border-color: var(--accent); }
.ws-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#ws-name { font-size: 12.5px; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-chip { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft-2); color: var(--accent); font-weight: 600; }

.user {
  display: flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--border-strong);
  padding: 3px 9px 3px 3px; border-radius: 999px; cursor: pointer; color: var(--text);
}
.user:hover { border-color: var(--accent); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.user-name { font-size: 12.5px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  min-width: 224px; padding: 6px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-pop);
}
.menu[hidden] { display: none; }
.menu-label { font-size: 11px; color: var(--muted); padding: 6px 10px 4px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 12.5px;
  text-decoration: none; font: inherit; }
.menu-item:hover { background: #f6f5ff; color: var(--accent); }
.menu-item.danger:hover { background: rgba(229, 72, 77, .07); color: var(--danger); }
.menu-item .ico { width: 15px; height: 15px; }
.ws-item { justify-content: space-between; }
.ws-item .ws-item-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ws-item .ws-item-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-item.active { background: var(--accent-soft-2); color: var(--accent); }
.ws-item small { color: var(--muted); font-size: 10px; }

.shell { display: flex; flex: 1; min-height: 0; align-items: flex-start; }

.sidebar {
  width: 216px; flex: 0 0 216px;
  padding: 14px 12px 16px;
  background: #fff; border-right: 1px solid var(--border);
  position: sticky; top: 58px; height: calc(100vh - 58px);
  display: flex; flex-direction: column; overflow-y: auto;
}
.nav-label { font-size: 10.5px; color: #9aa1b1; letter-spacing: .08em; padding: 10px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: transparent; color: #4d566b;
  padding: 8px 10px; border-radius: 9px; text-align: left; cursor: pointer;
  font-size: 13px; margin-bottom: 2px;
}
.nav-item .ico { color: #8b93a7; }
.nav-item span { flex: 1; }
.nav-item:hover { background: #f7f7fd; color: var(--text); }
.nav-item.active { background: var(--accent-soft-2); color: var(--accent); font-weight: 600; }
.nav-item.active .ico { color: var(--accent); }
.nav-count { font-style: normal; font-size: 10.5px; color: var(--muted); background: #f1f2f8; border-radius: 999px; padding: 0 6px; }
.nav-count:empty { display: none; }
.nav-count.warn { background: rgba(229, 72, 77, .1); color: var(--danger); }

.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.usage-mini { margin-bottom: 10px; }
.usage-mini-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.usage-mini-head b { color: var(--text); font-weight: 600; }
.bar { height: 6px; border-radius: 999px; background: #e6e8f5; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width .3s ease; }

.main { flex: 1; min-width: 0; padding: 22px 28px 64px; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.pagehead h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.pagehead p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.pagehead-actions { display: flex; gap: 8px; align-items: center; }
.pagehead-actions .ico { margin-right: 4px; }

.view { display: none; }
.view.active { display: block; }

/* —— 通用组件 —— */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 25px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.stat-value.warn { color: var(--warning); }
.stat-value.ok { color: var(--success); }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow); }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-head .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border-strong); background: #fff; color: #3b4356;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: #fbfaff; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 14px rgba(100, 88, 247, .24); }
.btn.primary:hover { color: #fff; filter: brightness(1.04); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }
.btn.ghost { background: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.input {
  background: #fff; border: 1px solid var(--border-strong); color: var(--text);
  padding: 6px 10px; border-radius: 8px; outline: none; min-height: 32px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.small { width: 128px; }
.input.cell { width: 100%; padding: 4px 7px; background: transparent; border-color: transparent; min-height: 26px; }
.input.cell:focus { background: #fff; border-color: var(--accent); }

.hint { color: var(--muted); padding: 10px 18px; background: #fbfaff; border-bottom: 1px solid var(--border); font-size: 12px; line-height: 1.7; }
.muted { color: var(--muted); }

.flow { display: flex; align-items: stretch; gap: 10px; padding: 18px; }
.flow-node { flex: 1; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 15px 16px; }
.flow-index { color: var(--accent); font-size: 11px; letter-spacing: .12em; font-weight: 600; }
.flow-node strong { display: block; margin-top: 4px; font-size: 13.5px; }
.flow-node p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.flow-arrow { display: grid; place-items: center; color: #c3c8d8; }

.batch-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 18px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.batch-bar label { display: flex; align-items: center; gap: 6px; }
.batch-bar span { color: var(--muted); }

.table-wrap { overflow: auto; max-height: 68vh; }
.table { width: 100%; border-collapse: collapse; min-width: 1040px; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: #8a92a6; font-weight: 600; font-size: 11.5px; position: sticky; top: 0; background: #f9f9fe; z-index: 1; }
.table tr:hover td { background: #fbfbff; }
.table tbody tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--border); color: var(--muted); background: #fbfbfe; }
.badge.on { color: var(--success); border-color: rgba(15, 157, 118, .28); background: rgba(15, 157, 118, .08); }
.badge.off { color: var(--danger); border-color: rgba(229, 72, 77, .28); background: rgba(229, 72, 77, .07); }
.badge.wait { color: var(--warning); border-color: rgba(194, 106, 0, .28); background: rgba(194, 106, 0, .07); }
.badge.run { color: var(--accent); border-color: rgba(97, 87, 246, .28); background: var(--accent-soft); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.card h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.card-actions { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }

.list { padding: 6px 18px 16px; }
.list-more { padding-top: 12px; text-align: center; }
.list-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.list-item:last-child { border-bottom: 0; }
.list-title { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.list-title strong { font-weight: 600; }
.list-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.log { background: #f8f9fe; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 8px; max-height: 160px; overflow: auto; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: #4b5670; }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; padding: 18px; }
.image-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.image-item img { width: 100%; display: block; aspect-ratio: 1; object-fit: contain; background: #fff; }
.image-item div { padding: 6px 8px; font-size: 11px; color: var(--muted); word-break: break-all; }

/* —— 抽屉 —— */
.drawer { position: fixed; top: 0; right: -560px; width: 540px; max-width: 96vw; height: 100vh; background: var(--panel); border-left: 1px solid var(--border); z-index: 40; transition: right .2s ease; display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(37, 33, 90, .10); }
.drawer.open { right: 0; }
.drawer.wide { width: 720px; }
.drawer.wide:not(.open) { right: -720px; }
.drawer-head { padding: 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.drawer-body { padding: 18px; overflow: auto; flex: 1; }
.field { margin-bottom: 14px; }
.field label { display: block; color: var(--muted); margin-bottom: 6px; }
.field textarea { width: 100%; min-height: 170px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; resize: vertical; }
.field .input { width: 100%; }
.field-tip { color: var(--muted); font-size: 11px; margin-top: 6px; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.spec-grid small { display: block; color: var(--muted); margin-bottom: 4px; }
.spec-grid .input { width: 100%; }
.spec-grid .input::-webkit-outer-spin-button, .spec-grid .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.editor-rows { display: grid; gap: 8px; }
.editor-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.editor-row .cellwrap { flex: 0 0 auto; }
.editor-row .cellwrap.grow { flex: 1 1 130px; min-width: 110px; }
.editor-row .input.small { width: 100%; min-width: 74px; }
.editor-row .is-hidden { display: none; }
.advanced { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 16px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.advanced textarea { width: 100%; min-height: 180px; margin-top: 10px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.advanced .btn { margin-top: 8px; }
.drawer-actions { display: flex; gap: 8px; margin-top: 20px; }
.drawer.wide .drawer-body { display: flex; flex-direction: column; padding-bottom: 0; }
.drawer.wide .drawer-body > * { flex-shrink: 0; }
.drawer-actions.sticky {
  position: sticky; bottom: 0; z-index: 4;
  margin: 18px -18px 0; padding: 12px 18px;
  background: var(--panel); border-top: 1px solid var(--border);
  align-items: center;
}
.drawer.wide .pv-card { margin-top: auto; }
.drawer.wide .drawer-actions.sticky { margin-top: 14px; }
.actions-hint { margin-left: auto; color: var(--muted); font-size: 11px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field .req { color: var(--danger); font-size: 11px; font-weight: 400; }
.field > label { display: flex; align-items: baseline; gap: 6px; }
.field > label .label-hint { margin-left: auto; }
.label-hint.warn { color: var(--danger); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 80px); background: #fff; border: 1px solid var(--border); color: var(--text); padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 60; box-shadow: var(--shadow-pop); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { border-color: rgba(229, 72, 77, .4); color: var(--danger); }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .flow { flex-direction: column; }
  .globalbar { padding: 0 12px; }
  .brand-text small { display: none; }
}

/* 发布就绪度 */
#readiness-table { min-width: 880px; }
#readiness-table td { vertical-align: top; }
#readiness-table td.r-blockers { white-space: normal; min-width: 420px; color: var(--warning); line-height: 1.65; }
#readiness-table td.r-blockers.ok { color: var(--success); }
#readiness-table td.r-actions { white-space: nowrap; }
#readiness-table td.r-actions .btn { margin-right: 4px; }
.readiness-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--panel-2); color: var(--muted); font-size: 12px; line-height: 1.8; }
.readiness-foot strong { color: var(--text); }
.readiness-foot.ok { background: rgba(15, 157, 118, .06); }

/* 类目选择 */
.cat-select { max-width: 200px; }
.cat-select.empty { color: var(--muted); border-color: rgba(229, 72, 77, .35); }
.combo-list { margin-top: 8px; max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.combo-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.combo-item:last-child { border-bottom: 0; }
.combo-item small { color: var(--muted); flex: 0 0 auto; }
.combo-item:hover { background: var(--accent-soft); }
.combo-item.active { background: var(--accent-soft-2); color: var(--accent); font-weight: 600; }
.combo-empty { padding: 12px; color: var(--muted); font-size: 12px; }
.combo-value { margin-top: 8px; font-size: 12px; color: var(--muted); }
.combo-value.picked { color: var(--success); font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-row:empty { display: none; }
.chip { border: 1px solid rgba(97, 87, 246, .35); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit; }
.chip:hover { background: #ece9ff; }
#batch-category { min-width: 150px; max-width: 190px; }
.combo-head { margin-top: 10px; }
.combo-value.warn { color: var(--warning); font-weight: 600; }

.cell-tag { display: inline-block; margin-top: 4px; font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.cell-tag.auto { color: var(--accent); border-color: rgba(97, 87, 246, .3); background: var(--accent-soft); }
.cell-tag.ok { color: var(--success); border-color: rgba(15, 157, 118, .28); background: rgba(15, 157, 118, .08); }
.cell-tag.warn { color: var(--warning); border-color: rgba(194, 106, 0, .26); background: rgba(194, 106, 0, .07); }
.link-apply { display: inline-block; margin-top: 4px; font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px dashed var(--accent); background: transparent; color: var(--accent); cursor: pointer; font-family: inherit; }
.link-apply:hover { background: var(--accent-soft); }

#category-table th:first-child, #category-table td:first-child { position: sticky; left: 0; background: var(--panel); z-index: 2; }
#category-table thead th:first-child { background: #f9f9fe; z-index: 3; }

.combo { position: relative; }
.combo > summary { list-style: none; }
.combo > summary::-webkit-details-marker { display: none; }
.combo-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; cursor: pointer; color: var(--muted);
}
.combo-trigger:hover { border-color: var(--accent); }
.combo-trigger.picked { color: var(--text); border-color: rgba(97, 87, 246, .45); background: var(--accent-soft); }
.combo-picked { font-weight: 600; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-placeholder { flex: 1; }
.combo-caret { margin-left: auto; color: var(--muted); font-size: 11px; }
.combo-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 6;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-pop); padding: 10px;
}
.combo-pop .combo-list { margin-top: 8px; max-height: 220px; }
.combo-pop .combo-item small.ok { color: var(--success); }
.combo-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 11px; }
.cat-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; }
.cat-meta:empty { display: none; }
.cat-miss { color: var(--warning); }

.pv-card { margin-top: 2px; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px 14px; background: var(--panel-2); }
.pv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 12px; }
.pv-head strong { font-size: 12px; font-weight: 600; }
.pv-head .muted { font-size: 11px; }
.pv-list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 20px; }
.pv-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); min-width: 0; }
.pv-name { flex: 0 0 64px; color: var(--text); white-space: nowrap; }
.pv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-count { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.pv-count.over { color: var(--warning); font-weight: 600; }
.pv-empty { grid-column: 1 / -1; font-size: 11px; color: var(--muted); line-height: 1.7; }

.drawer.wide .up-grid { grid-template-columns: repeat(6, 1fr); }
.drawer.wide .up-existing { grid-template-columns: repeat(7, 1fr); }
.drawer.wide .up-ops { padding: 3px; }

.label-hint { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 6px; }
.up-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.up-grid.empty { display: none; }
.up-thumb { position: relative; margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.up-thumb.is-main { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.up-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #fff; }
.up-badge, .up-index { position: absolute; top: 4px; left: 4px; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #fff; }
.up-index { background: rgba(0, 0, 0, .55); }
.up-ops { display: flex; gap: 4px; padding: 4px; background: rgba(255, 255, 255, .92); border-top: 1px solid var(--border); }
.up-op { flex: 1; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 6px; font: inherit; font-size: 10px; padding: 3px 2px; cursor: pointer; white-space: nowrap; }
.up-op:hover { border-color: var(--accent); color: var(--accent); }
.up-op.danger:hover { border-color: var(--danger); color: var(--danger); }
.up-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--panel-2); font-size: 12px; color: var(--muted); }
.up-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.up-drop.busy { opacity: .7; pointer-events: none; }
.up-hint { font-size: 11px; color: var(--muted); margin-left: auto; }
.up-existing-wrap { margin-top: 8px; font-size: 12px; color: var(--muted); }
.up-existing-wrap summary { cursor: pointer; padding: 4px 0; }
.up-existing { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; max-height: 210px; overflow: auto; }
.up-pick-item { border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); padding: 4px; cursor: pointer; font: inherit; color: var(--muted); font-size: 10px; overflow: hidden; }
.up-pick-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 5px; background: #fff; }
.up-pick-item span { display: block; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-pick-item:hover { border-color: var(--accent); }
.up-pick-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); color: var(--accent); }

.sku-thumb { position: relative; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); cursor: pointer; overflow: hidden; display: block; }
.sku-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sku-thumb:hover { border-color: var(--accent); }
.thumb-empty { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: 16px; }
.thumb-count { position: absolute; right: 0; bottom: 0; min-width: 14px; padding: 0 3px; border-radius: 4px 0 0 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: 9px; line-height: 13px; text-align: center; }

.raw-panel { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); padding: 10px 12px; margin: 14px 18px 0; }
.raw-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.raw-head strong { font-size: 13px; }
.raw-head .muted { font-size: 11px; }
.raw-head .btn { margin-left: auto; }
.raw-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.raw-thumb { margin: 0; width: 78px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.raw-thumb.is-main { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.raw-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #fff; }
.raw-thumb figcaption { font-size: 10px; color: var(--muted); text-align: center; padding: 3px 0; }
.raw-thumb.is-main figcaption { color: var(--accent); font-weight: 600; }
.image-item a { display: block; }
.image-item a.dl { display: inline-block; margin-top: 2px; color: var(--accent); font-size: 11px; text-decoration: none; }
.image-item a.dl:hover { text-decoration: underline; }

/* —— 团队 / 套餐 / 设置 —— */
.invite-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 18px; align-items: center; }
.invite-bar .input:first-child { flex: 1 1 220px; }
.invite-result { padding: 0 18px 16px; }
.invite-result:empty { display: none; }
.invite-result .tmp-pass { display: inline-block; margin-top: 6px; padding: 8px 12px; border-radius: 8px; background: #f5f3ff; border: 1px dashed rgba(97, 87, 246, .4); color: var(--text); font-family: ui-monospace, Consolas, monospace; }

.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding: 18px; }
.usage-item { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: #fff; }
.usage-item-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.usage-item-head span { color: var(--muted); font-size: 12px; }
.usage-item-head b { font-size: 18px; font-weight: 700; }
.usage-item-head b small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.usage-item .bar { height: 6px; }
.usage-item .bar i.hot { background: linear-gradient(135deg, #f59e0b, #ef4444); }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.plan-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.plan-card.current { border-color: rgba(97, 87, 246, .5); box-shadow: 0 10px 28px rgba(97, 87, 246, .12); }
.plan-card h3 { margin: 0; font-size: 15px; font-weight: 700; }
.plan-price { margin-top: 10px; font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.plan-price small { font-size: 12px; color: var(--muted); font-weight: 400; }
.plan-tagline { color: var(--muted); font-size: 12px; margin-top: 6px; min-height: 20px; }
.plan-features { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; }
.plan-features li { font-size: 12px; color: #4a5468; padding-left: 16px; position: relative; }
.plan-features li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-size: 11px; }
.plan-card .btn { width: 100%; justify-content: center; margin-top: 16px; }
.plan-badge { position: absolute; top: 16px; right: 16px; font-size: 10px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft-2); color: var(--accent); font-weight: 600; }

.key-box { margin: 0 18px 18px; padding: 12px 14px; border-radius: 10px; background: #f5f3ff; border: 1px dashed rgba(97, 87, 246, .4); }
.key-box code { background: #fff; padding: 3px 8px; }

/* —— 登录 / 注册 —— */
.auth-page {
  min-height: 100vh; margin: 0;
  display: grid; place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(1200px 600px at 15% -10%, #e7e9ff 0%, rgba(231, 233, 255, 0) 60%),
    radial-gradient(900px 500px at 95% 15%, #f3e8ff 0%, rgba(243, 232, 255, 0) 55%),
    linear-gradient(180deg, #f4f6ff 0%, #f7f5ff 100%);
}
.auth-card {
  width: 100%; max-width: 424px;
  background: #fff; border-radius: 18px;
  padding: 34px 36px 26px;
  box-shadow: 0 24px 70px rgba(64, 54, 150, .12), 0 2px 6px rgba(29, 37, 56, .04);
  border: 1px solid rgba(233, 235, 246, .9);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-logo {
  width: 50px; height: 50px; border-radius: 14px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 24px; font-weight: 700;
  box-shadow: 0 10px 22px rgba(100, 88, 247, .3);
}
.auth-title { margin: 12px 0 0; font-size: 19px; font-weight: 700; letter-spacing: .4px; }
.auth-sub { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.auth-tabs { display: flex; gap: 4px; background: #f4f5fb; border-radius: 10px; padding: 4px; margin: 22px 0 18px; }
.auth-tab { flex: 1; border: 0; background: transparent; color: #6b7280; padding: 8px 0; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }
.auth-tab.active { background: #fff; color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(29, 37, 56, .08); }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 12px; color: #4a5468; margin-bottom: 6px; font-weight: 500; }
.auth-input {
  width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 0 12px; outline: none; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-captcha-row { display: flex; gap: 10px; align-items: stretch; }
.auth-captcha-row .auth-input { flex: 1; }
.auth-captcha {
  height: 42px; width: 120px; border-radius: 9px; border: 1px solid var(--border-strong);
  overflow: hidden; cursor: pointer; display: grid; place-items: center; background: #fafbff; flex: 0 0 auto;
}
.auth-captcha svg, .auth-captcha img { width: 100%; height: 100%; display: block; object-fit: cover; }
.auth-code-btn {
  flex: 0 0 auto; min-width: 106px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.auth-code-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.auth-code-btn:disabled { opacity: .55; cursor: default; }
.auth-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.auth-submit {
  width: 100%; height: 42px; margin-top: 6px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--grad); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 22px rgba(100, 88, 247, .28);
}
.auth-submit:hover { filter: brightness(1.04); }
.auth-submit:disabled { opacity: .65; cursor: progress; }
.auth-foot { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); text-align: center; color: var(--muted); font-size: 11px; line-height: 1.8; }
.auth-error { display: none; margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: rgba(229, 72, 77, .08); color: var(--danger); font-size: 12px; }
.auth-error.show { display: block; }
.auth-note { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 10px; color: var(--muted); font-size: 11px; }

/* —— 订阅状态横幅 —— */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 16px; padding: 11px 16px; border-radius: 10px;
  font-size: 12.5px; border: 1px solid transparent;
}
.banner[hidden] { display: none; }
.banner.info { background: #eef1ff; border-color: #d9dfff; color: #3b3f8f; }
.banner.warn { background: #fff7ed; border-color: #fde3c8; color: #9a5b00; }
.banner.danger { background: #fdf0f0; border-color: #f8d7d8; color: #a3282c; }
.banner-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.banner .btn { padding: 5px 12px; }

/* —— 当前订阅卡 —— */
.sub-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border);
}
.sub-main { min-width: 0; }
.sub-plan { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.sub-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.sub-meta-line b { color: var(--text); }
.sub-side { display: flex; gap: 8px; flex: 0 0 auto; }

/* —— 分段控件 —— */
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: #eef0f9; gap: 2px; }
.seg-item {
  border: 0; background: transparent; cursor: pointer; padding: 5px 12px; border-radius: 7px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.seg-item.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(29, 37, 56, .1); }

/* —— 邮件服务器设置 —— */
.mail-panel { padding-bottom: 4px; }
.mail-status { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; font-weight: 500; }
.mail-status.on { background: rgba(15, 157, 118, .1); color: var(--success); }
.mail-status.off { background: rgba(194, 106, 0, .1); color: var(--warning); }
.mail-intro {
  display: flex; gap: 14px; align-items: flex-start; margin: 18px; padding: 14px 16px;
  background: linear-gradient(135deg, rgba(97, 87, 246, .07), rgba(139, 92, 246, .04));
  border: 1px solid rgba(97, 87, 246, .14); border-radius: 10px;
}
.mail-intro-icon {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 9px; background: var(--grad);
  color: #fff; display: grid; place-items: center;
}
.mail-intro-icon .ico { width: 18px; height: 18px; }
.mail-intro strong { font-size: 13px; }
.mail-intro p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.mail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 0 18px 6px; }
.mail-group { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.mail-group-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
.mail-group-title span {
  width: 19px; height: 19px; flex: 0 0 auto; border-radius: 50%; background: var(--accent-soft-2);
  color: var(--accent); font-size: 11px; display: grid; place-items: center; font-weight: 700;
}
.mail-group .field { margin-bottom: 10px; }
.mail-group .field:last-child { margin-bottom: 0; }
.mail-group .field label { font-size: 11.5px; }
.mail-group .input { font-size: 12px; padding: 7px 9px; }
.mail-field-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.mail-actions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; margin-top: 8px; border-top: 1px solid var(--border);
}
.mail-test { display: flex; align-items: center; gap: 8px; flex: 1 1 340px; }
.mail-test .input { flex: 1 1 auto; min-width: 160px; }
.mail-note { padding: 0 18px 14px; color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .mail-grid { grid-template-columns: 1fr; }
  .qr-layout { grid-template-columns: 1fr !important; }
}

/* —— 收款二维码（管理端） —— */
.qr-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; padding: 0 18px 18px; }
.qr-preview-box {
  min-height: 240px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--panel-2);
  display: grid; place-items: center; padding: 12px;
}
.qr-preview-box img { max-width: 100%; max-height: 260px; border-radius: 8px; }
.qr-empty { color: var(--muted); font-size: 12px; text-align: center; }
.qr-form .field textarea { min-height: 72px; font-family: inherit; }
.qr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* —— 用户订阅页收款码 —— */
.pay-qr-panel { border-color: rgba(97, 87, 246, .3); }
.pay-qr-body { display: flex; gap: 20px; align-items: flex-start; padding: 18px; flex-wrap: wrap; }
.pay-qr-body img { width: 180px; height: 180px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 6px; }
.pay-qr-info { flex: 1 1 260px; }
.pay-qr-info h3 { margin: 0 0 6px; font-size: 15px; }
.pay-qr-info p { margin: 0 0 8px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.pay-qr-info .qr-steps { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.pay-qr-empty { padding: 18px; color: var(--muted); font-size: 12.5px; }

/* —— 套餐卡补充 —— */
.plan-card.popular { border-color: rgba(97, 87, 246, .35); }
.plan-card.downgrade-card { opacity: .62; }
.plan-card.downgrade-card .plan-price { color: var(--muted); }
.plan-badge.soft { background: var(--grad); color: #fff; }
.plan-save { font-size: 11px; color: var(--success); margin-top: 2px; min-height: 16px; }

/* —— 套餐分布 —— */
.plan-mix { padding: 0 18px 18px; display: grid; gap: 10px; }
.mix-row { display: grid; grid-template-columns: 70px 1fr 110px; align-items: center; gap: 12px; }
.mix-label { font-size: 12px; color: var(--muted); }
.mix-value { font-size: 11.5px; color: var(--muted); text-align: right; }
.admin-ops { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-ops .input.small { width: 92px; }

/* —— 对外定价页 —— */
.pricing-page {
  min-height: 100vh; margin: 0;
  background:
    radial-gradient(1100px 520px at 12% -8%, #e9ebff 0%, rgba(233, 235, 255, 0) 62%),
    radial-gradient(900px 480px at 92% 6%, #f4eaff 0%, rgba(244, 234, 255, 0) 55%),
    linear-gradient(180deg, #f5f7ff 0%, #faf9ff 100%);
}
.pricing-nav {
  position: sticky; top: 0; z-index: 20;
  padding: 15px max(24px, calc((100vw - 1120px) / 2 + 24px));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(250, 249, 255, .88);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(233, 235, 246, .75);
}
.pricing-nav-actions { display: flex; gap: 10px; }
.pricing-main { max-width: 1120px; margin: 0 auto; padding: 12px 24px 48px; }
.pricing-hero { text-align: center; padding: 34px 0 26px; }
.pricing-eyebrow {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 600;
}
.pricing-hero h1 { margin: 14px 0 10px; font-size: 32px; line-height: 1.28; letter-spacing: -.6px; }
.pricing-hero p { margin: 0 auto; max-width: 620px; color: var(--muted); font-size: 13.5px; }
.pricing-seg { margin-top: 20px; }
.pricing-stats { margin-top: 18px; margin-bottom: 0; font-size: 13px; color: var(--muted); }
.pricing-stats::before { content: '●'; margin-right: 8px; color: #12805f; font-size: 10px; vertical-align: 1px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 8px; }
.price-card {
  position: relative; background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; box-shadow: 0 2px 10px rgba(37, 33, 90, .04);
  display: flex; flex-direction: column;
}
.price-card.popular { border-color: rgba(97, 87, 246, .45); box-shadow: 0 16px 40px rgba(97, 87, 246, .14); }
.price-card h3 { margin: 0; font-size: 15px; font-weight: 700; }
.price-amount { margin-top: 12px; font-size: 34px; font-weight: 700; letter-spacing: -1px; }
.price-amount small { font-size: 12.5px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.price-sub { color: var(--muted); font-size: 12px; min-height: 18px; margin-top: 2px; }
.price-cta { width: 100%; justify-content: center; margin-top: 16px; }
.price-features { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.price-features li { font-size: 12.5px; color: #4a5468; padding-left: 18px; position: relative; }
.price-features li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-size: 11px; }
.price-features li b { color: var(--text); }
.pricing-compare, .pricing-faq { margin-top: 44px; }
.pricing-compare h2, .pricing-faq h2 { font-size: 18px; margin: 0 0 14px; letter-spacing: -.3px; }
.compare-table { background: #fff; border-radius: 12px; }
.compare-table td, .compare-table th { font-size: 12.5px; }
.compare-table .yes { color: var(--success); font-weight: 600; }
.compare-table .no { color: #b9bfd0; }
.faq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(238px, 1fr)); gap: 14px; }
.faq-item { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.faq-item h3 { margin: 0 0 6px; font-size: 13.5px; }
.faq-item p { margin: 0; color: var(--muted); font-size: 12.5px; }
.pricing-foot { text-align: center; color: var(--muted); font-size: 11.5px; padding: 28px 0 40px; }

#admin-stats { grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); }

/* —— 可发布性验证 —— */
#live-table { table-layout: fixed; }
#live-table td { vertical-align: top; }
#live-table .badge { white-space: nowrap; }
.live-ok { color: var(--success); font-weight: 600; }
.live-bad { color: #c0392b; font-weight: 600; }
.live-why { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.55; word-break: break-word; }
.live-cases { display: flex; gap: 6px; flex-wrap: wrap; }
.live-case { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef0f7; color: var(--muted); }
.live-case.ok { background: #eaf8ef; color: #1f7a44; }
.live-case.bad { background: #fdeeee; color: #a3282c; }
