:root {
  --bg: #f6f5f2;
  --paper: rgba(255, 255, 252, 0.9);
  --paper-solid: #fffefa;
  --paper-2: #f3f0ea;
  --ink: #1f211e;
  --muted: #77766d;
  --line: rgba(38, 36, 30, 0.11);
  --line-strong: rgba(38, 36, 30, 0.22);
  --accent: #0d6a5d;
  --accent-2: #ba6a3b;
  --accent-3: #2f5f8f;
  --accent-soft: #e4f1ed;
  --danger: #a84747;
  --shadow: 0 18px 54px rgba(42, 34, 24, 0.12);
  --shadow-soft: 0 8px 26px rgba(42, 34, 24, 0.08);
  --blur: blur(18px);

  /* Design tokens — declared for incremental adoption; existing rules are not changed */
  --z-base: 1;
  --z-rail: 20;
  --z-header: 80;
  --z-popover: 300;
  --z-modal: 1200;
  --z-toast: 1300;
  --ctrl-h-xs: 22px;
  --ctrl-h-sm: 26px;
  --ctrl-h-md: 32px;
  --ctrl-h-lg: 44px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --duration-fast: 0.12s;
  --duration-base: 0.16s;
  --duration-slow: 0.24s;
}

@font-face {
  font-family: "PingFang Local";
  src: url("./fonts/pingfang-regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PingFang Local";
  src: url("./fonts/pingfang-medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PingFang Local";
  src: url("./fonts/pingfang-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

body[data-prompt-profile="studio"] {
  --accent: #6f604f;
  --accent-2: #b9895f;
  --accent-soft: #efe7dc;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang Local", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.84), transparent 38%),
    linear-gradient(135deg, #f8f7f4 0%, #efebe3 100%);
  letter-spacing: 0;
  overflow: hidden;
}

body:not(.authenticated) .app {
  display: none;
}

body.authenticated .login-screen {
  display: none;
}

html[data-runtime="web"] [data-desktop-only] {
  display: none !important;
}

/* ===== 登录与全局基础 ==== */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 18%, rgba(122, 98, 64, 0.10), transparent 28%),
    linear-gradient(135deg, #f8f5ef, #ede7dc);
}

.login-card {
  width: min(420px, 92vw);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(42, 34, 24, 0.10);
  border-radius: 12px;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 30px 90px rgba(42, 34, 24, 0.14);
  backdrop-filter: blur(18px);
}

.login-brand {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.login-brand strong {
  font-size: 22px;
  letter-spacing: 0.16em;
}

.login-brand span {
  color: var(--muted);
  font-size: 13px;
}

#loginErrorText {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}

.login-remember input {
  width: auto;
}

.login-library-mode {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(42, 34, 24, 0.10);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.56);
}

.login-library-mode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.login-library-mode-head strong {
  color: var(--ink);
}

.login-library-mode-head span {
  color: var(--muted);
}

.login-library-toggle {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.login-library-toggle button {
  min-width: 0;
  padding: 0 10px;
}

button, input, select, textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 0 11px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  border-color: var(--line-strong);
  background: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
button:active { transform: translateY(0); box-shadow: none; }
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
  box-shadow: none !important;
}
button.primary {
  width: 100%;
  min-height: 44px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
button:not(.primary):not(.danger):not(.active):not(.plain-close):not(.viewer-close):not(#taskDockCloseBtn) {
  border-color: var(--line);
  color: var(--ink);
}
button.primary.inline { width: auto; }
button.danger { color: var(--danger); border-color: #d9b8b8; }
button.active, .chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.dark-action,
.quick-angle-btn,
.free-actions > button,
/* ===== 提示词编辑 ==== */
.prompt-field > button,
.free-ratio-btn.active,
.profile-switch button.active{
  color: #fff !important;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 310px minmax(520px, 1fr) 360px;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "header header header"
    "left stage right";
  transition: grid-template-columns 0.24s ease;
}

/* ===== 应用头部 ==== */
.app-header {
  grid-area: header;
  position: relative;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 252, 0.9);
  backdrop-filter: var(--blur);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand {
  position: relative;
  z-index: 2;
  height: 100%;
}
.brand strong { font-size: 16px; letter-spacing: 0.08em; }
.brand span { color: var(--muted); font-size: 13px; }
.header-actions {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.header-main-tabs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 38px;
  padding: 3px;
  border: 1px solid rgba(22, 22, 20, 0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
  pointer-events: auto;
}
.header-main-tabs::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  top: 3px;
  width: var(--header-active-w, 0px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: #161614;
  box-shadow: 0 10px 22px rgba(22, 22, 20, 0.12);
  transform: translateX(var(--header-active-x, 3px));
  transition: transform 0.24s ease, width 0.24s ease, opacity 0.18s ease;
  opacity: var(--header-active-opacity, 1);
}
.header-main-tabs button {
  position: relative;
  z-index: 1;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  color: #5d554d;
  background: transparent;
  white-space: nowrap;
  box-shadow: none;
}
.header-main-tabs button:hover {
  color: #161614;
  background: rgba(246, 243, 238, 0.92);
}
.header-main-tabs button.active {
  color: #fff !important;
  background: transparent !important;
  box-shadow: none !important;
}
.header-main-tabs button.active:hover {
  color: #fff !important;
  background: transparent !important;
}
.header-tool-links {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9a938b;
  white-space: nowrap;
  pointer-events: auto;
}
.header-tool-links button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #5f5750;
  background: transparent;
  box-shadow: none;
}
.header-tool-links button:hover {
  color: #161614;
  background: transparent;
}
body.detail-mode .canvas-toolbar {
  display: none;
}

body.detail-mode .app-header {
  justify-content: flex-start;
}

/* ===== 左右轨道布局 ==== */
.left-rail, .right-rail {
  min-width: 0;
  overflow: auto;
  padding: 16px;
  background: rgba(255, 253, 248, 0.46);
  backdrop-filter: var(--blur);
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: padding 0.24s ease, opacity 0.18s ease, border-color 0.18s ease;
}
.left-rail::-webkit-scrollbar, .right-rail::-webkit-scrollbar { width: 0; height: 0; }
.left-rail {
  grid-area: left;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.left-rail > .rail-section {
  flex: 0 0 auto;
}
.right-rail {
  grid-area: right;
  border-left: 1px solid var(--line);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  padding-top: 6px;
  padding-bottom: 16px;
}
.right-rail .generate-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  margin-bottom: 0;
  gap: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.right-rail .generate-panel::-webkit-scrollbar { width: 0; height: 0; }
.right-rail .generate-panel > .section-title {
  grid-row: 1;
  position: relative;
  z-index: 25;
  min-height: 20px;
  margin: -4px -2px 2px;
  padding: 0 2px;
  background: rgba(255,253,248,0.98);
  backdrop-filter: blur(14px);
}
body.detail-mode .right-rail .generate-panel > .section-title {
  margin-bottom: 0;
}
.right-rail .detail-work-tabs {
  grid-row: 2;
  position: relative;
  top: 0;
  z-index: 24;
  margin-bottom: 5px;
  background: rgba(255,253,248,0.98);
  backdrop-filter: blur(14px);
}
.right-rail #generateControlsPanel,
.right-rail #detailInspectorPanel,
.right-rail #agentSidePanel,
.right-rail #detailReviewDock {
  grid-row: 3;
  min-height: 0;
}
.right-rail #generateControlsPanel {
  overflow: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.right-rail #generateControlsPanel::-webkit-scrollbar { width: 0; height: 0; }

body.left-collapsed .app { grid-template-columns: 0 minmax(520px, 1fr) 360px; }
body.right-collapsed .app { grid-template-columns: 310px minmax(520px, 1fr) 0; }
body.left-collapsed.right-collapsed .app { grid-template-columns: 0 minmax(520px, 1fr) 0; }
body.left-collapsed .left-rail,
body.right-collapsed .right-rail {
  padding-inline: 0;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.rail-handle {
  position: fixed;
  z-index: 60;
  top: 78px;
  width: 22px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(38, 36, 30, 0.08);
  background: rgba(255, 255, 252, 0.56);
  color: rgba(38, 36, 30, 0.54);
  border-radius: 0 999px 999px 0;
  box-shadow: 0 12px 30px rgba(42, 34, 24, 0.07);
  backdrop-filter: blur(18px);
  font-size: 18px;
  line-height: 1;
}
.rail-handle:hover {
  color: var(--ink);
  background: rgba(255, 255, 252, 0.9);
  box-shadow: 0 16px 34px rgba(42, 34, 24, 0.1);
}
.rail-handle-left {
  left: 310px;
  transform: translateX(-35%);
}
.rail-handle-right {
  right: 360px;
  transform: translateX(35%);
  border-radius: 999px 0 0 999px;
}
body.left-collapsed .rail-handle-left { left: 0; transform: translateX(16%); }
body.right-collapsed .rail-handle-right { right: 0; transform: translateX(-16%); }
.rail-handle-left:hover { transform: translateX(-20%); }
.rail-handle-right:hover { transform: translateX(20%); }
body.left-collapsed .rail-handle-left:hover { transform: translateX(16%); }
body.right-collapsed .rail-handle-right:hover { transform: translateX(-16%); }

.rail-section {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
}
body.detail-mode .right-rail .generate-panel {
  padding: 10px 10px 12px;
}
.compact-section p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.compact-section {
  z-index: 30;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.section-title h2 {
  margin: 0;
  font-size: 14px;
}
.section-title span {
  color: var(--muted);
  font-size: 12px;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 118px;
  padding: 16px;
  border: 1px dashed #b9ad9b;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.62), rgba(251,248,242,0.88));
  text-align: center;
  cursor: pointer;
}
.drop-zone.small { min-height: 82px; margin-bottom: 10px; }
.drop-zone input { display: none; }
.drop-zone small { display: block; color: var(--muted); margin-top: 5px; }
.drop-zone.busy,
.send-ref-panel.busy {
  position: relative;
  pointer-events: none;
  border-color: rgba(125, 103, 73, 0.55);
  box-shadow: inset 0 0 0 1px rgba(125, 103, 73, 0.12), 0 14px 34px rgba(61, 48, 31, 0.08);
}
.drop-zone.busy > *,
.send-ref-panel.busy > * {
  opacity: 0.24;
}
.drop-zone.busy::after,
.send-ref-panel.busy::after,
/* ===== 画布工作区 ==== */
.canvas-viewport.busy::after {
  content: attr(data-busy);
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  min-width: 150px;
  padding: 10px 16px 10px 38px;
  border-radius: 999px;
  color: #fff;
  background: rgba(34, 30, 24, 0.84);
  box-shadow: 0 18px 46px rgba(48, 38, 24, 0.18);
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.drop-zone.busy::before,
.send-ref-panel.busy::before,
.canvas-viewport.busy::before {
  content: "";
  position: absolute;
  left: calc(50% - 62px);
  top: 50%;
  z-index: 21;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.34);
  border-top-color: #fff;
  animation: spin 0.78s linear infinite;
}

.thumb-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}
/* ===== 产品库 ==== */
.product-card-drop {
  margin-top: 10px;
}
.product-info-card-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.product-info-card-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 10px;
  background: rgba(255,255,252,0.74);
}
.product-info-card-item strong,
.product-info-card-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-info-card-item strong {
  font-size: 12px;
}
.product-info-card-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.product-info-card-item button {
  min-height: 26px;
  padding: 0 7px;
  border-radius: 8px;
}
.hidden-reference-list {
  display: none !important;
}
.product-draft-thumb {
  position: relative;
}
.product-draft-thumb footer {
  align-items: stretch;
  flex-direction: column;
}
.product-draft-thumb footer > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-draft-thumb.dragging {
  opacity: 0.55;
}
.product-draft-thumb.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 106, 93, 0.12);
}
.draft-order {
  position: absolute;
  left: 7px;
  top: 7px;
  z-index: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(32, 27, 22, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  backdrop-filter: blur(8px);
}
.draft-thumb-actions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 4px;
}
.draft-thumb-actions button {
  min-height: 24px;
  padding: 0 6px;
  font-size: 11px;
}
.draft-thumb-actions button:disabled {
  cursor: default;
}
.draft-desc-input {
  width: calc(100% - 12px);
  min-height: 28px;
  margin: 6px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 11px;
  background: rgba(255,255,255,0.9);
}
.danger-mini {
  color: #9a3d2f;
  border-color: rgba(154, 61, 47, 0.22);
}
.product-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}
.selected-product {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.62);
  margin-bottom: 10px;
}
.selected-product img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 7px;
}
.selected-product strong, .selected-product span { display: block; }
.selected-product span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.canvas-nav-section {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  flex: 1 1 auto !important;
  min-height: 0;
  margin-bottom: 0;
  z-index: 1;
}
.canvas-create-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  color: #161614;
  background: rgba(255,255,255,0.78);
  font-weight: 700;
}
.side-canvas-list {
  display: grid;
  align-content: start;
  gap: 4px;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: none;
}
.side-canvas-list::-webkit-scrollbar { width: 0; height: 0; }
.side-canvas-row {
  display: grid;
  grid-template-columns: 1fr 28px 28px;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 10px;
}
.side-canvas-row.active {
  border-color: rgba(38,36,30,0.08);
  background: rgba(255,255,255,0.58);
}
.side-canvas-row.focused {
  border-color: rgba(116,99,75,0.20);
  background: rgba(255,255,255,0.86);
  box-shadow: 0 14px 34px rgba(42,34,24,0.12), inset 0 1px 0 rgba(255,255,255,0.78);
  transform: translateY(-1px);
}
.side-canvas-name {
  min-width: 0;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
.side-canvas-name:hover {
  background: rgba(116,99,75,0.08);
  box-shadow: none;
  transform: none;
}
.side-canvas-icon {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 8px;
}
.side-canvas-icon.danger {
  color: var(--danger);
}
.canvas-side-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.canvas-side-actions button:first-child {
  grid-column: 1 / -1;
}
.product-library {
  display: grid;
  gap: 12px;
  max-height: 68vh;
  overflow: auto;
}
.product-library-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 220px;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.product-category h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 9px;
}
.product-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.72);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.product-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: #fff;
}
.product-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 9px;
  background: #e8e1d6;
}
.empty-mini {
  padding: 16px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
}
.product-card strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.edit-product-btn {
  min-height: 28px;
  padding: 0 8px;
  color: var(--accent);
  border-color: rgba(13, 106, 93, 0.24);
  background: rgba(255,255,255,0.72);
}
.delete-product-btn {
  min-height: 28px;
  padding: 0 8px;
  color: #9a3d2f;
  border-color: rgba(154, 61, 47, 0.22);
  background: rgba(255,255,255,0.72);
}
.product-selling-prompts {
  display: grid;
  gap: 10px;
  margin: 10px 0 14px;
}
.product-selling-prompts header {
  display: grid;
  gap: 3px;
}
.product-selling-prompts strong {
  font-size: 13px;
}
.product-selling-prompts span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.field-lock-head,
.selling-point-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.field-lock-btn {
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  color: #7b7267;
  border-color: rgba(119, 107, 91, 0.2);
  background: rgba(255,255,255,0.72);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.field-lock-btn:hover {
  color: #161614;
  border-color: rgba(13, 106, 93, 0.28);
  background: rgba(238, 246, 242, 0.86);
}
.field-lock-btn.locked {
  color: var(--accent);
  border-color: rgba(13, 106, 93, 0.34);
  background: rgba(230, 242, 238, 0.9);
}
.field-lock-btn.small {
  min-height: 22px;
  padding-inline: 8px;
  font-size: 10px;
}
.locked-field-input,
.product-selling-prompt-grid label.locked input {
  color: #51483f;
  border-color: rgba(13, 106, 93, 0.25);
  background: rgba(238, 246, 242, 0.66);
}
.product-selling-prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.product-selling-prompt-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.product-selling-prompt-grid em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}
.product-selling-prompt-grid input {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.82);
  font: inherit;
  font-size: 12px;
}
.product-selling-prompt-grid input.active {
  border-color: rgba(13, 106, 93, 0.58);
  background: rgba(230, 242, 238, 0.62);
}
.thumb {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.thumb footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px;
  color: var(--muted);
  font-size: 11px;
}
.thumb button {
  min-height: 24px;
  padding: 0 7px;
  font-size: 12px;
}

.stage-wrap {
  grid-area: stage;
  position: relative;
  display: grid;
  grid-template-rows: 1fr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.stage-selection-tools {
  position: absolute;
  right: 18px;
  top: 14px;
  z-index: 9;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.stage-selection-tools .selection-group {
  pointer-events: auto;
  background: rgba(255, 253, 248, 0.76);
  border-color: rgba(38, 36, 30, 0.08);
  box-shadow: 0 14px 34px rgba(42, 34, 24, 0.08);
  backdrop-filter: blur(18px);
}
.stage-selection-tools .selection-group button.active,
.stage-selection-tools .selection-group #multiSelectBtn.active {
  color: #fff;
  background: #161614;
  border-color: #161614;
}
.canvas-toolbar {
  display: none !important;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
  overflow: visible;
}
.canvas-toolbar strong:not(.top-task-progress strong) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.canvas-toolbar span {
  color: var(--muted);
  font-size: 12px;
}
.canvas-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: min(100%, 560px);
  justify-content: center;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
}
.canvas-actions::-webkit-scrollbar { width: 0; height: 0; }
.toolbar-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
  min-width: 0;
  height: 32px;
  padding: 2px;
  border: 1px solid rgba(38, 36, 30, 0.075);
  border-radius: 12px;
  background: rgba(255, 255, 252, 0.66);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.66), 0 8px 20px rgba(42, 34, 24, 0.045);
  flex-shrink: 0;
}
.toolbar-group > * {
  flex: 0 0 auto;
}
.toolbar-group button {
  min-height: 26px;
  padding-inline: 8px;
  border-radius: 9px;
  white-space: nowrap;
  box-shadow: none;
  background: rgba(255,255,252,0.54);
}
.toolbar-group button:hover {
  box-shadow: none;
}
.canvas-group {
  flex: 0 0 auto;
  min-width: 0;
  max-width: min(32vw, 360px);
}
.zoom-group,
.selection-group {
  flex: 0 0 auto;
}
.canvas-manager-entry,
/* ===== 批量生成 ==== */
.batch-main-entry {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 11px;
  padding-inline: 13px;
  color: #fff !important;
  background: #161614 !important;
  border-color: #161614 !important;
  box-shadow: 0 10px 22px rgba(22, 22, 20, 0.12) !important;
}
.canvas-actions #zoomLabel {
  min-width: 38px;
  text-align: center;
  color: var(--ink);
  font-weight: 700;
}

.native-select-hidden {
  display: none !important;
}

.custom-select-shell,
.canvas-picker,
.canvas-title-pill {
  position: relative;
  min-width: 0;
}
.custom-select-shell.open {
  z-index: var(--z-modal);
}

.canvas-title-pill {
  width: clamp(150px, 18vw, 280px);
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 10px;
  border: 1px solid rgba(38, 36, 30, 0.1);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,252,0.96), rgba(248,245,238,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
}

.canvas-title-pill strong {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--ink);
}

.canvas-edit-btn {
  flex: 0 0 24px !important;
  width: 22px;
  min-height: 22px !important;
  padding: 0 !important;
  display: grid;
  place-items: center;
  color: #6f604a;
  background: rgba(116, 99, 75, 0.08);
}

.canvas-edit-btn:hover {
  color: #fff;
  background: #73634a;
}

.field .custom-select-shell,
label.field .custom-select-shell {
  width: 100%;
}

.toolbar-group .custom-select-shell {
  flex: 0 0 auto;
}

.custom-select-button,
#canvasPickerBtn {
  position: relative;
  width: 100%;
  min-height: 32px;
  justify-content: space-between;
  border-radius: 10px;
  border-color: rgba(38, 36, 30, 0.11);
  background: linear-gradient(180deg, rgba(255,255,252,0.96), rgba(248,245,238,0.92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
  color: var(--ink);
  text-align: left;
}

#canvasPickerBtn {
  width: clamp(150px, 15vw, 210px);
  min-height: 27px;
  padding-right: 28px;
}

.custom-select-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px 0 11px;
}

.custom-select-button span,
#canvasPickerBtn {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-button::after,
#canvasPickerBtn::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-62%) rotate(45deg);
  opacity: 0.58;
}

.custom-select-shell.open .custom-select-button::after,
.canvas-picker.open #canvasPickerBtn::after {
  transform: translateY(-30%) rotate(225deg);
}

.custom-select-menu,
.canvas-picker-menu {
  position: absolute;
  z-index: var(--z-modal);
  top: calc(100% + 7px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(320px, 70vw);
  max-height: 310px;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(38, 36, 30, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 252, 0.96);
  box-shadow: 0 24px 58px rgba(42, 34, 24, 0.16);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}

.custom-select-menu::-webkit-scrollbar,
.canvas-picker-menu::-webkit-scrollbar { width: 0; height: 0; }

.custom-select-menu button,
.canvas-picker-menu button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  text-align: left;
  white-space: nowrap;
}

.custom-select-menu button:hover,
.canvas-picker-menu button:hover {
  transform: none;
  background: rgba(116, 99, 75, 0.09);
  box-shadow: none;
}

.custom-select-menu button.active,
.canvas-picker-menu button.active {
  background: #73634a;
  color: #fff;
  font-weight: 700;
}

.canvas-picker-menu span {
  color: inherit;
  opacity: 0.62;
}

.canvas-name-inline {
  width: 100%;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255,255,255,0.54);
  font-weight: 700;
  color: var(--ink);
}

.canvas-name-inline:focus {
  border-color: rgba(116, 99, 75, 0.38);
  background: #fff;
  outline: none;
}
#topTaskProgress.top-task-progress {
  position: fixed !important;
  top: auto !important;
  right: auto !important;
  left: 50% !important;
  bottom: 18px !important;
  z-index: var(--z-modal);
  transform: translateX(-50%) !important;
  width: clamp(360px, 42vw, 620px);
  display: grid;
  grid-template-columns: minmax(102px, auto) minmax(96px, 1fr) 44px;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border: 1px solid rgba(38, 36, 30, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 252, 0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.75), 0 8px 22px rgba(42, 34, 24, 0.055);
  backdrop-filter: blur(18px);
  pointer-events: none;
}
body.detail-mode #topTaskProgress.top-task-progress{
  position: fixed !important;
  top: auto !important;
  right: auto !important;
  left: 50% !important;
  bottom: 18px !important;
  z-index: var(--z-modal);
  transform: translateX(-50%) !important;
  width: clamp(360px, 42vw, 620px);
}
.top-task-progress[hidden] { display: none; }
.top-task-progress.done .top-progress-track i {
  width: 100%;
  transform: none;
  animation: none;
}
.top-progress-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.top-progress-copy strong {
  font-size: 11px;
  letter-spacing: 0.02em;
}
.top-progress-copy span {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-progress-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(38, 36, 30, 0.08);
}
.top-progress-track i {
  position: absolute;
  inset: 0;
  width: 44%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), #d8b16f);
  box-shadow: 0 0 16px rgba(13, 106, 93, 0.22);
  animation: progressWait 1.35s ease-in-out infinite;
}
.top-task-progress b {
  justify-self: end;
  color: var(--accent);
  font-size: 12px;
}
@keyframes progressWait {
  0% { transform: translateX(-115%); opacity: 0.55; }
  45% { opacity: 1; }
  100% { transform: translateX(255%); opacity: 0.55; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.canvas-viewport {
  overflow: hidden;
  position: relative;
  cursor: grab;
  background-color: #f4f0e9;
  background-image: radial-gradient(circle, rgba(58, 50, 38, 0.13) 0.6px, transparent 0.8px);
  background-size: 18px 18px;
}
.canvas-viewport.dragging { cursor: grabbing; }
.canvas-viewport.file-over::after {
  content: "\677e\5f00\5bfc\5165\5230\5f53\524d\753b\5e03" !important;
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border: 1px solid rgba(116, 99, 75, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(22, 22, 20, 0.82);
  box-shadow: 0 18px 48px rgba(42, 34, 24, 0.18);
  pointer-events: none;
}
.canvas-plane {
  position: absolute;
  left: 0;
  top: 0;
  width: 2600px;
  height: 1800px;
  transform-origin: 0 0;
}
.empty-state {
  display: none !important;
}

body.detail-mode .stage-selection-tools,
body.detail-mode .canvas-viewport {
  display: none;
}

body.detail-mode .detail-viewport {
  display: grid !important;
}

.project-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.project-head-actions button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  white-space: nowrap;
}

body.detail-mode .canvas-nav-section {
  display: none;
}

/* ===== 详情套版工作流 ==== */
.detail-left-section {
  flex: 1 1 auto !important;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.detail-left-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,252,0.72);
}

.detail-left-tabs button {
  min-height: 30px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.detail-left-tabs button.active {
  color: #fff;
  background: #161614;
}

.detail-left-content {
  min-height: 0;
  overflow: auto;
  padding-top: 12px;
  scrollbar-width: none;
}

.detail-left-content::-webkit-scrollbar { width: 0; height: 0; }

.detail-library-list,
.detail-gallery-grid,
.detail-preset-list {
  display: grid;
  gap: 8px;
}

.detail-create-project-btn {
  min-height: 34px;
  border-radius: 10px;
  background: rgba(255,255,252,0.82);
  box-shadow: none;
  font-weight: 700;
}

.detail-template-card,
.detail-project-card,
.detail-preset-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,252,0.78);
}

.detail-project-card {
  gap: 6px;
  min-height: 38px;
  padding: 9px 10px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.detail-template-card.active,
.detail-project-card.active {
  border-color: rgba(13, 106, 93, 0.34);
  background: rgba(230, 242, 238, 0.68);
  box-shadow: inset 0 0 0 1px rgba(13,106,93,0.05);
}

.detail-project-card:not(.active):hover {
  border-color: rgba(38,36,30,0.18);
  background: rgba(255,255,252,0.96);
  transform: translateY(-1px);
}

.detail-project-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.detail-project-card-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.detail-project-card-main span {
  color: var(--accent);
  font-size: 11px;
}

.detail-project-card-meta {
  color: var(--muted);
  font-size: 11px;
}

.detail-project-actions {
  display: flex;
  gap: 6px;
  padding-top: 2px;
}

.detail-project-actions button {
  width: 30px;
  min-height: 28px;
  padding: 0;
  border-radius: 9px;
  background: rgba(255,255,252,0.78);
  box-shadow: none;
  font-size: 13px;
  line-height: 1;
}

.detail-project-status-dot {
  justify-self: end;
  max-width: 82px;
  padding: 2px 7px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  border-radius: 999px;
  background: rgba(255,255,252,0.72);
  color: var(--muted) !important;
  font-size: 10px !important;
  line-height: 1.35;
  white-space: nowrap;
}

.detail-project-status-dot.active {
  border-color: rgba(13,106,93,0.20);
  background: rgba(228,242,238,0.86);
  color: var(--accent) !important;
}

.detail-project-status-dot.ai-running {
  border-color: rgba(176,127,58,0.24);
  background: rgba(255,245,229,0.92);
  color: #9a6a2b !important;
}

.detail-project-status-dot.ai-draft {
  border-color: rgba(91,111,168,0.22);
  background: rgba(236,240,252,0.92);
  color: #4e6097 !important;
}

.detail-project-status-dot.done {
  border-color: rgba(38,36,30,0.14);
  background: rgba(239,236,229,0.92);
  color: #716858 !important;
}

#detailCompleteBtn[data-workflow-status="done"] {
  border-color: rgba(38,36,30,0.14);
  background: rgba(239,236,229,0.86);
  color: #5f574b;
}

#detailCompleteBtn[data-workflow-status="ai-running"] {
  border-color: rgba(176,127,58,0.24);
  background: rgba(255,245,229,0.92);
  color: #9a6a2b;
}

.archive-list,
.favorite-list {
  display: grid;
  gap: 12px;
}

.archive-dialog-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

#archiveDialog.wide-dialog {
  width: calc(100vw - 24px);
  max-width: none;
  height: calc(100vh - 24px);
  max-height: none;
  margin: 12px auto;
  border-radius: 20px;
}

#archiveDialog .dialog-body {
  height: 100%;
  padding: 18px 20px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

#archiveDialog .dialog-body > header {
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.archive-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.archive-filters {
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid rgba(38,36,30,0.10);
  border-radius: 999px;
  background: rgba(255,255,252,0.74);
  overflow-x: auto;
  scrollbar-width: none;
}

.archive-filters::-webkit-scrollbar { width: 0; height: 0; }

.archive-filters button {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
}

.archive-filters button.active {
  border-color: #161614;
  background: #161614;
  color: #fff;
}

#archiveSearchInput {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(38,36,30,0.10);
  border-radius: 12px;
  background: rgba(255,255,252,0.88);
  padding: 0 12px;
}

.archive-workbench {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 12px;
}

.archive-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px;
  align-content: start;
  overflow: auto;
  padding: 2px 6px 2px 0;
  scrollbar-width: thin;
}

.archive-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  min-height: 86px;
  padding: 7px 8px;
  border: 1px solid rgba(38,36,30,0.10);
  border-radius: 10px;
  background: rgba(255,255,252,0.76);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.archive-card-thumb {
  width: 48px;
  height: 68px;
  align-self: center;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 8px;
  background: #eee8dd;
  color: var(--muted);
  font-size: 10px;
}

.archive-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.archive-card-copy {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 3px auto;
  gap: 4px;
}

.archive-card:hover {
  border-color: rgba(13,106,93,0.22);
  background: rgba(255,255,252,0.96);
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(42,34,24,0.08);
}

.archive-card.active {
  border-color: rgba(13,106,93,0.34);
  background: rgba(230,242,238,0.70);
  box-shadow: inset 0 0 0 1px rgba(13,106,93,0.05);
}

.archive-card-main,
.archive-card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}

.archive-card-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.archive-card-main div span {
  display: none;
}

.archive-card-main span,
.archive-card-meta span,
.favorite-card span {
  color: var(--muted);
  font-size: 9px;
}

.archive-card-meta span:first-child {
  display: none;
}

.archive-card-meta span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-status {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid rgba(38,36,30,0.10);
  background: rgba(255,255,252,0.82);
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  white-space: nowrap;
}

.archive-status.active {
  border-color: rgba(13,106,93,0.18);
  background: rgba(228,242,238,0.90);
  color: var(--accent);
}

.archive-status.ai-running {
  border-color: rgba(176,127,58,0.24);
  background: rgba(255,245,229,0.94);
  color: #9a6a2b;
}

.archive-status.ai-draft {
  border-color: rgba(91,111,168,0.22);
  background: rgba(236,240,252,0.94);
  color: #4e6097;
}

.archive-status.done {
  border-color: rgba(38,36,30,0.14);
  background: rgba(239,236,229,0.94);
  color: #716858;
}

.archive-progress,
.archive-detail-progress {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(38,36,30,0.08);
}

.archive-progress i,
.archive-detail-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #c9a46a);
}

.archive-card-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-self: end;
  opacity: 0.42;
  transition: opacity 0.16s ease;
}

.archive-card:hover .archive-card-actions,
.archive-card.active .archive-card-actions {
  opacity: 1;
}

.archive-card-actions button {
  width: 19px;
  min-width: 19px;
  min-height: 19px;
  padding: 0;
  border-radius: 6px;
  background: rgba(255,255,252,0.78);
  box-shadow: none;
  font-size: 10px;
}

.archive-detail-panel {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(38,36,30,0.10);
  border-radius: 18px;
  background: rgba(255,255,252,0.78);
}

.archive-detail-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
}

.archive-detail-top .eyebrow {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.archive-detail-top h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  margin: 0;
}

.archive-detail-cover {
  min-height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 14px;
  background: #f1ece3;
}

.archive-detail-cover img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 13px;
}

.archive-detail-cover span,
.archive-detail-empty {
  color: var(--muted);
  font-size: 12px;
}

.archive-detail-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.archive-detail-facts div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.archive-detail-facts dt {
  color: var(--muted);
  font-size: 11px;
}

.archive-detail-facts dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.archive-detail-note {
  margin: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(244,240,233,0.72);
  color: #6f6557;
  font-size: 12px;
  line-height: 1.55;
}

.archive-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.archive-detail-actions .primary {
  grid-column: 1 / -1;
}

.archive-detail-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(38,36,30,0.12);
  border-radius: 16px;
}

.favorite-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,252,0.78);
}

.favorite-card span {
  color: var(--muted);
  font-size: 12px;
}

.favorite-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.favorite-list {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.favorite-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  background: #eee8dc;
}

.favorite-card > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 12px;
  background: rgba(255,255,252,0.74);
}

.detail-gallery-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.detail-gallery-head strong {
  font-size: 12px;
}

.detail-gallery-head span {
  color: var(--muted);
  font-size: 11px;
}

.detail-gallery-head button {
  min-height: 28px;
  padding: 0 10px;
  white-space: nowrap;
}

.detail-gallery-grid {
  grid-template-columns: repeat(3, minmax(54px, 1fr));
  gap: 6px;
  overflow: hidden;
}

.detail-gallery-item {
  position: relative;
  min-width: 0;
  padding: 3px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  border-radius: 8px;
  background: rgba(255,255,252,0.78);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  overflow: hidden;
}

.detail-gallery-open {
  position: absolute;
  right: 6px;
  top: 6px;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,252,0.66);
  background: rgba(22,22,20,0.72);
  color: #fff;
  font-size: 10px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.detail-gallery-item:hover .detail-gallery-open {
  opacity: 1;
  transform: translateY(0);
}

.detail-gallery-item:hover {
  border-color: rgba(13,106,93,0.38);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(42,34,24,0.10);
}

.detail-gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 7px;
}

.detail-gallery-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-gallery-preview {
  position: fixed;
  z-index: 300;
  width: 250px;
  padding: 8px;
  border: 1px solid rgba(38,36,30,0.12);
  border-radius: 14px;
  background: rgba(255,255,252,0.94);
  box-shadow: 0 24px 70px rgba(42,34,24,0.18);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.detail-gallery-preview.show {
  opacity: 1;
  transform: translateY(0);
}

.detail-gallery-preview img {
  display: block;
  width: 100%;
  max-height: 310px;
  object-fit: contain;
  border-radius: 10px;
  background: #f4f0e9;
}

.detail-gallery-preview span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.detail-material-item {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(38,36,30,0.10);
  border-radius: 12px;
  background: rgba(255,255,252,0.78);
}

.detail-material-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 9px;
  background: #f4f0e9;
}

.detail-material-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.detail-material-item div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.detail-material-item button {
  min-height: 26px;
  padding: 0 6px;
  font-size: 11px;
}

.detail-preset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-material-drawer {
  position: fixed;
  left: 330px;
  right: 410px;
  bottom: 22px;
  z-index: 280;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(42,34,24,0.12);
  border-radius: 20px;
  background: rgba(255,255,252,0.94);
  box-shadow: 0 26px 80px rgba(42,34,24,0.20);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.detail-material-drawer.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.detail-material-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-material-drawer-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-material-drawer-head > div:first-child {
  display: grid;
  gap: 2px;
}

.detail-material-drawer-head span {
  color: var(--muted);
  font-size: 12px;
}

.detail-material-strip {
  display: flex;
  gap: 12px;
  min-height: 178px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.detail-material-tile {
  flex: 0 0 142px;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(38,36,30,0.10);
  border-radius: 14px;
  background: rgba(255,255,252,0.82);
  box-shadow: 0 12px 32px rgba(42,34,24,0.08);
  cursor: grab;
}

.detail-material-tile:active {
  cursor: grabbing;
}

.detail-material-tile img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  background: #f2ede3;
}

.detail-material-tile strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.detail-material-tile div {
  display: grid;
  grid-template-columns: 1fr 42px 42px;
  gap: 5px;
}

.detail-material-tile button {
  min-height: 26px;
  padding: 0 6px;
  font-size: 11px;
}

.detail-insert-marker {
  position: absolute;
  z-index: 35;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #c99a58 12%, #fff3c8 48%, #a66d34 88%, transparent);
  box-shadow: 0 0 0 1px rgba(255,255,252,0.85), 0 0 24px rgba(201,154,88,0.65);
  opacity: 0;
  pointer-events: none;
  transform: scaleX(0.74);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.detail-insert-marker.show {
  opacity: 1;
  transform: scaleX(1);
}

.detail-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  grid-template-rows: auto 1fr;
  background-color: #f4f0e9;
  background-image: radial-gradient(circle, rgba(58, 50, 38, 0.12) 0.6px, transparent 0.8px);
  background-size: 18px 18px;
  scrollbar-width: none;
  cursor: grab;
}

.detail-viewport.with-minimap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  column-gap: 8px;
  align-items: start;
}

.detail-viewport::-webkit-scrollbar { width: 0; height: 0; }

.detail-viewport.dragging {
  cursor: grabbing;
}

.detail-stage-head {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,252,0.76);
  backdrop-filter: blur(18px);
}

.detail-viewport.with-minimap .detail-stage-head {
  grid-column: 1 / -1;
}

.detail-stage-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-stage-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.detail-stage-head > div {
  display: flex;
  gap: 6px;
}

.detail-export-menu {
  position: relative;
  display: inline-flex;
}

.detail-export-menu-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 40;
  min-width: 132px;
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid rgba(38, 36, 30, 0.12);
  border-radius: 12px;
  background: rgba(255,255,252,0.96);
  box-shadow: 0 18px 42px rgba(42, 34, 24, 0.14);
  backdrop-filter: blur(18px);
}

.detail-export-menu-panel button {
  justify-content: flex-start;
  text-align: left;
  box-shadow: none;
}

.detail-export-menu-panel button:hover {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  transform: none;
}

.detail-review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}
.batch-image-quality {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 3px 6px 3px 8px;
  border: 1px solid rgba(38, 36, 30, 0.1);
  border-radius: 11px;
  background: rgba(255,255,255,0.76);
  white-space: nowrap;
}
.batch-image-quality > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-review-badge.pending {
  border-color: rgba(147, 95, 42, 0.22);
  background: rgba(252, 241, 218, 0.84);
  color: #8a5b24;
}

.detail-review-badge.changes {
  border-color: rgba(180, 75, 58, 0.22);
  background: rgba(255, 235, 230, 0.84);
  color: #9b4032;
}

.detail-review-badge.approved {
  border-color: rgba(13, 106, 93, 0.22);
  background: rgba(221, 242, 235, 0.86);
  color: var(--accent);
}

.detail-screen-stack {
  display: grid;
  justify-content: center;
  gap: 0;
  min-width: max-content;
  padding: 36px 84px 96px;
}

.detail-viewport.with-minimap .detail-screen-stack {
  grid-column: 1;
}

.detail-screen-stack.main-screen-stack {
  justify-content: start;
  align-content: start;
  gap: 42px;
  padding: 56px 72px 110px;
}

.main-screen-row {
  display: grid;
  gap: 0;
  min-width: max-content;
  padding-top: 26px;
}

.main-screen-row-title {
  display: none;
}

.main-screen-row-items {
  display: flex;
  align-items: flex-start;
  gap: 30px;
  min-width: max-content;
}

.detail-screen-card {
  position: relative;
  margin: 0 auto;
  border: 1px solid transparent;
  background: #faf8f2;
  box-shadow: 0 24px 72px rgba(42,34,24,0.11);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.detail-screen-card.selected {
  outline: 0;
  box-shadow: 0 54px 130px rgba(42,34,24,0.22), 0 22px 60px rgba(42,34,24,0.13);
  transform: translateY(-7px);
}

.detail-screen-inner {
  position: absolute;
  left: 0;
  top: 0;
  width: 1200px;
  transform-origin: top left;
  overflow: hidden;
}

.detail-screen-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.detail-screen-label {
  display: none;
}

.detail-screen-card:hover .detail-screen-label,
.detail-screen-card.selected .detail-screen-label {
  display: none;
}

.main-project-mode .detail-screen-label {
  left: 0;
  top: -25px;
  z-index: 6;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(42, 38, 31, 0.76);
  font-size: 12px;
  font-weight: 560;
  backdrop-filter: none;
  opacity: 1;
}

.detail-minimap {
  position: sticky;
  top: 72px;
  z-index: 16;
  grid-column: 2;
  width: 58px;
  margin: 14px 8px 0 0;
  border: 1px solid rgba(42,34,24,0.13);
  border-radius: 14px;
  background: rgba(255,255,252,0.72);
  box-shadow: 0 18px 42px rgba(42,34,24,0.14);
  backdrop-filter: blur(16px);
  overflow: hidden;
  cursor: ns-resize;
}

.detail-minimap-track {
  position: relative;
  width: 100%;
}

.detail-minimap-thumb {
  position: absolute;
  left: 7px;
  width: 46px;
  border-radius: 4px;
  overflow: hidden;
  background: #f8f5ee;
}

.detail-minimap-thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-minimap-board {
  position: absolute;
  transform-origin: 0 0;
  overflow: hidden;
}

.detail-minimap-slot,
.detail-minimap-fixed,
.detail-minimap-line,
.detail-minimap-text {
  position: absolute;
}

.detail-minimap-slot {
  overflow: hidden;
  background: rgba(125, 111, 86, 0.1);
}

.detail-minimap-slot img {
  width: 100%;
  height: 100%;
  display: block;
}

.detail-minimap-fixed {
  display: block;
}

.detail-minimap-text {
  overflow: hidden;
  box-sizing: border-box;
  opacity: 0.9;
}

.detail-minimap-dim {
  position: absolute;
  left: 0;
  width: 100%;
  background: rgba(0,0,0,0.3);
  pointer-events: none;
}

.detail-minimap-window {
  position: absolute;
  left: 4px;
  right: 4px;
  min-height: 18px;
  border: 1.5px solid rgba(154,101,49,0.88);
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(255,255,252,0.82), 0 8px 18px rgba(42,34,24,0.16);
  pointer-events: none;
}

.detail-image-slot,
.detail-line-slot,
.detail-text-slot {
  position: absolute;
}

.detail-image-slot {
  z-index: 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px solid rgba(13, 106, 93, 0);
  background: #ede7da;
  cursor: grab;
}

.detail-image-slot:hover,
.detail-image-slot.selected {
  border-color: rgba(13, 106, 93, 0.9);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.45), 0 0 0 2px rgba(13,106,93,0.1);
}

.detail-image-slot.empty {
  background: #ede7da;
  border-style: dashed;
  border-color: rgba(116,99,75,0.26);
  color: rgba(38,36,30,0.48);
  font-weight: 700;
}

.detail-image-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: none;
  max-height: none;
  user-select: none;
  pointer-events: none;
  transform-origin: center center;
}

.detail-image-slot.loading {
  border-color: rgba(116,99,75,0.18);
  background: #73634a;
}

.detail-image-slot.loading-delayed {
  border-color: rgba(154, 101, 49, 0.42);
  background: #e9dfcf;
  animation: placeholderBreath 5.5s ease-in-out infinite;
}

.detail-slot-waiting {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  font-style: normal;
  background:
    radial-gradient(circle at 18% 20%, rgba(251, 235, 190, 0.72), transparent 34%),
    radial-gradient(circle at 76% 66%, rgba(201, 163, 107, 0.52), transparent 39%),
    radial-gradient(circle at 48% 36%, rgba(255, 251, 234, 0.22), transparent 28%),
    linear-gradient(135deg, #6f5e45, #b99f74 48%, #705d43);
  background-size: 215% 215%;
  animation: placeholderBreath 6.2s ease-in-out infinite;
  filter: saturate(1.12);
}

.detail-text-slot {
  z-index: 6;
  padding: 0.08em 0;
  outline: 0;
  white-space: pre;
  word-break: keep-all;
  overflow: visible;
  text-shadow: none;
}

.detail-line-slot {
  z-index: 5;
  display: block;
  pointer-events: none;
}

.detail-fixed-image {
  position: absolute;
  z-index: 4;
  display: block;
  pointer-events: auto;
  cursor: move;
}

body.detail-mode:not(.detail-edit-tab) .detail-fixed-image {
  pointer-events: none;
  cursor: default;
}

.detail-fixed-image.selected {
  filter: drop-shadow(0 14px 24px rgba(42,34,24,0.28));
  outline: 1.5px solid rgba(13,106,93,0.78);
  outline-offset: 2px;
}

.detail-work-tabs {
  position: sticky;
  top: 0;
  z-index: 24;
  display: grid;
  grid-template-columns: minmax(54px, 0.8fr) minmax(76px, 1fr) minmax(76px, 1fr) auto;
  gap: 4px;
  min-height: 34px;
  padding: 2px;
  margin-bottom: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,252,0.86);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.detail-work-tabs button {
  min-width: 0;
  min-height: 28px;
  border: 0;
  background: transparent;
  box-shadow: none;
  white-space: nowrap;
  transform: none !important;
  padding: 0 8px;
}

.detail-work-tabs button:hover {
  box-shadow: none;
  transform: none !important;
}

.detail-work-tabs button.active {
  background: #161614;
  color: #fff;
}

.detail-text-slot:hover,
.detail-text-slot:focus,
.detail-text-slot.selected {
  box-shadow: inset 0 0 0 1.5px rgba(13,106,93,0.78);
  background: rgba(255,255,252,0.18);
}

.detail-candidate-rail {
  position: absolute;
  z-index: 8;
  left: -92px;
  top: 20px;
  display: grid;
  gap: 8px;
  width: 76px;
}

.detail-candidate-rail button {
  position: relative;
  width: 76px;
  min-height: 84px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(255,255,252,0.9);
}

.detail-candidate-rail img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 7px;
}

.detail-candidate-delete {
  position: absolute;
  right: -6px;
  top: -6px;
  z-index: 2;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #161614;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(42,34,24,0.18);
}

.detail-inspector {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(38,36,30,0.1);
  border-radius: 14px;
  background: rgba(255,255,252,0.72);
}

.detail-inspector h3 {
  margin: 0;
  font-size: 14px;
}

.detail-inspector small {
  color: var(--muted);
  line-height: 1.45;
}

.detail-inspector-actions,
.detail-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-inspector-actions button.featured,
.detail-slot-actions button.featured,
#detailAutoFillBtn,
#detailTemplateEditorOpenBtn {
  border-color: #161614 !important;
  background: #161614 !important;
  color: #fff !important;
}

.detail-slot-list {
  display: grid;
  gap: 7px;
}

.detail-slot-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.68);
}

.detail-slot-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

body.detail-mode.detail-edit-tab .generate-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: calc(100vh - 92px);
  overflow: hidden;
}

body.detail-mode.detail-edit-tab #detailInspectorPanel {
  min-height: 0;
  overflow: auto;
  padding-bottom: 96px;
  scrollbar-width: none;
}

body.detail-mode.detail-edit-tab #detailInspectorPanel::-webkit-scrollbar { width: 0; height: 0; }

.detail-text-editors {
  display: grid;
  gap: 8px;
}

.detail-text-editors textarea {
  min-height: 72px;
}

.detail-style-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(38,36,30,0.09);
  border-radius: 12px;
  background: rgba(255,255,252,0.66);
}

.detail-style-editor > strong {
  font-size: 12px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.style-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.style-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.style-grid input,
.style-grid select {
  min-width: 0;
  height: 34px;
  border-radius: 9px;
}

.detail-text-slot.draggable {
  cursor: move;
}

/* ===== 详情模板 ==== */
.template-editor-dialog {
  width: calc(100vw - 20px);
  max-width: none;
  height: calc(100vh - 20px);
  max-height: none;
  border-radius: 18px;
}

.template-editor-dialog .dialog-body {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  position: relative;
}

.template-editor-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 270px minmax(760px, 1fr) 390px;
  gap: 16px;
  overflow: hidden;
}

.template-editor-list,
.template-editor-fields {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,252,0.72);
  scrollbar-width: none;
}

.template-editor-list::-webkit-scrollbar,
.template-editor-fields::-webkit-scrollbar { width: 0; height: 0; }

.template-screen-list {
  display: grid;
  gap: 7px;
}

.template-screen-list button {
  height: auto;
  min-height: 52px;
  display: grid;
  justify-items: start;
  gap: 3px;
  padding: 8px 10px;
  text-align: left;
}

.template-screen-list button.active {
  background: #161614;
  color: #fff;
}

.template-screen-list small {
  color: inherit;
  opacity: 0.68;
}

.template-editor-preview {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.template-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,252,0.72);
}

.template-editor-canvas {
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle, rgba(58, 50, 38, 0.10) 0.6px, transparent 0.8px),
    #f4f0e9;
  background-size: 18px 18px;
}

.template-editor-artboard {
  position: relative;
  box-shadow: 0 24px 70px rgba(42,34,24,0.14);
}

.template-editor-inner {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: top left;
  overflow: hidden;
}

.template-editor-slot {
  position: absolute;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  text-align: center;
  transform: none !important;
  box-shadow: none !important;
  cursor: move;
}

.template-editor-slot.image {
  border: 2px dashed rgba(13,106,93,0.56);
  background: rgba(13,106,93,0.10);
  color: var(--accent);
  font-weight: 700;
}

.template-editor-slot.text {
  border: 1.5px solid rgba(136,96,56,0.48);
  background: rgba(255,255,252,0.52);
  display: flex;
  align-items: center;
  overflow: visible;
  line-height: 1.2;
  padding: 0.08em 0;
}

.template-editor-slot.line {
  border: 0;
  min-height: 2px;
  opacity: 0.82;
}

.template-editor-slot.fixed-image {
  overflow: hidden;
  border: 1.5px solid rgba(116,99,75,0.44);
  background: rgba(116,99,75,0.12);
}

.template-editor-slot.fixed-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.template-editor-slot.fixed-image span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(22,22,20,0.72);
  color: #fff;
  font-size: 11px;
}

.template-editor-slot.active {
  outline: 3px solid rgba(22,22,20,0.14);
  outline-offset: 5px;
}

.template-fixed-preview {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #f4f0e9;
  color: var(--muted);
}

.template-fixed-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
}

.color-field-grid {
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: end;
}

.color-field-grid input[type="color"] {
  width: 100%;
  min-height: 42px;
  padding: 5px;
}

.compact-copy-prompt textarea {
  min-height: 54px;
  resize: vertical;
}



.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
}

.image-card {
  position: absolute;
  width: 292px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  will-change: left, top;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}
.image-card:hover {
  filter: saturate(1.02) contrast(1.01);
  box-shadow: 0 22px 62px rgba(42, 34, 24, 0.18);
  border-color: #c8bcae;
}
.image-card.dragging {
  cursor: grabbing;
  opacity: 0.94;
  transition: none;
  box-shadow: 0 28px 76px rgba(42, 34, 24, 0.24);
}
.image-card.selected {
  border-color: rgba(13, 106, 93, 0.62);
  box-shadow: 0 0 0 1px rgba(13, 106, 93, 0.92), 0 26px 72px rgba(42, 34, 24, 0.18);
}
.image-card.image-missing img {
  opacity: 0.18;
  filter: grayscale(1);
}
.image-card.image-missing::after {
  content: "文件未读取";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 42%;
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 252, 0.88);
  color: var(--muted);
  font-size: 12px;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
}
.image-card .check {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 22px;
  height: 22px;
  display: none;
  z-index: 2;
}
.folder-btn {
  position: absolute;
  right: 10px;
  bottom: 54px;
  min-height: 28px;
  padding: 0 9px;
  color: #fff;
  background: rgba(31, 33, 30, 0.68);
  border-color: rgba(255,255,255,0.18);
  opacity: 0;
  transform: translateY(4px);
  z-index: 3;
  border-radius: 999px;
  font-size: 0;
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
}
.folder-btn::before {
  content: "↗";
  font-size: 14px;
  line-height: 1;
}
.image-card:hover .folder-btn {
  opacity: 1;
  transform: translateY(0);
}
.multi-mode .image-card .check { display: block; }
.image-card img,
.placeholder-art {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: block;
  object-fit: cover;
  background: #e8e1d6;
}
.image-card img {
  transition: transform 0.2s ease, filter 0.2s ease;
  transform-origin: center;
}
.image-card:not(.dragging):hover img {
  transform: scale(1.018);
}
.image-card footer {
  display: grid;
  gap: 4px;
  padding: 11px 12px 12px;
  overflow: hidden;
}
.image-card footer strong {
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-card.legacy-readonly-card {
  border-color: rgba(125, 105, 71, 0.52);
}
.image-card.legacy-readonly-card footer span {
  color: #8b7040;
}
.image-card.legacy-readonly-card::before {
  content: "已下线工作流 · 只读";
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff8e8;
  background: rgba(82, 64, 38, 0.82);
  font-size: 10px;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.image-card.legacy-readonly-card .check { display: none; }

.placeholder-art {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 20%, rgba(239, 214, 164, 0.58), transparent 34%),
    radial-gradient(circle at 78% 36%, rgba(176, 143, 97, 0.40), transparent 38%),
    linear-gradient(135deg, #7b6a4d 0%, #a58f68 42%, #6f5d43 100%);
  background-size: 180% 180%;
  animation: placeholderBreath 7.2s ease-in-out infinite;
}
.image-card.failed-card {
  border-color: rgba(164, 86, 67, 0.32);
}
.image-card.failed-card .placeholder-art {
  background: linear-gradient(135deg, #7a6a50, #6a5844);
}
.image-card.failed-card .placeholder-art strong {
  color: #f7efe2;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  animation: none;
  letter-spacing: 0.12em;
}
.image-card.failed-card footer span {
  color: var(--danger);
}
.folder-tab {
  position: absolute;
  left: 22px;
  top: 0;
  width: 96px;
  height: 28px;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 246, 220, 0.16);
}
.placeholder-art strong {
  color: #fff6e3;
  font-size: 15px;
  letter-spacing: 0.12em;
  font-weight: 800;
}
@keyframes placeholderBreath {
  0% { background-position: 0% 42%; filter: saturate(0.96) brightness(0.96); }
  50% { background-position: 100% 58%; filter: saturate(1.08) brightness(1.04); }
  100% { background-position: 0% 42%; filter: saturate(0.96) brightness(0.96); }
}
@keyframes easeNatureShimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes sheenText {
  0% { background-position: 0% 50%; }
  100% { background-position: 260% 50%; }
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.studio-color-panel {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.studio-color-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: center;
}
.studio-color-row input[type="color"] {
  height: 34px;
  padding: 2px;
}
.studio-color-row input[type="text"],
.studio-color-row input:not([type]) {
  text-transform: uppercase;
}
.field span, .slider span {
  color: var(--muted);
  font-size: 12px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.86);
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.api-model-actions {
  align-items: center;
  margin-top: -2px;
}
.api-model-actions .api-note {
  margin: 0;
}

.profile-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.54);
}
.free-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.free-panel[hidden] { display: none; }
.free-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: stretch;
}
.free-actions > button {
  align-self: stretch;
  height: 92px;
  min-height: 92px;
  padding: 0 10px;
  color: #fff !important;
  background: linear-gradient(135deg, #161614, #7d684f);
  border-color: rgba(22, 22, 20, 0.12);
  white-space: nowrap;
  font-size: 12px;
}
.free-drop {
  height: 92px;
  min-height: 92px;
  margin: 0;
  padding: 12px;
  align-content: center;
}
.free-drop strong { font-size: 13px; }
.free-drop small {
  max-width: 150px;
  line-height: 1.4;
}
.free-ref-list {
  display: grid;
  gap: 8px;
}
.free-ref-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.68);
  cursor: grab;
}
.free-ref-card:active { cursor: grabbing; }
.free-ref-card.dragging { opacity: 0.55; }
.free-ref-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 106, 93, 0.12);
}
.free-ref-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}
.free-ref-card strong,
.free-ref-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.free-ref-card strong { font-size: 12px; }
.free-ref-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.free-ref-card button {
  min-height: 26px;
  padding: 0 8px;
  color: var(--danger);
}

.model-preview {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 54px;
  margin-top: 8px;
  padding: 7px;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 11px;
  background: rgba(255,255,252,0.62);
}

.model-preview img,
.model-preview-empty {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  object-fit: cover;
  background: rgba(125,104,79,0.12);
}

.model-preview-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

.model-preview strong,
.model-preview small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-preview strong { font-size: 12px; }
.model-preview small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.send-ref-panel {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid rgba(125, 104, 79, 0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.52);
  box-shadow: 0 14px 32px rgba(56, 45, 35, 0.06);
}

.send-ref-panel > summary {
  list-style: none;
}

.send-ref-panel > summary::-webkit-details-marker {
  display: none;
}

.send-ref-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  cursor: pointer;
}

.send-ref-summary strong,
.send-ref-summary span {
  display: block;
}

.send-ref-summary strong {
  font-size: 13px;
}

.send-ref-summary span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.send-ref-summary em {
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(22,22,20,0.56);
  background: rgba(250,248,242,0.82);
  font-size: 11px;
  font-style: normal;
}

.send-ref-panel[open] .send-ref-summary em {
  color: #fff;
  background: #161614;
}

.send-ref-panel[open] .send-ref-summary em::before {
  content: "收起";
}

.send-ref-panel[open] .send-ref-summary em {
  font-size: 0;
}

.send-ref-panel[open] .send-ref-summary em::before {
  font-size: 11px;
}

.send-ref-body {
  display: grid;
  gap: 10px;
}

.send-ref-panel:not([open]) {
  gap: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}
.send-ref-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.send-ref-head strong,
.send-ref-head span {
  display: block;
}
.send-ref-head strong {
  font-size: 13px;
}
.send-ref-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.send-ref-actions {
  display: flex;
  gap: 6px;
}
.send-ref-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}
.send-ref-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 38px;
}
.send-ref-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,0.76);
  cursor: grab;
}
.send-ref-card:active {
  cursor: grabbing;
}
.send-ref-card.dragging {
  opacity: 0.55;
}
.send-ref-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 106, 93, 0.12);
}
.send-ref-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 7px;
  background: #eee7dd;
}
.send-ref-card input {
  min-height: 28px;
  padding: 0 7px;
  font-size: 11px;
  background: rgba(255,255,255,0.9);
}
.send-ref-order {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  background: rgba(32, 27, 22, 0.68);
  font-size: 10px;
  line-height: 1;
  backdrop-filter: blur(8px);
}
.send-ref-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 3;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #ba4b3d;
  border-color: rgba(186, 75, 61, 0.28);
  font-size: 16px;
  line-height: 1;
}
.prompt-field {
  position: relative;
}
.prompt-field textarea {
  padding-bottom: 42px;
}
.prompt-field > button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: auto;
  min-height: 28px;
  padding: 0 10px;
  color: #fff !important;
  background: #7d684f;
  border-color: rgba(125, 104, 79, 0.2);
}
.custom-prompt-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
}
.custom-prompt-control button {
  min-height: 38px;
  justify-content: center;
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255,255,255,0.72);
}
.custom-prompt-control button.has-content {
  color: var(--accent);
  border-color: rgba(13, 106, 93, 0.32);
  background: var(--accent-soft);
}
.custom-prompt-control span {
  color: var(--muted);
  font-size: 12px;
}
.floating-generate-space {
  display: none;
}
.generate-bottom-dock {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 10px;
  display: grid;
  gap: 8px;
  padding: 10px 0 0;
  background: linear-gradient(180deg, rgba(246,245,242,0), rgba(255,253,248,0.96) 30%, rgba(255,253,248,0.99));
  border-top: 1px solid rgba(38, 36, 30, 0.08);
}
.generate-legacy-controls {
  display: none !important;
}
.generate-fixed-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(142px, 0.88fr);
  gap: 10px;
  align-items: center;
}
.generate-option-group {
  display: grid;
  position: relative;
  gap: 0;
  min-width: 0;
  min-height: 34px;
  padding: 3px;
  border: 1px solid rgba(153, 153, 153, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 252, 0.88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.82), 0 6px 14px rgba(22, 22, 20, 0.035);
  isolation: isolate;
}
.generate-ratio-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.generate-count-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tokenx-generate-count {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 86px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.tokenx-generate-count[hidden] {
  display: none;
}
.tokenx-generate-count input {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(153, 153, 153, 0.42);
  border-radius: 10px;
  background: rgba(255, 255, 252, 0.92);
}
.tokenx-generate-count small {
  line-height: 1.4;
}
.generate-option-group::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 4);
  border-radius: 999px;
  background: #222220;
  box-shadow: 0 5px 12px rgba(22, 22, 20, 0.16);
  transition: transform 180ms ease;
}
.generate-option-group:has(button:nth-child(2).active)::before { transform: translateX(100%); }
.generate-option-group:has(button:nth-child(3).active)::before { transform: translateX(200%); }
.generate-option-group:has(button:nth-child(4).active)::before { transform: translateX(300%); }
.generate-option-group button {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 6px;
  color: rgba(22, 22, 20, 0.68);
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 14px;
  font-weight: 500;
  transition: color 160ms ease, transform 160ms ease;
}
.generate-option-group button:hover {
  color: #161614;
  background: transparent !important;
  box-shadow: none !important;
}
.generate-option-group button:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(22,22,20,0.24) !important;
}
.generate-option-group button.active {
  color: #fff;
  background: transparent !important;
  box-shadow: none !important;
}
.bottom-custom-prompt {
  display: grid;
  padding: 0 2px;
}
.bottom-custom-prompt textarea {
  width: 100%;
  min-height: 42px;
  max-height: 64px;
  resize: vertical;
  border: 1px solid rgba(38, 36, 30, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 255, 252, 0.92);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}
.bottom-custom-prompt textarea:focus,
.bottom-custom-prompt textarea.has-content {
  border-color: rgba(13, 106, 93, 0.42);
  background: #fff;
}
.generate-submit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 8px;
  align-items: stretch;
}
.floating-generate-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  max-width: none;
  min-height: 52px;
  border-radius: 12px;
  background: #161614 !important;
  border-color: #161614 !important;
  color: #fff !important;
  box-shadow: 0 14px 34px rgba(22, 22, 20, 0.14);
  font-size: 15px;
  letter-spacing: 0.02em;
  transform: none !important;
}

.floating-generate-btn span {
  position: relative;
  z-index: 2;
}

.floating-generate-btn::before,
.floating-generate-btn::after {
  content: "";
  position: absolute;
  inset: -26px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.78;
  transform-origin: 50% 50%;
  transition: opacity 760ms ease, transform 980ms cubic-bezier(.22,.82,.28,1);
}

.floating-generate-btn::before {
  background:
    radial-gradient(circle at 8% 22%, rgba(255,255,255,0.94) 0 1px, transparent 2px),
    radial-gradient(circle at 18% 72%, rgba(222,203,161,0.70) 0 1.4px, transparent 3px),
    radial-gradient(circle at 34% 38%, rgba(255,255,255,0.62) 0 0.8px, transparent 2px),
    radial-gradient(circle at 50% 76%, rgba(255,235,185,0.78) 0 1.2px, transparent 3px),
    radial-gradient(circle at 66% 28%, rgba(255,255,255,0.82) 0 1px, transparent 2.5px),
    radial-gradient(circle at 84% 60%, rgba(222,203,161,0.68) 0 1.5px, transparent 3px),
    radial-gradient(circle at 92% 20%, rgba(255,255,255,0.55) 0 0.9px, transparent 2px);
  animation: generateFireflyDriftA 14s ease-in-out infinite alternate;
}

.floating-generate-btn::after {
  opacity: 0.52;
  background:
    radial-gradient(circle at 12% 58%, rgba(255,255,255,0.50) 0 0.8px, transparent 2px),
    radial-gradient(circle at 28% 16%, rgba(255,231,176,0.58) 0 1px, transparent 2.5px),
    radial-gradient(circle at 42% 64%, rgba(255,255,255,0.45) 0 0.7px, transparent 2px),
    radial-gradient(circle at 62% 84%, rgba(255,236,183,0.56) 0 1.1px, transparent 2.6px),
    radial-gradient(circle at 78% 36%, rgba(255,255,255,0.48) 0 0.8px, transparent 2px),
    radial-gradient(circle at 96% 74%, rgba(255,236,183,0.50) 0 1px, transparent 2.5px);
  animation: generateFireflyDriftB 18s ease-in-out infinite alternate;
}

.floating-generate-btn:hover {
  background: #161614 !important;
  color: #fff !important;
  transform: none !important;
  box-shadow: 0 14px 34px rgba(22, 22, 20, 0.14);
}

.floating-generate-btn:hover::before,
.floating-generate-btn:hover::after {
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0.08);
  animation-play-state: paused;
}

@keyframes generateFireflyDriftA {
  0% { transform: translate3d(-8px, 3px, 0) scale(1); }
  35% { transform: translate3d(6px, -5px, 0) scale(1.03); }
  70% { transform: translate3d(-2px, 6px, 0) scale(0.98); }
  100% { transform: translate3d(9px, -2px, 0) scale(1.02); }
}

@keyframes generateFireflyDriftB {
  0% { transform: translate3d(7px, -4px, 0) scale(1.02); }
  42% { transform: translate3d(-5px, 5px, 0) scale(0.97); }
  100% { transform: translate3d(2px, -7px, 0) scale(1.04); }
}
button.image-width-toggle {
  width: 52px;
  min-height: 52px;
  padding: 0 2px;
  border-radius: 12px;
  border-color: #161614 !important;
  color: #fff !important;
  background: #161614 !important;
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 14px 34px rgba(22, 22, 20, 0.14);
  transform: none !important;
}
button.image-width-toggle:hover {
  color: #fff !important;
  background: #161614 !important;
  border-color: #161614 !important;
  transform: none !important;
  box-shadow: 0 14px 34px rgba(22, 22, 20, 0.14);
}
button.image-width-toggle.pulse {
  animation: imageWidthPulse 0.34s ease;
}
@keyframes imageWidthPulse {
  0% { box-shadow: 0 14px 34px rgba(22, 22, 20, 0.14); }
  45% { box-shadow: 0 10px 26px rgba(22, 22, 20, 0.22); }
  100% { box-shadow: 0 14px 34px rgba(22, 22, 20, 0.14); }
}
body.right-collapsed .generate-bottom-dock {
  display: none;
}
.free-template-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}
.free-template-row button {
  padding: 0 10px;
}
.api-profile-field {
  margin: 2px 0 12px;
}
.image-quality-field {
  margin: -2px 0 12px;
}
.image-quality-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(38, 36, 30, 0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.72);
}
.image-quality-options button {
  min-height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
.image-quality-options button.active {
  color: #fff;
  background: #161614;
  box-shadow: 0 10px 24px rgba(22, 22, 20, 0.12);
}
.image-quality-options button[data-image-quality="medium"].active {
  background: #7d684f;
}
.image-quality-options button[data-image-quality="low"].active {
  background: #9a8b74;
}
.image-quality-options.compact {
  display: flex;
  gap: 3px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}
.image-quality-options.compact button {
  min-width: 28px;
  min-height: 26px;
  padding: 0;
  border-radius: 7px;
  font-size: 12px;
}
.api-profile-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 10px;
}
.api-profile-toolbar button {
  min-height: 38px;
}
.api-profile-lock-note {
  align-self: center;
  padding: 8px 11px;
  border: 1px solid rgba(13, 106, 93, 0.14);
  border-radius: 999px;
  color: #547068;
  background: rgba(230, 242, 238, 0.62);
  font-size: 12px;
  white-space: nowrap;
}

.lovart-settings-card {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid rgba(13, 106, 93, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(232, 244, 240, 0.70), rgba(255,255,252,0.86));
  box-shadow: 0 14px 34px rgba(42, 34, 24, 0.07);
}

.lovart-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lovart-settings-head strong,
.lovart-settings-head span {
  display: block;
}

.lovart-settings-head strong {
  font-size: 14px;
  color: var(--ink);
}

.lovart-settings-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toggle-line.compact {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  border-radius: 999px;
  background: rgba(255,255,255,0.70);
  white-space: nowrap;
}

.toggle-line.compact input {
  width: auto;
}
.free-ratio-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.free-ratio-btn {
  min-height: 34px;
  border-color: var(--line);
  background: rgba(255,255,255,0.72);
  color: var(--ink);
  box-shadow: none;
}
.free-ratio-btn.active {
  color: #fff !important;
  background: #161614;
  border-color: #161614;
  box-shadow: 0 10px 24px rgba(22, 22, 20, 0.16);
}
.profile-switch button {
  min-height: 34px;
  padding: 0 8px;
  border-color: transparent !important;
  background: transparent !important;
  color: var(--ink) !important;
  box-shadow: none !important;
  white-space: nowrap;
  font-size: 13px;
  letter-spacing: 0;
}
.generate-controls-panel > .profile-switch {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
}
.generate-controls-panel > .profile-switch button {
  min-width: 0;
  min-height: 32px;
  padding: 0 4px;
  font-size: 12px;
}
.profile-switch button.active {
  color: #fff !important;
  background: #161614 !important;
  border-color: #161614 !important;
  box-shadow: 0 10px 24px rgba(22, 22, 20, 0.18);
} .muted-note {
  color: var(--muted);
  font-size: 12px;
}
.mini-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.7);
  color: var(--ink);
  box-shadow: none;
  cursor: pointer;
}
.mini-check.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.batch-start-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(38, 36, 30, 0.08);
}
.batch-start-row .primary {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #161614, #7d684f);
  border-color: transparent;
  box-shadow: 0 16px 34px rgba(72, 56, 36, 0.18);
}

.batch-section-head.compact {
  margin-bottom: 0;
}
.button-row, .segmented {
  display: flex;
  gap: 8px;
}
/* ===== 片段选择 ==== */
.segmented button { flex: 1; }
.slider {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.slider span {
  display: flex;
  justify-content: space-between;
}

.segment-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.segment-group h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.scene-segment-group h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.scene-count { color: var(--muted); font-size: 11px; }
.scene-search-input {
  width: 100%;
  min-height: 32px;
  margin-bottom: 8px;
}
.scene-segment-group .scene-options {
  max-height: 190px;
  overflow-y: auto;
  align-content: start;
  padding-right: 3px;
}
.scene-segment-group .scene-options .chip[hidden] { display: none; }
.scene-search-empty { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.scene-search-empty[hidden] { display: none; }
.segment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  min-height: 32px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255,255,255,0.72);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}
#segmentPanel .segment-options .chip:not(.active),
#segmentPanel .segment-options button.chip:not(.active) {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255,255,255,0.72);
}

.image-popover {
  position: fixed;
  z-index: 10;
  display: flex;
  gap: 6px;
  padding: 8px;
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  animation: popIn 0.14s ease;
}
.quick-angle-btn {
  grid-column: 1 / -1;
  color: #fff !important;
  border-color: transparent;
  background: linear-gradient(135deg, #111 0%, #7b6040 46%, var(--accent) 100%);
  box-shadow: 0 14px 32px rgba(51, 42, 30, 0.22);
}
.quick-angle-btn:hover {
  color: #fff !important;
  background: linear-gradient(135deg, #1b1a17 0%, #9a7246 44%, #10806f 100%);
}
.image-popover[hidden] { display: none; }

.image-optimize-dialog {
  width: min(760px, calc(100vw - 44px));
  max-width: min(760px, calc(100vw - 44px));
}

.image-optimize-layout {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.image-optimize-preview {
  display: grid;
  grid-template-rows: minmax(180px, 1fr) auto;
  gap: 10px;
  margin: 0;
  min-height: 300px;
}

.image-optimize-preview img {
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2eee5;
}

.image-optimize-preview figcaption {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.image-optimize-prompt {
  margin: 0;
}

.image-optimize-prompt textarea {
  min-height: 300px;
  resize: vertical;
}

/* ===== 响应式适配 ==== */
@media (max-width: 720px) {
  .image-optimize-layout {
    grid-template-columns: 1fr;
  }

  .image-optimize-preview {
    min-height: 220px;
  }
}

.task-dock {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 360px;
  max-height: 48vh;
  display: none;
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  overflow: hidden;
  z-index: 12;
}
.task-dock.show { display: block; }
.task-dock header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
#taskList {
  display: grid;
  gap: 8px;
  padding: 10px;
  overflow: visible;
  max-height: none;
}
.task-record-section {
  min-height: 320px;
}
.section-mini-danger {
  min-height: 24px;
  padding: 0 8px;
  border-color: rgba(164, 86, 67, 0.22);
  color: var(--danger);
  font-size: 11px;
}
.section-mini-danger:disabled {
  opacity: 0.55;
  color: var(--muted);
}
.task-record-list {
  max-height: none;
  padding: 0;
  padding-right: 2px;
}
#taskList.task-record-list {
  max-height: 54vh;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 2px 0 0;
}
#taskList.task-record-list::-webkit-scrollbar { width: 0; height: 0; }
.task-list-hint {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 8px;
  border: 1px solid rgba(127, 103, 75, 0.18);
  border-radius: 8px;
  background: rgba(250, 247, 241, 0.88);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  backdrop-filter: blur(12px);
}
.task-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}
.task-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.task-row strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.35;
}
.task-status {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255,255,255,0.78);
  color: var(--muted);
  font-size: 11px;
}
.task-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.task-meta-line span {
  width: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(250, 247, 241, 0.9);
  color: var(--muted);
  font-size: 11px;
}
.task-item.queued .task-status { color: #8a5a2f; border-color: rgba(138,90,47,0.24); background: #f5eadf; }
.task-item.running .task-status { color: var(--accent); border-color: rgba(13,106,93,0.24); background: var(--accent-soft); }
.task-item.done .task-status { color: var(--accent-3); border-color: rgba(47,95,143,0.24); background: #e8f0f7; }
.task-item.failed .task-status { color: var(--danger); border-color: #e0b7b7; background: #fbefef; }
.task-item.cancelled { opacity: 0.7; }
.task-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.task-actions button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
}
.task-item span { color: var(--muted); font-size: 12px; }
.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #eee8dd;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}
.task-dialog {
  width: min(1040px, 94vw);
  max-width: min(1040px, 94vw);
}
.task-dialog .dialog-body {
  height: min(720px, 88vh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}
.task-dialog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.task-filter-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.56);
}
.task-filter-tabs button {
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.task-filter-tabs button.active {
  color: #fff;
  background: #161614;
  border-color: #161614;
}
.task-dialog-toolbar > div:last-child {
  display: flex;
  gap: 8px;
}
.task-dialog-list {
  max-height: none !important;
  min-height: 0;
  overflow: auto !important;
  padding-right: 4px !important;
}

.dialog {
  border: 1px solid rgba(38, 36, 30, 0.10);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.94);
  color: var(--ink);
  box-shadow: 0 34px 110px rgba(42, 34, 24, 0.22);
  backdrop-filter: var(--blur);
  animation: dialogIn 0.18s ease;
  padding: 0;
  max-width: min(720px, 94vw);
  max-height: min(90vh, 920px);
}
.dialog::backdrop {
  background: rgba(35, 32, 28, 0.28);
  backdrop-filter: blur(10px);
}
.wide-dialog { max-width: min(1180px, 96vw); width: 1180px; }
.prompt-view-dialog {
  width: min(1120px, 94vw);
}
.prompt-view-dialog .dialog-body {
  max-height: min(820px, 90vh);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}
.prompt-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 4px 0 10px;
}
.prompt-view-head > span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt-view-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.prompt-view-legend em {
  padding: 5px 9px;
  border-radius: 999px;
  font-style: normal;
  font-size: 12px;
  line-height: 1;
  background: rgba(255, 255, 252, 0.82);
  border: 1px solid rgba(38, 36, 30, 0.1);
}
.prompt-view-legend .system { color: #b54037; }
.prompt-view-legend .product { color: #107a5f; }
.prompt-view-legend .editable { color: #26241e; }
.prompt-view-segments {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(38, 36, 30, 0.1);
  border-radius: 14px;
  background: rgba(250, 248, 242, 0.7);
}
.prompt-view-block {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(38, 36, 30, 0.08);
  background: rgba(255, 255, 252, 0.82);
  color: #26241e;
  font: 13px/1.72 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.prompt-view-block.system {
  color: #b54037;
  border-color: rgba(181, 64, 55, 0.22);
  background: rgba(255, 246, 244, 0.82);
}
.prompt-view-block.product {
  color: #107a5f;
  border-color: rgba(16, 122, 95, 0.18);
  background: rgba(237, 249, 244, 0.82);
}
.prompt-view-block.editable {
  color: #26241e;
}
.prompt-view-inline-btn {
  min-height: 32px;
  border-radius: 999px;
  white-space: nowrap;
}
/* ===== 设置对话框 ==== */
.settings-dialog { max-width: min(1480px, 98vw); width: min(1480px, 98vw); }
.detail-plan-dialog {
  width: min(1160px, 94vw);
}
.detail-plan-dialog .dialog-body {
  max-height: min(820px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.detail-plan-content {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}
.detail-plan-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(38, 36, 30, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 252, 0.72);
  box-shadow: 0 14px 30px rgba(58, 48, 34, 0.06);
}
.detail-plan-card {
  border: 1px solid rgba(38, 36, 30, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 252, 0.72);
  box-shadow: 0 14px 30px rgba(58, 48, 34, 0.06);
}
.detail-plan-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.detail-plan-summary span {
  padding: 10px 12px;
  border: 1px solid rgba(38, 36, 30, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.detail-plan-summary strong,
.detail-plan-summary b {
  display: block;
  color: var(--ink);
  font-size: 16px;
}
.detail-plan-notice {
  display: grid;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid rgba(13, 106, 93, 0.16);
  border-radius: 12px;
  background: rgba(232, 247, 242, 0.74);
  color: var(--accent);
}
.detail-plan-notice.fallback {
  border-color: rgba(147, 95, 42, 0.20);
  background: rgba(252, 241, 218, 0.80);
  color: #8a5b24;
}
.detail-plan-notice strong {
  font-size: 13px;
}
.detail-plan-notice p {
  margin: 0;
  color: inherit;
  font-size: 12px;
  line-height: 1.5;
}
.detail-plan-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}
.detail-plan-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.detail-plan-card h3 {
  margin: 0;
  font-size: 14px;
}
.detail-plan-card small {
  color: var(--muted);
}
.detail-plan-status {
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  background: rgba(255,255,255,0.72);
  color: var(--muted);
  white-space: nowrap;
}
.detail-plan-status.done { color: #0f6d5c; background: rgba(221, 242, 235, 0.82); }
.detail-plan-status.pending { color: #8a6a21; background: rgba(255, 244, 216, 0.9); }
.detail-plan-status.failed { color: #a14235; background: rgba(255, 235, 230, 0.82); }
.detail-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.detail-plan-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
}
.detail-plan-grid textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  color: var(--ink);
  background: rgba(255,255,255,0.86);
}
.detail-plan-confirm-card {
  gap: 12px;
}
.detail-plan-prompt-editor {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 1fr);
  gap: 12px;
  align-items: stretch;
}
.detail-plan-selected-prompts,
.detail-plan-prompt-picker {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(38, 36, 30, 0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.70);
}
.detail-plan-selected-prompts > header,
.detail-plan-prompt-picker > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.detail-plan-selected-prompts > header strong,
.detail-plan-prompt-picker > header strong {
  font-size: 13px;
}
.detail-plan-selected-prompts > header span,
.detail-plan-prompt-picker > header span,
.detail-plan-prompt-picker.empty span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.detail-plan-prompt-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.detail-plan-prompt-chip {
  min-width: 0;
  max-width: 100%;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  border-color: rgba(13, 106, 93, 0.18);
  background: rgba(239, 248, 244, 0.72);
  color: var(--accent);
  box-shadow: none;
}
.detail-plan-prompt-chip:hover,
.detail-plan-prompt-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: none;
}
.detail-plan-prompt-chip span {
  color: inherit;
  opacity: 0.72;
  font-size: 10px;
}
.detail-plan-prompt-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.detail-plan-extra-prompt {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.detail-plan-extra-prompt textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  color: var(--ink);
  background: rgba(255,255,255,0.86);
}
.detail-plan-prompt-picker {
  align-content: start;
}
.detail-plan-prompt-picker.empty {
  place-content: center;
  text-align: center;
  min-height: 220px;
}
.detail-plan-prompt-options {
  display: grid;
  gap: 7px;
  max-height: 330px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.detail-plan-prompt-options button {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 9px 10px;
  border-radius: 12px;
  border-color: rgba(38, 36, 30, 0.10);
  background: rgba(255,255,255,0.76);
  box-shadow: none;
}
.detail-plan-prompt-options button:hover,
.detail-plan-prompt-options button.active {
  color: var(--accent);
  border-color: rgba(13,106,93,0.38);
  background: rgba(226,245,239,0.78);
  transform: none;
}
.detail-plan-prompt-options button strong {
  font-size: 12px;
}
.detail-plan-prompt-options button span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.detail-plan-skip-note {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(246, 241, 232, 0.72);
  color: var(--muted);
  font-size: 12px;
}
.detail-plan-grid dt {
  color: var(--muted);
}
.detail-plan-grid dd {
  margin: 0;
  white-space: pre-wrap;
}
.detail-plan-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(38, 36, 30, 0.16);
  border-radius: 18px;
}
.detail-plan-actions {
  padding-top: 14px;
  border-top: 1px solid rgba(38, 36, 30, 0.08);
}
.detail-plan-actions .primary {
  min-width: 160px;
}
.detail-review-dialog {
  width: min(1120px, 94vw);
}
.detail-review-dialog .dialog-body {
  max-height: min(820px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.detail-review-content {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}
.detail-review-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(38, 36, 30, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 252, 0.74);
  box-shadow: 0 14px 30px rgba(58, 48, 34, 0.06);
}
.detail-review-summary strong {
  font-size: 15px;
}
.detail-review-summary span {
  color: var(--muted);
  font-size: 12px;
}
.detail-review-list,
.detail-review-screen-list,
.detail-review-submit {
  display: grid;
  gap: 12px;
}
.detail-review-list-card,
.detail-review-screen-card,
.detail-review-last-note {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(38, 36, 30, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 252, 0.76);
  box-shadow: 0 14px 30px rgba(58, 48, 34, 0.05);
}
.detail-review-list-card.pending {
  border-color: rgba(147, 95, 42, 0.20);
}
.detail-review-list-card.changes {
  border-color: rgba(180, 75, 58, 0.20);
}
.detail-review-list-card.approved {
  border-color: rgba(13, 106, 93, 0.18);
}
.detail-review-list-card header,
.detail-review-screen-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.detail-review-list-card header div,
.detail-review-screen-card header div {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.detail-review-list-card strong,
.detail-review-screen-card strong,
.detail-review-last-note strong {
  font-size: 14px;
}
.detail-review-list-card span,
.detail-review-screen-card span {
  color: var(--muted);
  font-size: 12px;
}
.detail-review-list-card p,
.detail-review-last-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  white-space: pre-wrap;
}
.detail-review-list-card footer,
.detail-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.detail-review-actions {
  padding-top: 14px;
  border-top: 1px solid rgba(38, 36, 30, 0.08);
}
.detail-review-overall textarea,
.detail-review-screen-card textarea,
.detail-review-submit textarea {
  width: 100%;
  resize: vertical;
  color: var(--ink);
  background: rgba(255,255,255,0.88);
}
.detail-review-screen-card textarea {
  min-height: 88px;
}
.detail-review-actions .danger,
.detail-review-list-card .danger {
  color: #9b4032;
  border-color: rgba(180, 75, 58, 0.26);
  background: rgba(255, 245, 242, 0.86);
}
.detail-review-actions .danger:hover,
.detail-review-list-card .danger:hover {
  color: #fff;
  border-color: #9b4032;
  background: #9b4032;
}
.detail-review-dock {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}
.detail-review-dock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(38, 36, 30, 0.08);
}
.detail-review-dock-head div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.detail-review-dock-head span,
.detail-review-dock-head small,
.detail-review-dock-status span,
.detail-review-dock-overall span {
  color: var(--muted);
  font-size: 11px;
}
.detail-review-dock-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
.detail-review-dock-note {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(38, 36, 30, 0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.68);
}
.detail-review-dock-note strong {
  font-size: 12px;
}
.detail-review-dock-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.detail-review-dock-overall {
  display: grid;
  gap: 6px;
}
.detail-review-dock-overall textarea,
.detail-review-dock-screen textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  color: var(--ink);
  background: rgba(255,255,255,0.9);
}
.detail-review-dock-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.detail-review-dock-screens {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.detail-review-dock-screen {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(38, 36, 30, 0.08);
  border-radius: 12px;
  background: rgba(255,255,252,0.74);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.detail-review-dock-screen.active {
  border-color: rgba(13, 106, 93, 0.36);
  background: rgba(234, 248, 244, 0.86);
  box-shadow: inset 0 0 0 1px rgba(13, 106, 93, 0.08);
}
.detail-review-dock-screen > button {
  min-height: 0;
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.detail-review-dock-screen > button:hover {
  transform: none;
  box-shadow: none;
  background: transparent;
}
.detail-review-dock-screen strong {
  font-size: 13px;
}
.detail-review-dock-screen span {
  color: var(--muted);
  font-size: 11px;
}
.detail-review-dock-actions {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1fr;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(38, 36, 30, 0.08);
}
.detail-review-dock-actions .primary {
  min-height: 38px;
}
.detail-review-dock-actions .danger {
  color: #9b4032;
  border-color: rgba(180, 75, 58, 0.26);
  background: rgba(255, 245, 242, 0.86);
}
.detail-review-dock-actions .danger:hover {
  color: #fff;
  border-color: #9b4032;
  background: #9b4032;
}
body.detail-review-workflow .generate-bottom-dock {
  display: none;
}
.product-picker-dialog {
  width: min(1380px, 96vw);
  max-width: min(1380px, 96vw);
}
.product-picker-dialog .dialog-body {
  min-height: min(800px, 92vh);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}
.settings-dialog {
  height: min(840px, 94vh);
}
.settings-dialog .dialog-body {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.settings-dialog,
.settings-dialog * {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.settings-dialog::-webkit-scrollbar,
.settings-dialog *::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}
.dialog-body { padding: 22px; overflow: auto; }
.dialog-body > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(38, 36, 30, 0.08);
}
.dialog h2, .dialog h3 { margin: 0; letter-spacing: 0; }
.dialog h2 { font-size: 20px; line-height: 1.25; }

.dialog.template-editor-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #f7f3ec;
}

.dialog.template-editor-dialog::backdrop {
  background: rgba(35, 32, 28, 0.18);
  backdrop-filter: blur(6px);
}

.dialog.template-editor-dialog .dialog-body {
  width: 100vw;
  height: 100vh;
  padding: 18px 22px 20px;
  border-radius: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.dialog.template-editor-dialog .template-editor-layout {
  grid-template-columns: 280px minmax(900px, 1fr) 390px;
  gap: 18px;
}

.dialog.template-editor-dialog .template-editor-canvas {
  padding: 44px;
  border-radius: 22px;
}
.dialog h3 { font-size: 15px; margin-bottom: 10px; }
.plain-close,
#taskDockCloseBtn,
/* ===== 图片查看器 ==== */
.viewer-close {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.76);
  color: var(--ink);
  border-color: rgba(38, 36, 30, 0.12);
  box-shadow: 0 10px 24px rgba(58, 48, 34, 0.10);
  backdrop-filter: blur(14px);
  font-size: 0;
  line-height: 0;
}
.plain-close::before,
.plain-close::after,
#taskDockCloseBtn::before,
#taskDockCloseBtn::after,
.viewer-close::before,
.viewer-close::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 1.6px;
  border-radius: 999px;
  background: currentColor;
}
.plain-close::before,
#taskDockCloseBtn::before,
.viewer-close::before { transform: rotate(45deg); }
.plain-close::after,
#taskDockCloseBtn::after,
.viewer-close::after { transform: rotate(-45deg); }
.dialog menu {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0;
  margin: 18px 0 0;
}
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.confirm-dialog {
  width: min(560px, calc(100vw - 44px));
  max-width: min(560px, calc(100vw - 44px));
}
.confirm-dialog .confirm-card {
  padding: 24px;
}
.confirm-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.confirm-card h2 {
  margin: 0;
  font-size: 22px;
}
.confirm-card p {
  margin: 0 0 22px;
  max-width: 430px;
  color: var(--muted);
  line-height: 1.7;
}
.confirm-card menu {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 0;
}
.confirm-card menu.two-actions {
  grid-template-columns: 1fr 1fr;
}
.confirm-card menu button {
  min-height: 42px;
  border-radius: 12px;
  white-space: nowrap;
}
.confirm-card .compact-field {
  margin: 0 0 16px;
}
.confirm-card .compact-field input {
  width: 100%;
}
.confirm-card .soft-action {
  color: var(--accent);
  border-color: rgba(13, 106, 93, 0.22);
  background: var(--accent-soft);
  font-weight: 700;
}
.confirm-card .strong-danger {
  color: #fff !important;
  border-color: #9f443c;
  background: linear-gradient(135deg, #9f443c, #b76550);
  font-weight: 700;
}
.confirm-card .secondary-action {
  color: var(--muted);
  background: rgba(255,255,255,0.68);
}

.compact-retired-dialog {
  max-width: min(920px, calc(100vw - 32px));
}
.compact-retired-dialog .dialog-body {
  max-height: min(84vh, 780px);
  overflow: auto;
}
.dialog-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.detail-batch-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.detail-batch-toolbar input {
  flex: 1;
  min-width: 0;
}
.detail-batch-toolbar span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.detail-batch-product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  max-height: 240px;
  overflow: auto;
  margin-bottom: 12px;
}
.detail-batch-product-list .batch-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  text-align: left;
}
.detail-batch-product-list .batch-item img {
  width: 54px;
  height: 54px;
  border-radius: 7px;
  object-fit: cover;
}
.detail-batch-product-list .batch-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(13, 106, 93, 0.14);
}
.trash-list {
  display: grid;
  gap: 10px;
  max-height: 62vh;
  overflow: auto;
}
.trash-item {
  display: grid;
  grid-template-columns: 82px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
}
.trash-item img {
  width: 82px;
  height: 82px;
  border-radius: 7px;
  object-fit: cover;
}
.trash-item strong, .trash-item span { display: block; }
.trash-item span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.canvas-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.canvas-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.72);
  padding: 10px;
  box-shadow: var(--shadow-soft);
}
.canvas-card.active {
  border-color: #161614;
  box-shadow: 0 0 0 2px rgba(22,22,20,0.12), var(--shadow-soft);
}
.canvas-cover {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #73634a;
  color: rgba(255, 245, 222, 0.82);
  font-size: 12px;
  letter-spacing: 0.16em;
  font-weight: 800;
}
.canvas-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.canvas-meta {
  display: grid;
  gap: 4px;
}
.canvas-meta span {
  color: var(--muted);
  font-size: 12px;
}
.canvas-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.batch-columns {
  display: grid;
  grid-template-columns: minmax(340px, 0.78fr) minmax(520px, 1.22fr);
  gap: 20px;
  min-height: 0;
  margin: 0;
}
.batch-columns > section {
  min-height: 0;
  padding: 2px;
}
.batch-columns > section:first-child,
.batch-columns > section:last-child {
  display: grid;
  align-content: start;
}
.batch-columns > section:first-child {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}
.batch-columns > section:last-child {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.batch-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.batch-section-head h3 {
  margin: 0;
}
.batch-section-head span {
  color: var(--muted);
  font-size: 12px;
}
.batch-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 12px;
}
.batch-toolbar button {
  min-height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 252, 0.72);
}
.batch-list, .batch-prompt-list, .setting-list {
  display: grid;
  gap: 10px;
  max-height: 100%;
  overflow: auto;
}
.setting-list {
  max-height: 500px;
}
.batch-item, .prompt-count-item, .setting-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.7);
  padding: 10px;
}
.batch-item {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  text-align: left;
  gap: 10px;
  cursor: pointer;
  min-height: 68px;
  width: 100%;
  color: var(--ink);
  box-shadow: none;
}
.batch-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.batch-item img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 9px;
}
.batch-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.scheme-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}
.batch-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,0.56);
}
.batch-mode-switch button {
  border-color: transparent;
  background: transparent;
}
.batch-mode-switch button.active {
  color: #fff;
  border-color: #161614;
  background: #161614;
}
#pageBatchPanel,
#aiDetailBatchPanel {
  min-height: 0;
}
#pageBatchPanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
#aiDetailBatchPanel {
  align-content: start;
}
.ai-detail-batch-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(13, 106, 93, 0.20);
  border-radius: 14px;
  background: rgba(232, 244, 240, 0.62);
}
.ai-detail-batch-card strong {
  font-size: 13px;
}
.ai-detail-batch-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.ai-detail-batch-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-detail-batch-card span,
.ai-detail-batch-run small {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(13, 106, 93, 0.14);
  border-radius: 999px;
  color: #42665d;
  background: rgba(255,255,255,0.64);
  font-size: 11px;
}
.ai-detail-batch-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}
.ai-detail-batch-run {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.72);
}
.ai-detail-batch-run header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.ai-detail-batch-run strong {
  font-size: 12px;
}
.ai-detail-batch-run em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}
.ai-detail-batch-items {
  display: grid;
  gap: 6px;
}
.ai-detail-batch-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 9px;
  background: rgba(246, 242, 234, 0.70);
  color: var(--muted);
  font-size: 12px;
}
.ai-detail-batch-item b {
  color: var(--text);
  font-weight: 600;
}
.ai-detail-batch-item.done span,
.ai-detail-batch-item.submitted span {
  color: var(--accent);
}
.ai-detail-batch-item.failed span {
  color: var(--danger);
}
.batch-help {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.slim-field { margin-bottom: 8px; }
.scheme-row {
  grid-template-columns: 76px 1fr;
}
.prompt-count-item {
  display: grid;
  grid-template-columns: auto 1fr 72px;
  gap: 8px;
  align-items: center;
}
.page-prompt-batch-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
}
.page-prompt-batch-item.active {
  border-color: rgba(13, 106, 93, 0.34);
  background: rgba(230, 242, 238, 0.58);
}
.page-prompt-main {
  display: grid;
  grid-template-columns: auto 1fr 76px;
  gap: 10px;
  align-items: center;
}
.page-prompt-batch-item input[type="checkbox"] {
  width: auto;
}
.page-prompt-batch-item strong,
.page-prompt-batch-item small {
  display: block;
}
.page-prompt-batch-item small {
  margin-top: 3px;
  color: var(--muted);
}
.mini-count {
  display: grid;
  gap: 3px;
}
.mini-count em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}
.page-prompt-refbar {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  align-items: start;
}
.page-prompt-refbar b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 32px;
}
.page-prompt-refgrid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  align-items: center;
}
.page-prompt-refgrid button {
  position: relative;
  width: 54px;
  height: 66px;
  min-height: 66px;
  padding: 0;
  overflow: hidden;
  border-radius: 7px;
  border-color: var(--line);
  background: #eee7dd;
}
.page-prompt-refgrid button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.94), 0 0 0 4px rgba(13, 106, 93, 0.46), 0 12px 24px rgba(13, 106, 93, 0.18);
  background: #fff;
  transform: translateY(-1px);
}
.page-prompt-refgrid button:not(.active) {
  opacity: 0.58;
  filter: saturate(0.75);
}
.page-prompt-refgrid img {
  display: block;
  width: 100%;
  height: 46px;
  object-fit: cover;
}
.page-prompt-refgrid span {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 1px 4px;
  border-radius: 999px;
  color: #fff;
  background: rgba(32, 27, 22, 0.66);
  font-size: 9px;
}
.page-prompt-refgrid em {
  display: block;
  padding: 2px 3px 0;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setting-item.active { border-color: var(--accent); background: var(--accent-soft); }
.setting-item strong { display: block; font-size: 13px; }
.setting-item span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.draggable-setting {
  cursor: grab;
}
.draggable-setting:active {
  cursor: grabbing;
}
.draggable-setting.dragging {
  opacity: 0.5;
}
.draggable-setting.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 106, 93, 0.12);
}
.ai-helper {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.58);
}
.ai-helper .field { margin-bottom: 0; }
.ai-helper textarea {
  min-height: 78px;
  background: rgba(255,255,255,0.88);
}

.prompt-ai-helper {
  padding: 0;
  overflow: hidden;
}

.prompt-ai-helper > summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

.prompt-ai-helper > summary::-webkit-details-marker {
  display: none;
}

.prompt-ai-helper > summary span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.prompt-ai-helper > summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.prompt-ai-helper > summary::after {
  content: "展开";
  justify-self: end;
  padding: 3px 8px;
  border-radius: 999px;
  color: rgba(22,22,20,0.56);
  background: rgba(250,248,242,0.82);
  font-size: 11px;
}

.prompt-ai-helper[open] > summary::after {
  content: "收起";
  color: #fff;
  background: #161614;
}

.prompt-ai-helper-body {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}
.api-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  word-break: break-word;
}

.settings-layout {
  display: grid;
  grid-template-columns: 178px 1fr;
  gap: 22px;
  height: 100%;
  min-height: 0;
}
.settings-tabs {
  display: grid;
  align-content: start;
  gap: 9px;
}
.settings-tabs button {
  min-height: 38px;
  text-align: left;
  border-radius: 11px;
  background: rgba(255,255,255,0.72);
}
.settings-page { display: none; }
.settings-page.active {
  display: block;
  height: 100%;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
}
.settings-page.active::-webkit-scrollbar { width: 0; height: 0; }
.settings-page.prompt-settings-page.active {
  overflow: auto;
}

/* ===== 资料库 ==== */
.library-mode-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
}
.library-mode-card strong,
.library-mode-card span {
  display: block;
}
.library-mode-card strong {
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 4px;
}
.library-mode-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.library-mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(153, 153, 153, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}
.library-mode-toggle button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #666;
  box-shadow: none;
}
.library-mode-toggle button.active {
  background: #141414;
  color: #fff;
}

#settingsDialog * {
  scrollbar-width: none;
}

#settingsDialog *::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.settings-split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  min-height: 0;
}

.prompt-admin-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
}

.prompt-admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(38, 36, 30, 0.08);
  border-radius: 18px;
  background: rgba(255,255,252,0.82);
  box-shadow: 0 16px 40px rgba(42,34,24,0.055);
}

.prompt-admin-top h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.prompt-admin-top p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.prompt-admin-profiles {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(96px, 1fr);
  gap: 3px;
  max-width: min(560px, 48vw);
  padding: 4px;
  border: 1px solid rgba(22,22,20,0.18);
  border-radius: 999px;
  background: rgba(255,255,252,0.84);
}

.prompt-admin-profiles button {
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  border-color: transparent;
  color: rgba(22,22,20,0.64);
  background: transparent;
  box-shadow: none;
}

.prompt-admin-profiles button.active {
  color: #fff;
  background: #161614;
  box-shadow: 0 12px 24px rgba(22,22,20,0.16);
}

.prompt-admin-main {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 180px 210px minmax(520px, 1fr);
  gap: 12px;
  overflow: hidden;
}

.prompt-admin-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 18px;
  background: rgba(255,255,252,0.80);
  box-shadow: 0 16px 40px rgba(42,34,24,0.05);
  overflow: hidden;
}

.prompt-label-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.prompt-entry-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.prompt-admin-panel > header,
.prompt-admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prompt-admin-panel > header div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.prompt-admin-panel > header strong,
.prompt-admin-panel-head strong {
  font-size: 14px;
}

.prompt-admin-panel > header span,
.prompt-admin-panel-head span {
  color: var(--muted);
  font-size: 11px;
}

.prompt-tag-list,
.prompt-entry-list {
  min-height: 0;
  max-height: none;
  align-content: start;
  overflow: auto;
  padding-right: 2px;
}

.prompt-tag-list .setting-item,
.prompt-entry-list .setting-item {
  cursor: pointer;
  box-sizing: border-box;
  min-height: 38px;
  padding: 0 11px;
  border-radius: 12px;
  background: rgba(250,248,242,0.76);
}

.prompt-entry-list .setting-item {
  height: 38px;
}

.prompt-tag-item,
.prompt-entry-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.prompt-tag-item strong,
.prompt-entry-item strong {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1;
}

.prompt-tag-item span {
  min-width: 34px;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(22,22,20,0.46);
  font-size: 11px;
  line-height: 1;
}

.prompt-tag-list .setting-item.active,
.prompt-entry-list .setting-item.active {
  border-color: rgba(13,106,93,0.36);
  background: rgba(230,242,238,0.74);
}

.prompt-entry-item.disabled {
  background: rgba(242,238,230,0.68);
}

.prompt-entry-item.disabled strong {
  color: rgba(22,22,20,0.42);
}

.prompt-state-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #0d8a72;
  box-shadow: 0 0 0 4px rgba(13,138,114,0.12);
}

.prompt-entry-item.disabled .prompt-state-dot {
  background: #aaa;
  box-shadow: 0 0 0 4px rgba(153,153,153,0.14);
}

.prompt-inline-fields,
.prompt-tag-editor {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(38,36,30,0.08);
}

.prompt-inline-fields .field {
  margin-bottom: 0;
}

.prompt-tag-editor input[hidden] {
  display: none;
}

.prompt-editor-panel {
  align-content: stretch;
  grid-auto-rows: auto;
  grid-template-rows: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 20px;
  padding-bottom: 24px;
  row-gap: 16px;
}

.prompt-enable-switch,
.prompt-editor-toggle {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(13,106,93,0.16);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(230,242,238,0.66);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.prompt-enable-switch input {
  width: auto;
  margin: 0;
}

.prompt-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.prompt-editor-grid .field,
.prompt-content-field {
  margin-bottom: 0;
}

.prompt-editor-grid textarea,
.prompt-editor-panel > .field textarea {
  min-height: 220px;
}

.prompt-content-field {
  min-height: 260px;
  display: grid;
  gap: 8px;
  grid-template-rows: auto minmax(220px, auto);
  overflow: visible;
  padding-bottom: 0;
}

.prompt-content-field textarea {
  min-height: 220px !important;
  height: 260px;
  align-self: stretch;
  resize: vertical;
  overflow: auto;
}

.prompt-editor-panel .ai-helper {
  margin: 0;
  align-self: start;
}

.prompt-editor-actions {
  justify-content: flex-end;
}

.model-admin-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.model-library-panel,
.model-detail-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 18px;
  background: rgba(255,255,252,0.82);
  box-shadow: 0 16px 40px rgba(42,34,24,0.05);
}

.model-library-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.model-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.model-library-head strong,
.model-library-head span {
  display: block;
}

.model-library-head strong {
  font-size: 15px;
}

.model-library-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.model-card-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.model-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 14px;
  background: rgba(250,248,242,0.72);
  cursor: pointer;
}

.model-card.active,
.model-card:hover {
  border-color: rgba(13,106,93,0.34);
  background: rgba(230,242,238,0.72);
}

.model-card-cover {
  width: 52px;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  color: var(--muted);
  background: #eee8de;
}

.model-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.model-card-cover i {
  font-style: normal;
  font-size: 11px;
}

.model-card-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.model-card-copy strong,
.model-card-copy em,
.model-card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-card-copy strong {
  font-size: 13px;
}

.model-card-copy em,
.model-card-copy small {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.model-detail-panel {
  overflow: hidden;
}

.model-detail-empty,
.model-image-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed rgba(38,36,30,0.14);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(250,248,242,0.58);
}

.model-detail-content {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.model-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.model-detail-head input {
  max-width: 360px;
  font-size: 18px;
  font-weight: 800;
}

.model-detail-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.model-detail-actions {
  display: flex;
  gap: 8px;
}

.model-detail-grid {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(420px, 1fr) 118px;
  gap: 12px;
  align-items: end;
}

.model-drop-zone {
  width: 118px;
  min-height: 0;
  aspect-ratio: 1;
  padding: 10px;
  align-self: end;
  border-radius: 16px;
}

.model-drop-zone strong {
  font-size: 13px;
}

.model-drop-zone small {
  margin-top: 3px;
  font-size: 11px;
}

.model-tags-field,
.model-desc-field {
  margin-bottom: 0;
}

.model-tags-field textarea,
.model-desc-field textarea {
  min-height: 118px;
  height: 118px;
  resize: none;
}

.model-image-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.model-image-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 9px;
  padding: 9px;
  border: 1px solid rgba(38,36,30,0.08);
  border-radius: 15px;
  background: rgba(255,255,252,0.78);
}

.model-image-card.primary {
  border-color: rgba(13,106,93,0.42);
  background: rgba(230,242,238,0.64);
}

.model-image-card.disabled {
  opacity: 0.58;
  filter: saturate(0.72);
}

.model-image-thumb {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #eee8de;
}

.model-image-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.model-image-thumb span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  color: #fff;
  background: rgba(22,22,20,0.68);
  font-size: 11px;
}

.model-image-fields {
  display: grid;
  gap: 7px;
}

.model-image-fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.model-image-fields input,
.model-image-fields textarea {
  width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 12px;
}

.model-image-card footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.model-image-card footer button {
  min-height: 30px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 12px;
}

.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(38,36,30,0.10);
  border-radius: 11px;
  background: rgba(255,255,252,0.86);
  cursor: pointer;
}

.file-action input {
  display: none;
}

/* ===== 账号管理 ==== */
.account-login-page {
  max-width: 420px;
}

.account-admin-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 250px;
  gap: 14px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 210px;
  gap: 18px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.account-settings-workbench {
  height: 100%;
}

.account-roster-panel,
.account-self-panel,
.account-admin-panel,
.account-permission-detail {
  min-width: 0;
  border: 1px solid rgba(38, 36, 30, 0.10);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.82);
}

.account-roster-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: rgba(250, 247, 240, 0.82);
}

.account-roster-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid rgba(38, 36, 30, 0.08);
}

.account-roster-head h3 {
  margin: 0;
  font-size: 17px;
}

.account-roster-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-roster-head > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #0d6f60;
  background: rgba(232, 244, 239, 0.92);
  font-size: 12px;
  font-weight: 800;
}

.account-roster-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.account-roster-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 54px;
  border-radius: 10px;
  border: 1px solid rgba(38, 36, 30, 0.08);
  padding: 8px;
  text-align: left;
  background: rgba(255,255,252,0.72);
  box-shadow: none;
}

.account-roster-item:hover,
.account-roster-item.selected {
  border-color: rgba(13, 111, 96, 0.34);
  background: rgba(232, 244, 239, 0.76);
}

.account-roster-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: #0d6f60;
  font-size: 15px;
  font-weight: 900;
}

.account-roster-copy {
  min-width: 0;
}

.account-roster-copy strong,
.account-roster-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-roster-copy strong {
  font-size: 13px;
}

.account-roster-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.account-self-panel {
  display: flex;
  flex-direction: column;
  align-self: start;
  padding: 18px;
  background: rgba(250, 247, 240, 0.82);
}

.account-self-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: #0d6f60;
  font-size: 18px;
  font-weight: 900;
}

.account-self-panel h3,
.account-admin-panel h3,
.account-permission-detail h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.account-self-head small {
  display: inline-flex;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #936c42;
  background: #f4eadc;
  font-size: 11px;
  font-weight: 700;
}

.account-self-panel .field {
  margin-bottom: 9px;
}

.account-self-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 4px;
}

.account-self-actions button {
  flex: 1;
}

.account-admin-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.account-admin-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  color: #fff;
  background: #151411;
}

.account-admin-head p {
  margin: 6px 0 0;
  color: rgba(255,255,255,0.72);
  font-size: 12px;
}

.account-admin-head .button-row {
  margin: 0;
}

.account-admin-head button {
  min-height: 34px;
  border: 0;
  color: #171611;
  background: #fffdfa;
}

.account-admin-head #saveAccountsBtn {
  color: #171611;
  border: 1px solid rgba(255,255,255,0.28);
  background: #fffdfa;
  box-shadow: 0 10px 20px rgba(0,0,0,0.14);
}

.account-admin-list {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 18px 18px 22px;
  background: rgba(251, 248, 241, 0.62);
}

.account-row {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255,255,252,0.86);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.account-row:hover {
  border-color: rgba(13, 111, 96, 0.28);
}

.account-row.selected {
  border-color: rgba(13, 111, 96, 0.52);
  background: rgba(232, 244, 239, 0.72);
  box-shadow: 0 16px 34px rgba(13, 111, 96, 0.08);
}

.account-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto auto auto;
  align-items: center;
  gap: 8px;
}

.account-row-title {
  min-width: 0;
}

.account-row-title strong,
.account-row-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row-title strong {
  font-size: 14px;
}

.account-row-title span,
.account-permission-count {
  color: var(--muted);
  font-size: 11px;
}

.account-role-pill,
.account-status,
.account-credit-pill,
.account-api-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  color: var(--muted);
  background: #fbf6ed;
  font-size: 11px;
  white-space: nowrap;
}

.account-credit-pill {
  color: #8a5a2f;
  border-color: rgba(138,90,47,0.20);
  background: #f6eadc;
}

.account-api-pill.on {
  color: #0d6f60;
  border-color: rgba(13, 111, 96, 0.18);
  background: rgba(232, 244, 239, 0.92);
}

.account-api-pill.off {
  color: var(--muted);
}

.account-delete-btn {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #a4483d;
  border-color: rgba(164,72,61,0.20);
  background: rgba(255,244,241,0.92);
  font-size: 11px;
  box-shadow: none;
}

.account-delete-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.account-credit-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 11px;
}

.account-credit-line span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,252,0.76);
  border: 1px solid rgba(38,36,30,0.08);
}

.account-status.on {
  color: #0d6f60;
  border-color: rgba(13, 111, 96, 0.16);
  background: rgba(232, 244, 239, 0.92);
}

.account-status.off {
  color: #9a4e43;
  border-color: rgba(154, 78, 67, 0.18);
  background: rgba(255, 244, 241, 0.92);
}

.account-row-main {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr)) 74px;
  gap: 8px;
  align-items: end;
}

.account-row-main label,
.account-permissions label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.account-row-main input,
.account-row-main select {
  width: 100%;
  height: 32px;
  border: 1px solid rgba(38, 36, 30, 0.11);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255,255,255,0.84);
  color: var(--text);
}

.account-row-main .account-active-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  color: var(--text);
}

.account-row-main .account-active-toggle input {
  width: 14px;
  height: 14px;
  padding: 0;
}

.account-row-main .account-api-key-field {
  grid-column: span 2;
}

.account-row-main .account-api-clear {
  color: var(--muted);
}

.account-permissions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.account-permission-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(38, 36, 30, 0.10);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: #fbf6ed;
  cursor: pointer;
}

.account-permission-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.account-permission-chip.active {
  color: #171611;
  border-color: rgba(13, 111, 96, 0.18);
  background: rgba(232, 244, 239, 0.86);
}

.account-row[data-role="owner"] .account-permission-chip {
  opacity: 0.72;
  cursor: default;
}

.account-permission-detail {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  overflow: auto;
  background: rgba(255, 253, 248, 0.86);
}

.account-detail-subtitle {
  margin: -8px 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.account-detail-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid rgba(13, 111, 96, 0.25);
  border-radius: 10px;
  background: rgba(232, 244, 239, 0.82);
}

.account-detail-card strong {
  font-size: 15px;
}

.account-detail-card span {
  color: var(--muted);
  font-size: 12px;
}

.account-detail-section {
  display: grid;
  gap: 9px;
}

.account-detail-section h4 {
  margin: 0;
  font-size: 13px;
}

.account-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-detail-chips button {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  background: #fbf6ed;
  box-shadow: none;
}

.account-detail-chips button.active {
  color: #fff;
  background: #151411;
}

.account-detail-chips button:disabled {
  opacity: 0.58;
  cursor: default;
}

@media (max-width: 1120px) {
  .account-admin-shell {
    grid-template-columns: 1fr;
  }

  .account-settings-grid {
    grid-template-columns: 1fr;
  }

  .account-roster-panel,
  .account-self-panel,
  .account-permission-detail {
    display: none;
  }
}

@media (max-width: 980px) {
  .account-row-main {
    grid-template-columns: 1fr 1fr;
  }
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.72);
  font-size: 13px;
  font-weight: 700;
}
.toggle-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
/* ===== 蒙版/画笔 ==== */
.mask-dialog { width: min(1180px, 96vw); max-width: min(1180px, 96vw); }
.mask-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
.mask-stage {
  position: relative;
  height: min(620px, calc(92vh - 120px));
  min-height: 460px;
  overflow: hidden;
  background: #eee8dc;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: none;
  touch-action: none;
  user-select: none;
}
.mask-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center;
  will-change: transform;
}
.mask-stage img,
.mask-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.mask-stage canvas {
  position: absolute;
  inset: 0;
  cursor: none;
}
.brush-cursor {
  position: absolute;
  z-index: 5;
  border: 1.5px solid rgba(255,255,255,0.95);
  box-shadow: 0 0 0 1px rgba(22,22,20,0.38), 0 8px 22px rgba(22,22,20,0.18);
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.mask-tools-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,0.74);
  box-shadow: var(--shadow-soft);
}
.mask-tools-panel .primary.inline {
  width: 100%;
}
.mini-field {
  margin-bottom: 0;
}

.viewer-dialog {
  width: 100vw;
  height: 100dvh;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}
.viewer-dialog::backdrop { background: rgba(246, 245, 242, 0.26); backdrop-filter: blur(2px); }
.viewer-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 54px 68px 74px;
  box-sizing: border-box;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.viewer-stage:active { cursor: grabbing; }
.viewer-frame {
  position: relative;
  display: inline-block;
  transform-origin: center;
  transition: transform 0.04s linear;
  will-change: transform;
}
.viewer-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 136px);
  max-height: calc(100dvh - 148px);
  aspect-ratio: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  border-radius: 10px;
  box-shadow: 0 26px 78px rgba(58, 48, 34, 0.24), 0 0 0 1px rgba(255,255,255,0.78);
}
.viewer-close {
  position: absolute;
  z-index: 2;
  right: 10px;
  top: 10px;
  background: rgba(255,255,255,0.82);
}

.viewer-delete {
  position: absolute;
  z-index: 3;
  right: 48px;
  top: 10px;
  min-height: 32px;
  padding: 0 12px;
  border-color: rgba(164, 63, 52, 0.28);
  border-radius: 999px;
  color: #9b4032;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 10px 26px rgba(58, 48, 34, 0.14);
}

.viewer-delete:hover {
  color: #fff;
  background: #9b4032;
  transform: none;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 46px;
  height: 64px;
  min-width: 46px;
  min-height: 64px;
  padding: 0;
  border-radius: 999px;
  color: rgba(38,36,30,0.82);
  background: rgba(255,255,255,0.86);
  box-shadow: 0 18px 42px rgba(58, 48, 34, 0.16);
  font-size: 36px;
  line-height: 1;
  transform: translateY(-50%);
}

.viewer-nav.prev { left: 18px; }
.viewer-nav.next { right: 18px; }

.viewer-nav:hover {
  color: #fff;
  background: #161614;
  transform: translateY(-50%);
}

.viewer-nav[hidden],
.viewer-delete[hidden] {
  display: none !important;
}
.viewer-caption {
  position: absolute;
  left: 18px;
  bottom: 14px;
  right: 18px;
  color: rgba(31, 33, 30, 0.58);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Toast 与收尾 ==== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(24px);
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-toast);
  max-width: 560px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(36, 35, 31, 0.9);
  color: #fff;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: 0.18s ease;
}

.toast.persistent {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(680px, calc(100vw - 32px));
  padding: 12px 12px 12px 16px;
}

.toast.error {
  background: rgba(73, 29, 24, 0.96);
  border: 1px solid rgba(255, 202, 184, 0.34);
}

.toast-message {
  flex: 1;
  line-height: 1.55;
  word-break: break-word;
}

.toast-close {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding: 7px 10px;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 1. Keyboard focus ring for buttons — replaces invisible browser default.
      Specificity is 0,1,0 so any component-level :focus-visible rule wins. */
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 2. Soft focus glow for text inputs / selects / textareas — supplements the
      existing border-color change; uses :focus-visible so mouse clicks don't
      trigger the extra ring. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 2px rgba(13, 106, 93, 0.14);
}

/* 3. Disabled form-control styling — opacity + cursor + muted background to
      match the established disabled-button pattern (opacity 0.55 on buttons).
      Scoped to the three native form elements only. */
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  background: rgba(246, 244, 238, 0.72);
}
.header-main-tabs button.active:hover {
  transform: none !important;
  box-shadow: none !important;
}
