/* Wivora Remote Packs admin — 原生 CSS（无框架 / 无 CDN / 离线可用） */
:root {
  --bg: #0a0c12;
  --bg-soft: #10131c;
  --panel: #141824;
  --panel-2: #1a1f2e;
  --panel-3: #212739;
  --line: #262d42;
  --line-soft: #1e2435;
  --text: #e9ebf4;
  --muted: #8d95aa;
  --muted-2: #646d83;
  --accent: #7c5cff;
  --accent-soft: #a78bfa;
  --accent-dim: rgba(124, 92, 255, 0.14);
  --ok: #3ddc97;
  --ok-dim: rgba(61, 220, 151, 0.14);
  --warn: #ffb84d;
  --warn-dim: rgba(255, 184, 77, 0.14);
  --err: #ff6b6b;
  --err-dim: rgba(255, 107, 107, 0.14);
  --vip: #ffd166;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body { height: 100%; }
body.is-busy { cursor: progress; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 90% -10%, rgba(124, 92, 255, 0.13), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; }
code, .mono { font-family: var(--mono); }
a { color: var(--accent-soft); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }

/* ---------------- 按钮 / 表单 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #394263; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #7c5cff, #6a4bff); border-color: #8b6cff; }
.btn.primary:hover { background: linear-gradient(135deg, #8b6cff, #7c5cff); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.danger { color: var(--err); border-color: rgba(255, 107, 107, .4); background: var(--err-dim); }
.btn.block { width: 100%; padding: 10px; font-size: 14px; }
.btn.icon { padding: 4px 8px; font-size: 15px; line-height: 1; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.field > span { font-weight: 550; letter-spacing: .01em; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
textarea.code { font-family: var(--mono); font-size: 12.5px; min-height: 320px; white-space: pre; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input[type="file"] { font-size: 12px; color: var(--muted); }
input[type="file"]::file-selector-button {
  border: 1px solid var(--line); background: var(--panel-3); color: var(--text);
  border-radius: 6px; padding: 4px 9px; margin-right: 8px; cursor: pointer; font-family: inherit;
}
.error-text { color: var(--err); font-size: 12.5px; margin: 4px 0 0; white-space: pre-wrap; }

/* ---------------- 登录 ---------------- */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, rgba(26, 31, 46, .92), rgba(17, 20, 28, .96));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.login-logo {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, #7c5cff, #4b2fd6);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
  box-shadow: 0 8px 24px rgba(124, 92, 255, .4);
}
.login-card h1 { font-size: 21px; }
.login-card p { margin: 0; }

/* ---------------- 顶栏 ---------------- */
.app-view { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px; height: 56px; flex: 0 0 56px;
  background: rgba(15, 18, 27, .82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 14px; letter-spacing: .01em; }
.brand strong { color: var(--accent-soft); font-weight: 650; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #7c5cff, #4b2fd6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 14px;
}
.live-badge {
  margin-left: 14px; font: 600 12px var(--mono);
  color: var(--ok); background: var(--ok-dim);
  border: 1px solid rgba(61, 220, 151, .3);
  padding: 3px 9px; border-radius: 999px;
}
.topbar-spacer { flex: 1; }

/* ---------------- 布局 ---------------- */
.layout { flex: 1; display: grid; grid-template-columns: 216px 340px minmax(0, 1fr); min-height: 0; }
.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.side-label { padding: 10px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px;
  transition: background .12s, color .12s;
}
.nav button:hover { background: var(--panel); color: var(--text); }
.nav button.active { background: var(--accent-dim); border-color: rgba(124, 92, 255, .35); color: #cbbcff; font-weight: 600; }
.nav button .count { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.nav.sub button { padding-left: 20px; font-size: 12.5px; }
.nav.sub button.active { background: rgba(124, 92, 255, .1); }
.side-footer { margin-top: auto; padding: 14px 10px 4px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line-soft); }
.resource-item-drag-handle { color: var(--muted-2); cursor: grab; user-select: none; }
.resource-item-row:active .resource-item-drag-handle { cursor: grabbing; }
.feature-controls button { min-width: 28px; min-height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.feature-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.feature-row > button:first-child { min-width: 0; }
.feature-row.disabled { opacity: .6; }
.feature-controls { display: inline-flex; align-items: center; }
.feature-controls button { min-width: 42px; font-size: 11px; padding: 0 6px; }

/* ---------------- pack 列表 ---------------- */
.list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg-soft); }
.pane-actions { display: flex; align-items: center; gap: 10px; }
.archived-filter { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap; }
.archived-filter input { accent-color: var(--accent); }
.pane-head { padding: 14px 14px 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line-soft); }
.pane-head h2 { font-size: 15px; }
.pack-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.pack-card {
  display: flex; gap: 10px; align-items: center;
  padding: 4px 7px 4px 0; border: 1px solid transparent; border-radius: 10px;
  background: transparent; text-align: left; font: inherit; color: inherit; width: 100%;
}
.pack-select { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; padding: 6px 8px; cursor: pointer; background: transparent; border: 0; text-align: left; color: inherit; font: inherit; }
.pack-visibility-toggle { flex: 0 0 44px; display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 4px; min-height: 48px; padding: 4px 0; background: none; color: var(--muted); border: 0; font: inherit; font-size: 11px; cursor: pointer; }
.toggle-track { display: block; width: 32px; height: 18px; border-radius: 20px; background: var(--panel-3); border: 1px solid var(--muted-2); transition: background .15s; }
.toggle-track::after { content: ''; display: block; height: 12px; width: 12px; margin: 2px; background: var(--muted); border-radius: 50%; transition: transform .15s; }
.pack-visibility-toggle[aria-checked="true"] { color: var(--ok); }
.pack-visibility-toggle[aria-checked="true"] .toggle-track { background: var(--ok); border-color: var(--ok); }
.pack-visibility-toggle[aria-checked="true"] .toggle-track::after { background: #09281b; transform: translateX(14px); }
.pack-visibility-toggle:disabled { opacity: .45; cursor: progress; }
.pack-select:focus-visible, .pack-visibility-toggle:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 6px; }
.pack-sort-handle { flex: 0 0 24px; width: 24px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; color: var(--muted-2); background: none; cursor: grab; touch-action: none; user-select: none; }
.pack-sort-handle:hover { color: var(--text); background: var(--panel-3); }
.pack-sort-handle:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
.sort-grip { width: 12px; height: 18px; background: radial-gradient(circle, currentColor 1.5px, transparent 1.75px) 0 0 / 6px 6px; }
.pack-card.dragging { background: var(--accent-dim); border-color: var(--accent); box-shadow: 0 -3px 0 var(--accent-soft); }
.pack-list.sorting, .pack-list.sorting .pack-sort-handle { cursor: grabbing; user-select: none; }
.pack-list.saving-order { pointer-events: none; opacity: .65; }
.pack-card:hover { background: var(--panel); border-color: var(--line-soft); }
.pack-card.active { background: var(--panel-2); border-color: rgba(124, 92, 255, .45); }
.pack-thumb {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 8px; overflow: hidden;
  background: var(--panel-3); display: flex; align-items: center; justify-content: center;
  color: var(--muted-2); font-size: 17px; border: 1px solid var(--line-soft);
}
.pack-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pack-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.pack-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-id { font: 11px var(--mono); color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 1px; }
.list-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.resource-item-orchestrator { display: flex; flex-direction: column; gap: 12px; margin: 10px 0 14px; }
.resource-item-group { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.resource-item-group h4 { margin-bottom: 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.resource-item-list { display: flex; flex-direction: column; gap: 5px; max-height: 360px; overflow: auto; }
.resource-item-row { display: grid; grid-template-columns: 20px 28px minmax(100px, 1fr) auto auto 32px 32px; align-items: center; gap: 6px; min-height: 42px; padding: 4px 6px; border-radius: 7px; background: var(--panel-2); }
.resource-item-row select { padding: 5px 24px 5px 7px; min-width: 80px; }
.resource-item-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px var(--mono); }
.resource-item-row button { min-width: 32px; min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-3); color: var(--text); cursor: pointer; }
.advanced-json summary { cursor: pointer; color: var(--accent-soft); margin: 8px 0; }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--panel-3); color: var(--muted); border: 1px solid var(--line);
  text-transform: uppercase;
}
.badge.published { color: var(--ok); background: var(--ok-dim); border-color: rgba(61, 220, 151, .3); }
.badge.draft { color: var(--warn); background: var(--warn-dim); border-color: rgba(255, 184, 77, .3); }
.badge.hidden, .badge.archived { color: var(--muted); }
.badge.vip { color: var(--vip); background: rgba(255, 209, 102, .12); border-color: rgba(255, 209, 102, .3); }
.badge.free { color: #8ecbff; background: rgba(142, 203, 255, .1); border-color: rgba(142, 203, 255, .28); }
.badge.changed { color: var(--accent-soft); background: var(--accent-dim); border-color: rgba(124, 92, 255, .35); }
.badge.version { font-family: var(--mono); }

/* ---------------- 编辑器 ---------------- */
.editor-pane { min-width: 0; min-height: 0; overflow-y: auto; padding: 16px 18px 60px; }
.editor-empty { height: 100%; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-align: center; }
.editor-empty-icon { font-size: 44px; color: var(--panel-3); }
.editor-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.editor-title { min-width: 0; }
.editor-title h2 { font-size: 19px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-title .pack-id { margin-top: 4px; font-size: 12px; }
.editor-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.card-head h3 { font-size: 13.5px; }
.card-head .hint { font-size: 11.5px; color: var(--muted-2); }
.card-body { padding: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.names-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.names-grid .field > span { display: flex; justify-content: space-between; }
.names-grid .field > span em { font-style: normal; color: var(--muted-2); font-weight: 400; font-size: 11px; }
.names-grid input[dir="rtl"] { direction: rtl; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-fields .field { min-width: 120px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.form-error { margin-top: 10px; border: 1px solid rgba(255, 107, 107, .35); background: var(--err-dim); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #ffb3b3; white-space: pre-wrap; }

/* 封面 / 素材 */
.preview-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pack-size-previews { width: 100%; height: 260px; display: block; border: 0; margin-bottom: 16px; background: var(--panel); }
.cover-details { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.cover-details summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }
.asset-cleanup { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.asset-unused { color: var(--warn); }
.asset-table { table-layout: fixed; }
.asset-table th:first-child { width: 58px; }
.asset-table th:nth-child(3) { width: 120px; }
.asset-table th:last-child { width: 140px; }
.asset-table td { overflow-wrap: anywhere; }
.cover-controls .small { overflow-wrap: anywhere; }
@media (max-width: 980px) {
  .asset-table th:nth-child(3) { width: 95px; }
  .asset-table th:last-child { width: 65px; }
  .asset-actions { flex-direction: column; }
  .asset-table th:first-child { width: 45px; }
  .asset-thumb { width: 32px; height: 32px; }
}
.cover-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.cover-preview {
  width: 176px; height: 96px; border-radius: 10px; overflow: hidden;
  border: 1px dashed var(--line); background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-size: 12px;
  flex: 0 0 auto;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-controls { display: flex; flex-direction: column; gap: 8px; min-width: 240px; flex: 1; }
.asset-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 12px; }
.asset-table th { text-align: left; color: var(--muted-2); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.asset-table td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.asset-table tr:last-child td { border-bottom: none; }
.asset-thumb { width: 40px; height: 40px; border-radius: 6px; overflow: hidden; background: var(--panel-3); border: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-size: 13px; cursor: zoom-in; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-path { font-family: var(--mono); font-size: 12px; color: var(--text); word-break: break-all; }
.asset-sha { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); }
.asset-actions { display: flex; gap: 4px; justify-content: flex-end; }
.upload-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.upload-row .field { flex: 1; min-width: 160px; }
.upload-row input[type="file"] { max-width: 100%; }

/* JSON 编辑器 */
.json-toolbar { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.json-toolbar .spacer { flex: 1; }
.error-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.error-list li { font-size: 12px; color: #ffb3b3; background: var(--err-dim); border: 1px solid rgba(255, 107, 107, .25); border-radius: 6px; padding: 5px 8px; }
.error-list li .path { font-family: var(--mono); color: var(--err); }
.ok-text { color: var(--ok); font-size: 12.5px; }

/* ---------------- 弹窗 / 抽屉 / toast ---------------- */
.modal, .drawer {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 6, 10, .68); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  width: 100%; max-width: 520px; max-height: 86vh;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.modal-card.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; font-size: 15px; }
.modal-body { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer-card { width: min(560px, 96vw); height: 100%; background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.drawer .modal-body { flex: 1; }
.summary { display: flex; flex-direction: column; gap: 10px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.summary-row > span:first-child { color: var(--muted); }
.change-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.change-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--bg-soft); font-size: 12.5px; }
.change-item .pack-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change-item .pack-id { font-size: 10.5px; }
.publish-change-item { display: block; padding: 0; }
.publish-change-item > summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; list-style: none; }
.publish-change-item > summary::-webkit-details-marker { display: none; }
.publish-expand-label { color: var(--accent-soft); font-size: 11px; white-space: nowrap; }
.publish-change-item[open] .publish-expand-label { color: var(--muted-2); }
.publish-change-preview { border-top: 1px solid var(--line-soft); padding: 10px; display: flex; flex-direction: column; gap: 12px; }
.publish-change-preview section { display: flex; flex-direction: column; gap: 7px; }
.publish-change-preview h5 { color: var(--text); font-size: 12px; }
.publish-diff-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11.5px; }
.publish-diff-table th, .publish-diff-table td { padding: 6px 7px; border: 1px solid var(--line-soft); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.publish-diff-table th { color: var(--muted-2); background: var(--panel-2); }
.publish-diff-table th:first-child { width: 22%; }

.modal-card.home-content-modal { max-width: 1180px; }

.home-content-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.home-content-section {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel-2);
  min-width: 0;
}

.home-content-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.home-content-head h4 { margin: 0; color: var(--text); }

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

.home-content-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
}

.home-content-row.dragging { opacity: .55; }

.home-content-row.drag-over {
  border-color: #7c5cff;
  box-shadow: 0 0 0 2px rgba(124, 92, 255, .12);
}

.home-content-index {
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

.home-content-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) 110px;
  gap: 6px;
  min-width: 0;
  align-items: end;
}

.home-content-theme-fields { grid-template-columns: minmax(0, 1fr); }

.home-content-fields select { min-width: 0; }

.home-content-content {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.home-content-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.home-content-thumb {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-3);
}

.home-content-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  display: block;
}

.home-content-target {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.home-content-target-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.home-content-target-head strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.home-content-id {
  color: var(--muted-2);
  font: 11px var(--mono);
  overflow-wrap: anywhere;
}

.home-content-target-detail {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.home-content-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.home-content-field > span {
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.2;
}

.badge.type {
  color: #9ed7ff;
  background: rgba(77, 171, 255, .12);
  border-color: rgba(77, 171, 255, .32);
}

.home-content-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-top: 2px;
}

.home-content-drag-handle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
}

.home-content-drag-handle:active { cursor: grabbing; }

.home-content-drag-handle .sort-grip { display: block; }

.home-content-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line-soft);
  border-radius: 8px;
  text-align: center;
}

@media (max-width: 900px) {
  .home-content-columns { grid-template-columns: 1fr; }
  .home-content-fields { grid-template-columns: 1fr; }
  .home-content-content { grid-template-columns: 56px minmax(0, 1fr); }
  .home-content-thumb { width: 56px; height: 56px; }
}

@media (max-width: 560px) {
  #modal-home-content { padding: 12px; }
  #modal-home-content .modal-body { padding: 12px; }
  .home-content-section { padding: 10px; }
  .home-content-row { grid-template-columns: 20px minmax(0, 1fr); }
  .home-content-index { padding-top: 4px; }
  .home-content-content { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; }
  .home-content-thumb { width: 44px; height: 44px; border-radius: 8px; }
  .home-content-controls {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 0;
  }
}

.publish-before { color: var(--muted); }
.publish-after { color: var(--text); }
.publish-content-group { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 5px 8px; align-items: start; padding: 7px; border: 1px solid var(--line-soft); border-radius: 7px; }
.publish-content-group > strong { grid-row: 1 / span 5; font-size: 11.5px; }
.publish-item-change { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.publish-change-values { min-width: 0; overflow-wrap: anywhere; color: var(--muted); font: 11px var(--mono); }
.publish-asset-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; align-items: center; }
.publish-asset-path { overflow-wrap: anywhere; font: 11px var(--mono); }
.publish-raw-json { border-top: 1px dashed var(--line); padding-top: 8px; }
.publish-raw-json > summary { color: var(--accent-soft); cursor: pointer; font-size: 11.5px; }
.publish-raw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.publish-raw-grid pre { max-height: 260px; overflow: auto; padding: 8px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: 6px; font: 10px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .publish-raw-grid { grid-template-columns: 1fr; }
  .publish-asset-row { grid-template-columns: auto minmax(0, 1fr); }
  .publish-asset-row .muted { grid-column: 2; }
  .publish-content-group { grid-template-columns: 72px minmax(0, 1fr); }
}
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.audit-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--bg-soft); font-size: 12.5px; }
.audit-item .audit-head { display: flex; align-items: center; gap: 8px; }
.audit-item .audit-action { font-family: var(--mono); font-size: 11.5px; color: var(--accent-soft); }
.audit-item .audit-time { margin-left: auto; font-size: 11px; color: var(--muted-2); font-family: var(--mono); }
.audit-item .audit-detail { font-family: var(--mono); font-size: 11px; color: var(--muted-2); word-break: break-all; }

.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  max-width: 380px; padding: 10px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  box-shadow: var(--shadow); font-size: 13px; animation: toast-in .18s ease-out;
}
.toast.success { border-color: rgba(61, 220, 151, .4); }
.toast.error { border-color: rgba(255, 107, 107, .45); color: #ffc9c9; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .82); display: flex; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: var(--shadow); background: #111; }
.upload-hint { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 65; background: var(--panel-2); border: 1px solid var(--accent); color: var(--text); padding: 8px 16px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 190px 300px minmax(0, 1fr); }
  .names-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 170px 250px minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { display: none; }
  .list-pane { max-height: 240px; border-right: none; border-bottom: 1px solid var(--line); }
  .names-grid { grid-template-columns: 1fr; }
  .topbar { gap: 4px; padding: 0 8px; }
  .topbar .btn { padding: 6px 8px; font-size: 12px; }
  .brand span:last-child { display: none; }
}
