:root {
  color-scheme: light;
  --text: #17191c;
  --muted: #6a717b;
  --faint: #9aa0a8;
  --line: #e4e6ea;
  --line-strong: #cfd3d9;
  --bg: #ffffff;
  --side: #fafafb;
  --soft: #f5f6f8;
  --primary: #1d5fe0;
  --primary-hover: #174cb5;
  --primary-soft: #eaf1fd;
  --danger: #c3261c;
  --danger-soft: #fdeceb;
  --ok: #13803f;
  --ok-soft: #e6f5ec;
  --warn: #a8650a;
  --radius: 6px;
  --side-w: 232px;
  --mono: "SFMono-Regular", Consolas, Menlo, monospace;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; line-height: 1.3; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 外壳 */
.shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { padding: 24px 32px 48px; width: 100%; }

.side {
  position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none;
  display: flex; flex-direction: column; gap: 12px; padding: 12px;
  background: var(--side); border-right: 1px solid var(--line); overflow-y: auto;
}
.signed-out .side, .signed-out .mobile-top { display: none; }
.boot { margin: 24px 32px; }

.account { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius); color: var(--text); }
.account:hover { background: var(--soft); text-decoration: none; }
.account .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: var(--text); color: var(--bg);
}
.account .who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.account strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .role { font-size: 12px; color: var(--muted); }

.side-search {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted);
}
.side-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.side-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; color: var(--text); }
.side-search kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; line-height: 16px; }

.side-nav, .side-foot { display: flex; flex-direction: column; gap: 2px; }
.side-nav { flex: 1; padding-top: 4px; border-top: 1px solid var(--line); }
.side-nav a, .side-foot a, .side-link {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px;
  border-radius: var(--radius); color: var(--text); font-size: 13px;
  background: transparent; border: 0; width: 100%; text-align: left; justify-content: flex-start;
}
.side-nav a svg, .side-foot a svg, .side-link svg { color: var(--muted); }
.side-nav a:hover, .side-foot a:hover, .side-link:hover:not(:disabled) { background: #eef0f3; text-decoration: none; border: 0; }
.side-nav a.active, .side-foot a.active { background: #e9ebef; font-weight: 600; }
.side-nav a.active svg, .side-foot a.active svg { color: var(--text); }
.side-group { margin-top: 14px; padding: 8px 8px 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
#nav-data-group { margin-top: 0; padding-top: 0; border-top: 0; }
.side-nav a { margin-left: 8px; width: calc(100% - 8px); }

.side-foot { padding-top: 8px; border-top: 1px solid var(--line); }
#side-toggle .chev { transition: transform 0.18s ease; }
html.side-locked #side-toggle { display: none; }

@media (min-width: 901px) {
  html.side-collapsed .side { width: 56px; padding-left: 8px; padding-right: 8px; }
  html.side-collapsed .side-nav a,
  html.side-collapsed .side-foot a,
  html.side-collapsed .side-link { justify-content: center; gap: 0; padding: 0; font-size: 0; margin-left: 0; width: 100%; }
  html.side-collapsed .side-search,
  html.side-collapsed .who-text,
  html.side-collapsed .side-group,
  html.side-collapsed .process { display: none; }
  html.side-collapsed .account { justify-content: center; padding-left: 0; padding-right: 0; }
  html.side-collapsed #side-toggle .chev { transform: rotate(180deg); }
}

/* 服务状态（侧边栏底部） */
.process { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding: 10px 8px 2px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.process:empty { display: none; }
.process .state { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.process .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.process.warn .dot { background: var(--warn); }
.process.warn .state { color: var(--warn); }
.process.bad .dot { background: var(--danger); }
.process.bad .state { color: var(--danger); }
.process .row { display: flex; justify-content: space-between; gap: 8px; }
.process .row span:last-child { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 移动端顶栏 */
.mobile-top { display: none; align-items: center; gap: 8px; height: 52px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 15; }
.brand { font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.icon-btn { width: 32px; padding: 0; }
.scrim { position: fixed; inset: 0; background: rgba(23, 25, 28, 0.32); z-index: 25; }

/* 提示条 */
.banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 12px; max-width: min(640px, calc(100vw - 32px));
  padding: 10px 14px; border-radius: var(--radius); font-size: 13px;
  background: var(--bg); color: var(--danger); border: 1px solid #f2c4bf;
  box-shadow: 0 8px 24px rgba(23, 25, 28, 0.12);
}
.banner::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.banner.ok { color: var(--ok); border-color: #bfe3cd; }
.banner .close { border: 0; background: transparent; color: var(--muted); height: auto; padding: 0 2px; font-size: 16px; line-height: 1; }
.banner .close:hover { color: var(--text); background: transparent; }

/* 按钮 */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none;
}
button:hover:not(:disabled), .btn:hover { background: var(--soft); text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--bg); }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.danger { color: var(--danger); border-color: #efc2bd; }
button.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
button.sm, .btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.busy { pointer-events: none; opacity: 0.7; }
button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.toolbar, .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 页头 */
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.page-head .back::before { content: "←"; }
.page-head .back:hover { color: var(--text); text-decoration: none; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* 概览卡片 */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); text-align: left; height: auto; align-items: stretch; font-weight: 400; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat.bad .v { color: var(--danger); }
.stat.run .v { color: var(--primary); }

/* 筛选 */
.scrape-form { display: flex; flex-direction: column; gap: 8px; }
.scrape-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.scrape-row .f { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.scrape-row .lab { padding: 0; font-size: 12px; font-weight: 500; color: var(--muted); line-height: 16px; }
.scrape-row fieldset.f { display: block; }
.scrape-row fieldset.f legend { float: left; width: 100%; margin-bottom: 6px; }
.scrape-row fieldset.f .seg { clear: both; }
td.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.scrape-row .f.grow { flex: 1; min-width: 240px; }
.scrape-row .f.narrow { width: 96px; }
.scrape-row input[type="number"], .scrape-row textarea {
  height: 36px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  padding: 0 10px; border-radius: var(--radius); width: 100%; font: inherit; font-size: 13px;
}
.scrape-row input[type="number"] { font-variant-numeric: tabular-nums; }
.scrape-row textarea { display: block; padding: 8px 10px; line-height: 18px; resize: none; overflow: hidden; }
.scrape-row textarea.multi { font-family: var(--mono); }
.scrape-row input:focus, .scrape-row textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.scrape-row > button { height: 36px; padding: 0 18px; margin-top: 22px; }
.scrape-row .f.is-disabled .lab, .scrape-row .f.is-disabled input { opacity: 0.5; }
.scrape-row input:disabled { background: var(--side); cursor: not-allowed; }
.scrape-hint { margin: 0; font-size: 12px; color: var(--muted); }
.scrape-hint:empty { display: none; }

.seg { display: inline-flex; height: 36px; padding: 3px; gap: 2px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); }
.seg label { position: relative; display: flex; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; padding: 0 12px; border-radius: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background .15s ease, color .15s ease; }
.seg label:hover span { color: var(--text); }
.seg input:checked + span { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(23, 25, 28, 0.08), 0 0 0 1px var(--line); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }

.scrape-quota .quota { flex-direction: row; align-items: center; gap: 10px; }
.scrape-quota .quota-top { display: contents; }
.scrape-quota .meter { order: 1; width: 120px; }
.scrape-quota .quota-top span:last-child { order: 2; }
.scrape-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.scrape-progress-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.scrape-progress-top span:first-child { font-weight: 600; color: var(--text); }
.scrape-progress .progress { margin: 0; height: 6px; }

/* 结果区：工具条 + 表格合成一张卡片 */
.results { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.results-bar { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); border-radius: var(--radius) var(--radius) 0 0; }
.results .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.results .empty { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.results .pager { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); }
.search-field { position: relative; display: flex; align-items: center; }
.search-field svg { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.filters .search-field input { padding-left: 32px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn svg { width: 14px; height: 14px; color: var(--muted); }
.export-group { display: flex; gap: 6px; padding-left: 8px; border-left: 1px solid var(--line); }
.results td.asin { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.results td.title-cell { min-width: 240px; }
.results td.title-cell .clamp { line-height: 1.45; }
.stock { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.stock::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.stock.ok { color: var(--ok); }
.stock.ok::before { background: var(--ok); }
.stock.bad { color: var(--danger); }
.stock.bad::before { background: var(--danger); }
.results-bar .col-menu { left: auto; right: 0; }
@media (max-width: 900px) {
  .results-bar select { flex: 1 1 100%; }
  .search-field { flex: 1 1 160px; min-width: 0; }
  .search-field input { width: 100%; }
  .scrape-row .f.grow { flex-basis: 100%; }
  .export-group { padding-left: 0; border-left: 0; }
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.col-picker { position: relative; z-index: 5; }
.col-menu {
  position: absolute; z-index: 6; top: 36px; left: 0; width: 220px; max-height: 360px; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .12); padding: 8px;
}
.col-menu label { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px; color: var(--text); white-space: nowrap; }
.col-menu input { width: 16px; height: 16px; min-width: 0; margin: 0; }
.col-menu .btn { width: 100%; margin-top: 6px; }
.thumb { width: 48px; height: 48px; object-fit: contain; background: var(--side); border-radius: 4px; display: block; }
.shot { width: 72px; height: 72px; object-fit: contain; background: var(--side); border-radius: 4px; display: block; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.perm-matrix td:not(:first-child), .perm-matrix th:not(:first-child) { text-align: center; min-width: 108px; }
.perm-matrix input { width: 16px; height: 16px; margin: 0; }
.perm-matrix tr.group td { background: var(--side); color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 8px; padding-bottom: 8px; }
.perm-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--side); }
.perm-matrix .perm-name { display: block; color: var(--text); }
.perm-matrix td .id { display: block; margin-top: 2px; font-size: 11px; }
.perm-matrix tbody tr:not(.group):hover td { background: var(--soft); }
.perm-matrix input { accent-color: var(--primary); cursor: pointer; }
.perm-matrix input:disabled { cursor: not-allowed; }
.role-head { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.role-head .name { font-weight: 600; color: var(--text); }
.role-tools { display: flex; gap: 4px; margin-top: 4px; }
.role-create { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.role-create label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.role-create input { width: 200px; color: var(--text); }

.card.flush { padding: 0; overflow: clip; }
.card.flush > .card-head, .card.flush > .card-head:first-child { margin: 0; padding: 8px 16px; min-height: 42px; border-radius: 0; }
.card.flush > .table-wrap { border: 0; border-radius: 0; }
.sticky-foot {
  position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg);
}
.sticky-foot .sub { margin-right: auto; font-size: 12px; }
.warn-text { color: var(--warn) !important; font-weight: 600; }

.quota { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.quota-top { display: flex; justify-content: space-between; gap: 12px; }
.quota strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.meter > div { height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s ease; }
.quota.warn .meter > div { background: var(--warn); }
.quota.bad .meter > div { background: var(--danger); }
.quota.bad .quota-top span:last-child strong { color: var(--danger); }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width 0.3s ease; }
.progress.active > div { background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); background-size: 40% 100%; animation: scrape-slide 1.2s linear infinite; }
@keyframes scrape-slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.scrape-log { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; max-height: 160px; overflow: auto; }
.scrape-log li { margin: 2px 0; }
.filters input, .filters select, .field input, .field select, .field textarea,
.user-fields input, .user-fields select, .role-create input, .role-create select {
  height: 32px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--bg); font-size: 13px;
}
.filters input:focus, .filters select:focus, .field input:focus, .field select:focus, .field textarea:focus,
.user-fields input:focus, .user-fields select:focus, .role-create input:focus, .role-create select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.role-create select { width: 200px; color: var(--text); }
.filters input { min-width: 280px; }
.filters .col-menu input { width: 16px; height: 16px; min-width: 0; margin: 0; padding: 0; }
.filters .count { margin-left: auto; color: var(--muted); font-size: 12px; }

/* 结果切换（下划线标签，参考 Apify 的 Recent / Scheduled） */
.tally { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tally button { height: 34px; border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 0 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.tally button:hover:not(:disabled) { background: transparent; color: var(--text); }
.tally button.on { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.tally .bad:not(.on) { color: var(--danger); }

/* 表格 */
.table-wrap { overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { position: sticky; top: 0; z-index: 1; background: var(--side); font-weight: 500; font-size: 12px; color: var(--muted); white-space: nowrap; }
.wide table { min-width: 1000px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--side); }
tr.selected td { background: var(--primary-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions-cell { white-space: nowrap; text-align: right; }
td.actions-cell > * + * { margin-left: 6px; }
td a { font-weight: 500; }
.id { font-family: var(--mono); color: var(--muted); font-size: 12px; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sub.err-text { color: var(--danger); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 480px; }
.time { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 状态标签 */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px;
  border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: #eef0f3; color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.ok::before { content: "✓"; width: auto; height: auto; background: none; font-size: 11px; font-weight: 700; }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.run { background: var(--primary-soft); color: var(--primary); }
.pill.run::before { animation: pulse 1.2s ease-in-out infinite; }
.pill.plain::before { display: none; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .pill.run::before { animation: none; } }

/* 空状态 */
.empty { padding: 48px 16px; text-align: center; color: var(--muted); background: var(--bg); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty p { margin: 0 0 12px; }
.empty p:last-child { margin-bottom: 0; }
.log .empty, .card .empty { border: 0; background: transparent; padding: 24px 16px; }

/* 卡片：灰色标题条 */
.detail { display: flex; flex-direction: column; gap: 16px; }
.detail > .page-head { margin-bottom: 4px; }
.card, .sheet-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card > .card-head:first-child {
  margin: -16px -16px 16px; padding: 8px 16px; min-height: 42px;
  background: var(--side); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.card-head h2 { margin: 0; font-size: 13px; }
.card > h2:first-child {
  margin: -16px -16px 16px; padding: 11px 16px; font-size: 13px;
  background: var(--side); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.sheet { max-width: 780px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field .label { font-size: 13px; font-weight: 500; }
.field .req { color: var(--danger); margin-left: 2px; }
.field .hint { color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea { width: 100%; }
.field input[readonly], .field select:disabled { background: var(--soft); color: var(--muted); }
.field textarea { height: auto; min-height: 120px; padding: 8px 10px; font-family: var(--mono); font-size: 13px; resize: vertical; }
.field .err { color: var(--danger); font-size: 12px; }
.field .err:empty, .field .hint:empty { display: none; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--danger); }
.form-foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--line); }
.mono { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-all; }
.meta-grid { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 8px 16px; align-items: start; margin-bottom: 12px; font-size: 13px; }
.meta-grid > span:nth-child(odd) { color: var(--muted); }
.deploy-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.deploy-layout > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* 商品详情 */
.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 32px; }
.kv-item.wide { grid-column: 1 / -1; }
.kv-item .k { font-size: 12px; color: var(--muted); }
.kv-item .c { margin-left: 6px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.kv-item .v { margin-top: 2px; word-break: break-word; font-size: 13px; }
.kv-item .v a { word-break: break-all; }
.hide-empty .kv-item.blank { display: none; }
.hide-empty .card.all-blank { display: none; }
.product-head { display: flex; gap: 16px; align-items: flex-start; }
.product-head img { width: 88px; height: 88px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); flex: none; }
.product-head h1 { font-size: 18px; line-height: 1.4; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.jump { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; padding: 8px 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.jump a { font-size: 12px; padding: 3px 10px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.jump a:hover { color: var(--text); text-decoration: none; border-color: var(--line-strong); }
.jump a.active { color: var(--primary); background: var(--primary-soft); border-color: transparent; font-weight: 600; }
.child-block { margin-top: 0; }

/* 日志 */
.log { min-height: 96px; max-height: 440px; overflow: auto; background: #111418; color: #d5dae0; border-radius: var(--radius); border: 1px solid #111418; }
.log table { font-family: var(--mono); font-size: 12px; min-width: 0; }
.log td { border-bottom: 0; padding: 3px 12px; vertical-align: top; }
.log td:first-child { color: #7d8794; white-space: nowrap; width: 1%; }
.log td.lv { width: 1%; white-space: nowrap; color: #8fb3e6; }
.log td.lv.ERROR { color: #ff8a80; }
.log td.lv.DEBUG { color: #7d8794; }
.log td.msg { white-space: pre-wrap; word-break: break-all; }
.log .empty { color: #7d8794; }
.log-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0 8px; flex-wrap: wrap; }
.log-bar .sub { margin: 0; }

/* 分页 */
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 12px; }

/* 登录 */
.signed-out main { max-width: none; padding: 0; }
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--side); }
.auth form { width: 100%; max-width: 380px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 32px; box-shadow: 0 1px 2px rgba(23, 25, 28, 0.04); }
.auth h1 { margin-bottom: 4px; }
.auth .meta { margin-bottom: 24px; }
.auth button.primary { width: 100%; height: 36px; }
.auth .err { color: var(--danger); font-size: 13px; margin: 12px 0 0; }
.auth .err:empty { display: none; }
.auth .ok { color: var(--ok); font-size: 13px; margin: 12px 0 0; }
.auth-switch { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.auth-switch a { font-weight: 600; }

/* 用户 */
.user-avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 14px;
}
.user-avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.user-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.user-cell strong { font-weight: 600; }
.pending-card { border-color: #c9d9f7; }
.pending-card > .card-head { background: var(--primary-soft); }
.pending-card .card-head h2 { display: flex; align-items: center; gap: 8px; }
.user-table td { white-space: nowrap; }
.user-row.is-off td:not(:last-child) { color: var(--muted); }
.user-row.is-off .user-avatar { opacity: .55; }
.user-row:hover td, .user-row.is-open td { background: var(--side); }
.user-row.is-open td { border-bottom-color: transparent; }
.user-edit > td { padding: 0 12px 12px; background: var(--side); white-space: normal; }
.user-panel { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.user-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.user-panel-head strong { color: var(--text); }
.user-panel > .delete-confirm { margin: 0 16px 16px; }
.user-empty .empty { border: 0; padding: 32px 16px; }
.user-tools { display: flex; gap: 8px; flex: none; }
.user-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.user-sec { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.user-sec + .user-sec { border-left: 1px solid var(--line); background: var(--side); }
.user-sec h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.user-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.user-fields.single { grid-template-columns: 1fr; }
.user-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.user-fields input, .user-fields select { width: 100%; color: var(--text); }
.user-fields input[readonly] { background: var(--soft); font-family: var(--mono); }
.user-sec-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; }
.user-sec-foot .hint { font-size: 12px; color: var(--muted); }
.user-sec-foot button { flex: none; }
@media (max-width: 900px) {
  .user-body { grid-template-columns: 1fr; }
  .user-sec + .user-sec { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .user-fields { grid-template-columns: 1fr; }
}
.delete-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; border: 1px solid #efc2bd; border-radius: var(--radius); background: var(--danger-soft); }
.delete-confirm p { flex-basis: 100%; margin: 0; font-size: 13px; }
.delete-confirm input { height: 32px; min-width: 220px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); }

@media (max-width: 1200px) {
  .deploy-layout { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .mobile-top { display: flex; }
  #side-toggle { display: none; }
  .side { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform 0.18s ease; box-shadow: 0 0 32px rgba(23, 25, 28, 0.16); }
  .nav-open .side { transform: none; }
  main { padding: 16px 16px 40px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .kv-grid { grid-template-columns: 1fr; }
  .filters input { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
