/* ==========================================================================
   Packora — 2026-11 视觉系统
   方向：暖纸感画布 + 高对比墨色排版 + 单一酸性绿强调色 + 硬朗细线
   原则：不靠重阴影堆层次，用「留白 + 细线 + 字重对比」建立等级
   ========================================================================== */

:root {
  /* 颜色 */
  --canvas: #f4f1ea;
  --canvas-2: #ece7dd;
  --surface: #fffefb;
  --surface-2: #faf7f1;
  --ink: #14120e;
  --ink-2: #3d382f;
  --muted: #8b8377;
  --line: #e3dcd0;
  --line-strong: #cfc5b4;
  --accent: #c9f04c;
  --accent-soft: #eef9c9;
  --accent-ink: #14120e;
  --danger: #b8331f;
  --danger-soft: #fdeceb;
  --warn: #9a6a0d;
  --warn-soft: #fdf4e0;
  --ok: #2c7a55;
  --ok-soft: #e9f5ee;

  /* 形状 */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* 阴影：只在需要抬起的元素上用 */
  --sh-1: 0 1px 2px rgba(20, 18, 14, 0.05);
  --sh-2: 0 2px 4px rgba(20, 18, 14, 0.04), 0 14px 30px -18px rgba(20, 18, 14, 0.18);
  --sh-3: 0 28px 70px -32px rgba(20, 18, 14, 0.32);

  /* 字体：全部用系统栈，不依赖外链字体（国内首屏不卡） */
  --ff: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    system-ui, sans-serif;
  --ff-mono: ui-monospace, "Cascadia Mono", "SF Mono", "SFMono-Regular", Consolas,
    "Liberation Mono", monospace;

  --topbar-h: 68px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--ff);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 极细纸纹：暖色画布上一点颗粒，避免大面积纯色发“模板感” */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================== 顶栏 ============================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(244, 241, 234, 0.88);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-in {
  max-width: 1560px;
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 3px;
  flex: none;
}

.brand-block h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
}

.brand-block .subtitle {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 分段控件：4 个工作区 */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin: 0 auto;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 560;
  letter-spacing: -0.01em;
  padding: 8px 15px 8px 12px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}

.tab svg {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: 0.72;
}

.tab:hover {
  background: rgba(20, 18, 14, 0.06);
  color: var(--ink);
}

.tab.active {
  background: var(--ink);
  color: #f7f4ec;
  box-shadow: var(--sh-1);
}

.tab.active svg {
  opacity: 1;
}

/* ============================== 主区 ============================== */
.container {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 26px 28px 72px;
  flex: 1;
}

.tab-content {
  display: none;
  animation: rise 0.34s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tab-content.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hidden {
  display: none !important;
}

/* 生成页：左表单 / 右结果 */
.workspace {
  display: grid;
  grid-template-columns: minmax(400px, 500px) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.ws-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ws-form form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ws-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: calc(var(--topbar-h) + 22px);
}

/* ============================== 面板 ============================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--sh-1);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.eyebrow {
  font-family: var(--ff-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--accent);
  border-radius: 7px;
  padding: 2px 7px;
  line-height: 1.5;
  flex: none;
  margin-top: 1px;
}

.panel-title {
  min-width: 0;
}

.panel-title h2 {
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.35;
}

.panel-title p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 3px;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-cta {
  padding: 16px;
  gap: 10px;
  box-shadow: var(--sh-2);
  border-color: var(--line-strong);
  position: sticky;
  bottom: 12px;
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255, 254, 251, 0.94);
}

/* 表单底部留白，避免最后一张卡片被浮动 CTA 压住 */
.ws-form {
  padding-bottom: 4px;
}

.panel-cta .tip {
  text-align: center;
}

/* ============================== 表单控件 ============================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.form-row,
.form-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  font-size: 13px;
  font-weight: 640;
  letter-spacing: -0.008em;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.label-note {
  font-weight: 450;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="url"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  line-height: 1.45;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8377' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 74px;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #b0a89b;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(201, 240, 76, 0.55);
}

input[type="file"] {
  font-size: 12.5px;
  padding: 9px 10px;
  background: var(--surface-2);
}

.tip {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.tip.inline {
  display: inline;
  margin: 0;
}

.tip code,
.lab-form code {
  font-family: var(--ff-mono);
  font-size: 11.5px;
  background: var(--canvas-2);
  border-radius: 5px;
  padding: 1px 5px;
}

/* 单选卡 → 药丸选择器 */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.radio-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 7px 13px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    box-shadow 0.16s ease;
  user-select: none;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.radio-card:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
  box-shadow: var(--sh-1);
}

/* 多选标签 → 药丸 chips */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-label {
  flex: 0 0 100%;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 4px;
}

.tag-label:first-child {
  margin-top: 0;
}

.tag-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 11px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.tag-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tag-item:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.tag-item:has(input:checked) {
  background: var(--accent-soft);
  border-color: #b7d95a;
  color: var(--ink);
  font-weight: 620;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}

.inline-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--ink);
  cursor: pointer;
}

/* 参考图拖放区 */
.ref-drop {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.ref-drop:hover,
.ref-drop.dragover {
  border-color: var(--ink);
  background: #f6fadf;
}

.ref-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ref-hint {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  pointer-events: none;
}

.ref-preview {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.ref-preview img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.ref-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  background: var(--ink);
  color: #f7f4ec;
  border-radius: 6px;
  padding: 2px 7px;
}

.ref-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.image-preview {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
}

.image-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: var(--surface-2);
}

/* 尺寸 / 比例预览 */
.size-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.size-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.size-custom input[type="number"] {
  width: 96px;
  text-align: center;
  font-family: var(--ff-mono);
  font-size: 13px;
}

.size-x,
.size-unit {
  font-size: 12px;
  color: var(--muted);
}

.ratio-preview {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: grid;
  place-items: center;
}

.ratio-preview span {
  display: block;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* 色板 */
.pal-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pal-swatch:empty {
  display: none;
}

.pal-dot {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(20, 18, 14, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36);
  flex: none;
}

.pal-hex {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--ink-2);
  background: var(--canvas-2);
  border-radius: 6px;
  padding: 2px 7px;
}

/* ============================== 按钮 ============================== */
.generate-btn {
  appearance: none;
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -0.01em;
  color: #f7f4ec;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  padding: 15px 18px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.14s ease,
    box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
}

.generate-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.22) 45%,
    transparent 70%
  );
  transform: translateX(-120%);
  transition: transform 0.55s ease;
}

.generate-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: #a9cc3a;
  color: var(--accent-ink);
  box-shadow: var(--sh-2);
}

.generate-btn:hover:not(:disabled)::after {
  transform: translateX(120%);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.generate-btn:disabled {
  background: var(--canvas-2);
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.ghost-btn {
  appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 580;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.ghost-btn:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost-btn.tiny {
  font-size: 11.5px;
  padding: 5px 11px;
}

.ghost-btn.primary {
  background: var(--accent);
  border-color: #b7d95a;
  color: var(--accent-ink);
}

.ghost-btn.primary:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.ghost-btn.danger {
  color: var(--danger);
  border-color: #e7beb8;
}

.ghost-btn.danger:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.load-btn {
  appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 580;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.load-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ============================== 结果舞台 ============================== */
.stage-eyebrow {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}

.stage-empty {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 56px 36px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-h) - 96px);
  box-shadow: var(--sh-1);
}

/* 空状态右上角一团极淡强调光，避免整块死白 */
.stage-empty::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -140px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 240, 76, 0.34), transparent 68%);
  pointer-events: none;
}

#generateTab:has(#resultSection:not(.hidden)) .stage-empty,
#generateTab:has(#suggestionSection:not(.hidden)) .stage-empty {
  display: none;
}

.stage-frame {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  border: 1.5px dashed var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--muted);
  margin-bottom: 18px;
  background: var(--surface-2);
}

.stage-frame svg {
  width: 40px;
  height: 40px;
}

.stage-empty h2 {
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.022em;
}

.stage-empty p {
  font-size: 13px;
  color: var(--muted);
  max-width: 420px;
  line-height: 1.65;
  margin-top: 6px;
}

.stage-hints {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.stage-hints li {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 12px;
}

.stage-hints b {
  font-family: var(--ff-mono);
  font-weight: 600;
  color: var(--ink);
}

.result-section,
.suggestion-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--sh-1);
}

.result-header,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.result-header h2,
.section-head h2 {
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* chips 行尾的动作按钮要和信息 chip 区分开 */
.result-meta .ghost-btn {
  margin-left: auto;
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.result-meta .ghost-btn:hover {
  background: var(--accent);
  border-color: #a9cc3a;
  color: var(--accent-ink);
}

.meta-chip {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  background: var(--canvas-2);
  border-radius: 6px;
  padding: 4px 8px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-chip:empty {
  display: none;
}

.image-container {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.image-container img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  background: var(--surface-2);
}

.image-container:empty {
  display: none;
}

/* 提示词详情 */
.prompt-details {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 11px 14px;
}

.prompt-details summary {
  font-size: 12.5px;
  font-weight: 580;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}

.prompt-details summary::-webkit-details-marker {
  display: none;
}

.prompt-details summary::before {
  content: "＋";
  font-family: var(--ff-mono);
  margin-right: 8px;
  color: var(--muted);
}

.prompt-details[open] summary::before {
  content: "－";
}

.prompt-output {
  font-family: var(--ff-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
}

/* ============================== AI 推荐卡片 ============================== */
.observed-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.obs-line {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.6;
}

.obs-line b {
  font-weight: 620;
  color: var(--ink);
  margin-right: 8px;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggestion-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.suggestion-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-1);
}

.suggestion-card.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(201, 240, 76, 0.5);
}

.sug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sug-title {
  font-size: 13.5px;
  font-weight: 660;
  letter-spacing: -0.015em;
}

.sug-why {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.sug-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.sug-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.sug-row:hover {
  background: var(--accent-soft);
}

.sug-k {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  flex: none;
  width: 76px;
}

.sug-v {
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-word;
}

.sug-foot {
  display: flex;
  justify-content: flex-end;
}

.apply-btn {
  appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid #b7d95a;
  border-radius: var(--r-pill);
  padding: 8px 15px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.apply-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.suggestion-error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

/* ============================== 视频 ============================== */
.video-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.video-head h3 {
  font-size: 13.5px;
  font-weight: 660;
  letter-spacing: -0.015em;
}

.video-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.video-prompt-group textarea {
  background: var(--surface-2);
}

.video-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-container:empty {
  display: none;
}

.video-player {
  width: 100%;
  max-height: 480px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: #000;
  display: block;
}

.video-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.video-progress-bar {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--canvas-2);
  overflow: hidden;
}

.video-progress-bar span {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: var(--r-pill);
  transition: width 0.4s ease;
}

.video-progress-text {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--muted);
}

.video-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================== 账号 ============================== */
.auth-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.user-chip:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-1);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: #f7f4ec;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 640;
  flex: none;
}

.user-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-sm);
  padding: 9px 11px;
}

/* 登录弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 18, 14, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade 0.2s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  box-shadow: var(--sh-3);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.modal-card h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.028em;
}

.modal-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: -8px;
}

.modal-close {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.16s ease, color 0.16s ease;
}

.modal-close:hover {
  background: var(--canvas-2);
  color: var(--ink);
}

.modal-switch {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

.modal-switch a {
  color: var(--ink);
  font-weight: 620;
  text-decoration: none;
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 1px;
  cursor: pointer;
}

/* ============================== 素材库 ============================== */
.lib-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.lib-head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.lib-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.lib-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lib-sec {
  margin-bottom: 26px;
}

.lib-sec > h3 {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 14px;
}

.lib-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.lib-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--sh-2);
}

.lib-cover {
  aspect-ratio: 4 / 3;
  background: var(--canvas-2);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.lib-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lib-noimg {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--muted);
  background: repeating-linear-gradient(
    45deg,
    var(--canvas-2) 0 10px,
    var(--surface-2) 10px 20px
  );
}

.lib-title {
  font-size: 13.5px;
  font-weight: 640;
  letter-spacing: -0.015em;
  padding: 11px 13px 2px;
  line-height: 1.4;
}

.lib-meta {
  font-size: 11.5px;
  color: var(--muted);
  padding: 0 13px 4px;
}

.lib-time {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--muted);
  padding: 0 13px 10px;
}

.lib-actions {
  display: flex;
  gap: 7px;
  padding: 0 13px 13px;
  flex-wrap: wrap;
}

.lib-actions .ghost-btn {
  font-size: 11.5px;
  padding: 6px 11px;
}

.lib-assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}

.lib-asset {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.lib-asset:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-1);
}

.lib-asset img,
.lib-asset video {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--canvas-2);
}

.lib-badge {
  position: absolute;
  left: 7px;
  top: 7px;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  background: rgba(20, 18, 14, 0.88);
  color: #f7f4ec;
  border-radius: 5px;
  padding: 2px 6px;
}

.lib-asset-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
}

.lib-asset-foot a {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--accent);
}

.lib-hint,
.lib-empty {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 40px 28px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.lib-empty h3 {
  font-size: 15px;
  font-weight: 660;
  color: var(--ink);
  margin-bottom: 6px;
}

.rename-input {
  font-size: 12.5px;
  padding: 6px 9px;
  border-radius: var(--r-xs);
}

/* ============================== 设置页 ============================== */
.settings-form {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field-row select {
  flex: 1;
  min-width: 0;
}
.endpoints-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.model-tag {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: var(--ink-2);
  background: var(--canvas-2);
  border-radius: 5px;
  padding: 2px 6px;
}

.add-endpoint {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.add-endpoint input {
  flex: 1 1 220px;
}

/* ============================== 日志面板 ============================== */
.log-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 150;
  width: min(460px, calc(100vw - 40px));
  background: var(--ink);
  border: 1px solid #2b271f;
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  color: #e8e3d8;
  overflow: hidden;
  transition: width 0.22s ease, border-radius 0.22s ease;
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
}

.log-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: var(--ff-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
}

.log-count {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-pill);
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.log-tools {
  display: flex;
  gap: 6px;
}

.log-tools .ghost-btn {
  background: transparent;
  border-color: #4a4438;
  color: #d9d3c6;
  font-size: 11px;
  padding: 4px 9px;
}

.log-tools .ghost-btn:hover {
  background: #f7f4ec;
  border-color: #f7f4ec;
  color: var(--ink);
}

.log-body {
  max-height: 320px;
  overflow: auto;
  border-top: 1px solid #2b271f;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-row {
  display: flex;
  gap: 8px;
  font-family: var(--ff-mono);
  font-size: 11px;
  line-height: 1.6;
  align-items: baseline;
}

.log-ts {
  color: #8d8677;
  flex: none;
}

.log-act {
  color: #f7f4ec;
  font-weight: 600;
  flex: none;
}

.log-det {
  color: #ada596;
  word-break: break-word;
}

.log-row.log-ok .log-act {
  color: var(--accent);
}

.log-row.log-err .log-act,
.log-row.log-err .log-det {
  color: #ff9c8a;
}

.log-row.log-warn .log-act {
  color: #ffd479;
}

.log-row.log-srv .log-act,
.log-row.log-srv .log-det {
  color: #7d7668;
}

.log-empty {
  font-family: var(--ff-mono);
  font-size: 11px;
  color: #7d7668;
  padding: 6px 0;
}

/* 收起时缩成药丸，避免压住表单 */
.log-panel:has(.log-body.hidden) {
  width: auto;
  border-radius: var(--r-pill);
}

.log-panel:has(.log-body.hidden) .log-tools {
  display: none;
}

.log-panel:has(.log-body.hidden) .log-head {
  padding: 7px 14px;
}

/* ============================== 加载态 / 提示 ============================== */
.loading {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
}

.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-sub {
  font-size: 12px;
  color: var(--muted);
}

.error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.warn-line {
  font-size: 12.5px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: var(--r-sm);
  padding: 9px 11px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

/* ============================== 页脚 ============================== */
footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ============================== 响应式 ============================== */
@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .ws-stage {
    position: static;
  }

  .segmented {
    margin: 0;
  }
}

@media (max-width: 900px) {
  .topbar-in {
    gap: 12px;
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .segmented {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .tab {
    flex: 1;
    justify-content: center;
    padding: 8px 6px;
  }

  .brand-block .subtitle {
    display: none;
  }

  .container {
    padding: 18px 16px 64px;
  }
}

@media (max-width: 640px) {
  .form-row,
  .form-row2,
  .video-options {
    grid-template-columns: 1fr;
  }

  .tab span {
    font-size: 12px;
  }

  .tab svg {
    width: 15px;
    height: 15px;
  }

  .stage-empty {
    padding: 38px 20px;
  }

  .log-panel {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================== 商品关联（生成页 04 面板） ============================== */
.link-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 20px;
}

.link-status:empty {
  display: none;
}

.link-chip {
  font-size: 11.5px;
  font-weight: 550;
  border-radius: var(--r-pill);
  padding: 4px 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
}

.link-chip.ok {
  background: var(--accent-soft);
  border-color: #b7d95a;
  color: var(--ink);
}

.link-chip.idle {
  color: var(--muted);
  background: transparent;
  border-style: dashed;
}

.link-chip.mono {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--muted);
}

/* ============================== 素材库：按商品组织 ============================== */
.prod-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 26px;
}

.prod-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--sh-1);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.prod-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-2);
}

.prod-head {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.prod-cover {
  width: 110px;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--canvas-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}

.prod-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.prod-cover .lib-noimg {
  font-size: 10.5px;
}

.prod-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.prod-title {
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prod-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.id-chip {
  font-size: 11px;
  color: var(--ink-2);
  background: var(--canvas-2);
  border-radius: 6px;
  padding: 2px 7px;
}

.id-chip.mono {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.id-chip.idle {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line-strong);
}

.prod-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.link-pill svg {
  width: 11px;
  height: 11px;
  opacity: 0.7;
}

.link-pill:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.link-pill.idle {
  color: var(--muted);
  border-style: dashed;
  border-color: var(--line-strong);
  font-weight: 500;
  cursor: default;
}

.link-pill.google {
  border-color: var(--line-strong);
}

.prod-stats {
  font-size: 11.5px;
  color: var(--muted);
}

.prod-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 视频区 */
.prod-video {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.prod-video-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.prod-video-head h5 {
  font-size: 12px;
  font-weight: 660;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.prod-video-count {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  background: var(--canvas-2);
  border-radius: var(--r-pill);
  padding: 1px 8px;
}

.prod-video-count.muted {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line-strong);
}

.prod-videos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.prod-video-item {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #000;
}

.prod-video-item video {
  display: block;
  width: 100%;
  max-height: 260px;
  background: #000;
}

.prod-video-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  font-size: 10.5px;
  color: #cfc8b9;
  background: var(--ink);
}

.prod-video-foot a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* 无视频空状态 */
.video-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 15px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--muted);
}

.video-empty svg {
  width: 24px;
  height: 24px;
  flex: none;
  opacity: 0.55;
}

.video-empty p {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  margin-right: auto;
}

.video-empty .ghost-btn {
  font-size: 11.5px;
  padding: 6px 12px;
}

/* 商品下的成品区 */
.prod-assets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prod-assets-head {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prod-assets-empty {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.prod-assets .lib-assets {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

@media (max-width: 720px) {
  .prod-head {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .prod-cover {
    width: 76px;
  }

  .prod-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }
}

/* ============================== 门禁横幅 ============================== */
.gate-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: var(--r-md);
  padding: 12px 15px;
  margin-bottom: 18px;
  font-size: 12.8px;
  line-height: 1.55;
  border: 1px solid var(--line);
  background: var(--surface);
}

.gate-banner.hidden {
  display: none;
}

.gate-banner b {
  font-weight: 680;
}

.gate-banner .banner-ico {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--ff-mono);
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.gate-banner.ok {
  background: var(--ok-soft);
  border-color: #bfe0cf;
  color: #1f5c40;
}
.gate-banner.ok .banner-ico { background: var(--ok); color: #fff; }

.gate-banner.warn {
  background: var(--warn-soft);
  border-color: #eed9a8;
  color: #6f4c07;
}
.gate-banner.warn .banner-ico { background: #d9a326; color: #fff; }

.gate-banner.danger {
  background: var(--danger-soft);
  border-color: #f0c4bd;
  color: var(--danger);
}
.gate-banner.danger .banner-ico { background: var(--danger); color: #fff; }

.gate-banner.info {
  background: var(--accent-soft);
  border-color: #cfe596;
  color: var(--ink);
}
.gate-banner.info .banner-ico { background: var(--ink); color: var(--accent); }

.gate-banner .banner-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* ============================== 平台规格提示 ============================== */
.spec-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}

.spec-note:empty {
  display: none;
}

.spec-note-title {
  flex: 0 0 100%;
  font-size: 12px;
  font-weight: 660;
  color: var(--ink);
  margin-bottom: 2px;
}

.spec-item {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
}

.spec-item.mono {
  font-family: var(--ff-mono);
  font-size: 10.5px;
}

.spec-item.warn {
  background: var(--warn-soft);
  border-color: #eed9a8;
  color: #6f4c07;
  flex: 0 0 100%;
}

/* ============================== 选品灵感 ============================== */
.insp-notice {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  margin-bottom: 20px;
}

.insp-sec > h3 {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.insp-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 26px;
}

.insp-empty {
  font-size: 12.5px;
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  text-align: center;
}

.insp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--sh-1);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.insp-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--sh-2);
}

.insp-head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 13px;
}

.insp-cover {
  width: 96px;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--canvas-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}

.insp-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.insp-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insp-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.insp-plat {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 5px;
  padding: 2px 7px;
  text-transform: uppercase;
}

.insp-plat.amazon {
  background: #232f3e;
  color: #ff9900;
}

.insp-plat.temu {
  background: #fb7701;
  color: #fff;
}

.insp-plat.independent {
  background: var(--ink);
  color: #f7f4ec;
}

.insp-region,
.insp-cat,
.insp-curated {
  font-size: 10.5px;
  border-radius: 5px;
  padding: 2px 7px;
  background: var(--canvas-2);
  color: var(--ink-2);
}

.insp-curated {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 620;
}

.insp-title {
  font-size: 14px;
  font-weight: 660;
  letter-spacing: -0.015em;
  line-height: 1.4;
}

.insp-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}

.insp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.insp-tag {
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  color: var(--ink-2);
}

.insp-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.insp-block h5 {
  font-size: 11.5px;
  font-weight: 680;
  color: var(--ink);
  margin-bottom: 5px;
}

.insp-block ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.insp-block li {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-2);
  padding-left: 12px;
  position: relative;
}

.insp-block li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.insp-kw {
  grid-column: 1 / -1;
  font-size: 10.5px;
  color: var(--muted);
  background: var(--canvas-2);
  border-radius: 6px;
  padding: 6px 9px;
  line-height: 1.6;
  word-break: break-word;
}

.insp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.insp-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.insp-sheet {
  max-width: 620px;
  max-height: 88vh;
  overflow: auto;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.insp-suggest {
  background: var(--accent-soft);
  border: 1px solid #cfe596;
  border-radius: var(--r-md);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.insp-suggest h4 {
  font-size: 12.5px;
  font-weight: 680;
}

.insp-suggest .sug-row {
  cursor: default;
}

.prod-share {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
}

.prod-share .mono {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================== 六国标签输出 ============================== */
.ml-countries {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ml-country {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 550;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
}

.ml-country input {
  accent-color: var(--ink);
}

.ml-country:has(input:checked) {
  background: var(--accent-soft);
  border-color: #b7d95a;
}

.ml-flag {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--ink);
  color: #f7f4ec;
  border-radius: 4px;
  padding: 1px 5px;
}

.ml-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.ml-grid:empty {
  display: none;
}

.ml-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ml-item canvas {
  width: 100%;
  height: auto;
  border-radius: 5px;
  background: #fff;
  border: 1px solid var(--line);
}

.ml-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ml-title {
  font-size: 12.5px;
  font-weight: 660;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ml-lang {
  font-weight: 450;
  font-size: 11px;
  color: var(--muted);
}

.ml-sub {
  font-size: 10px;
  color: var(--muted);
  word-break: break-all;
}

.ml-flags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 10.5px;
}

.ml-flags .ok,
.ml-flags .warn,
.ml-flags .err {
  border-radius: 4px;
  padding: 1px 6px;
}

.ml-flags .ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.ml-flags .warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.ml-flags .err {
  background: var(--danger-soft);
  color: var(--danger);
}

.ml-note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--warn);
}

.ml-item-err {
  border-color: #f0c4bd;
  background: var(--danger-soft);
}

.ml-all {
  grid-column: 1 / -1;
  justify-self: start;
}

/* ============================== 页脚补充 ============================== */
.footer-sub {
  margin-top: 6px;
  font-size: 11.5px;
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.footer-link:hover {
  color: var(--ink);
}

@media (max-width: 720px) {
  .insp-body {
    grid-template-columns: 1fr;
  }

  .insp-head {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .insp-cover {
    width: 74px;
  }
}

/* 参考图还原度（出图规格）：一行按钮 + 状态，状态用等宽数字便于核对比例 */
.fidelity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.fidelity-row .ghost-btn {
  padding: 7px 14px;
  border: 1px solid var(--line-strong, #d8d2c4);
  border-radius: 999px;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink, #14120e);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}
.fidelity-row .ghost-btn:hover:not(:disabled) {
  background: rgba(20, 18, 14, 0.06);
  border-color: var(--ink, #14120e);
}
.fidelity-row .ghost-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.fidelity-state {
  flex: 1 1 320px;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-soft, #6b6559);
  font-variant-numeric: tabular-nums;
}
.fidelity-state b {
  color: var(--ink, #14120e);
  font-weight: 700;
}

/* ============ 调色盘 / 多配色批量 / 标签优先 / 瓶型控件 ============ */
.palette-mixer {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
}
.mixer-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.mixer-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: var(--canvas, #f4f1ea);
  border: 1px solid transparent;
  transition: border-color 140ms ease;
}
.mixer-slot:hover { border-color: var(--line-strong, #d8d2c4); }
.mixer-slot.is-off { opacity: 0.5; }
.mixer-slot input[type="color"] {
  width: 100%;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line-strong, #d8d2c4);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}
.mixer-slot input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.mixer-slot input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }
.mixer-name { font-size: 0.76rem; font-weight: 600; color: var(--ink, #14120e); }
.mixer-hex {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.74rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft, #6b6559);
}
.mixer-hex.invalid { border-color: #d94f4f; background: #fdf3f3; }
.mixer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.mixer-actions .ghost-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--line-strong, #d8d2c4);
  border-radius: 999px;
  background: transparent;
  color: var(--ink, #14120e);
  cursor: pointer;
}
.mixer-actions .ghost-btn:hover:not(:disabled) { background: rgba(20, 18, 14, 0.06); }
.mixer-actions .ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mixer-state { flex: 1 1 240px; font-size: 0.76rem; color: var(--ink-soft, #6b6559); line-height: 1.5; }

.palette-batch { margin-top: 14px; }
.batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink, #14120e);
}
.batch-head .ghost-btn {
  padding: 4px 10px;
  font-size: 0.74rem;
  border: 1px solid var(--line-strong, #d8d2c4);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.batch-head .ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.batch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.batch-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 999px;
  background: #fff;
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.batch-item.on { border-color: var(--ink, #14120e); background: #fffef9; }
.batch-item input { accent-color: #14120e; }
.batch-dots { display: inline-flex; gap: 2px; }
.batch-dots i { width: 8px; height: 8px; border-radius: 2px; border: 1px solid rgba(0, 0, 0, 0.12); }
.batch-name { color: var(--ink-soft, #6b6559); }
.chip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; border: 1px solid rgba(0, 0, 0, 0.12); }

/* 多配色批量结果 */
.batch-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.batch-card {
  margin: 0;
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.batch-card img { display: block; width: 100%; height: auto; }
.batch-card figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  font-size: 0.76rem;
}
.batch-title { flex: 1; font-weight: 600; color: var(--ink, #14120e); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-sub { color: var(--ink-soft, #6b6559); font-variant-numeric: tabular-nums; }
.ghost-btn.mini { padding: 3px 9px; font-size: 0.72rem; border: 1px solid var(--line-strong, #d8d2c4); border-radius: 999px; background: transparent; cursor: pointer; }

/* 标签优先工位 */
.label-first { margin-top: 4px; }
.bottle-row input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line-strong, #d8d2c4);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
@media (max-width: 820px) {
  .mixer-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 门禁拦截反馈：按钮短暂变红，避免静默拦截（点了没反应） */
.generate-btn.gate-blocked,
button.gate-blocked {
  background: #d94f4f !important;
  color: #fff !important;
  border-color: #d94f4f !important;
  cursor: not-allowed;
}

/* 六国合并图（白底送印 / 黑底贴瓶） */
.ml-sheet-box {
  margin: 16px 0 4px;
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}
.ml-sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line, #e2ddd0);
}
.ml-sheet-head h3 { margin: 0; font-size: 0.94rem; font-weight: 700; color: var(--ink, #14120e); }
.ml-sheet-meta { font-size: 0.78rem; color: var(--ink-soft, #6b6559); font-variant-numeric: tabular-nums; }
.ml-sheet-stage {
  padding: 14px;
  background: repeating-conic-gradient(#f1efe8 0% 25%, #faf9f5 0% 50%) 50% / 18px 18px;
  overflow-x: auto;
}
.ml-sheet-img { display: block; width: 100%; height: auto; border: 1px solid rgba(0, 0, 0, 0.08); }
.ml-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line, #e2ddd0); }
.ml-sheet-actions .ghost-btn { padding: 7px 14px; font-size: 0.8rem; border: 1px solid var(--line-strong, #d8d2c4); border-radius: 999px; background: transparent; cursor: pointer; }
.ml-sheet-actions .ghost-btn.primary { background: var(--ink, #14120e); color: #fff; border-color: var(--ink, #14120e); }

/* 六国标签模板编辑面板 */
.ml-tpl-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 12px;
}
.ml-tpl-head .ghost-btn {
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--line-strong, #d8d2c4);
  border-radius: 999px;
  background: transparent;
  color: var(--ink, #14120e);
  cursor: pointer;
}
.ml-tpl-state { font-size: 0.78rem; color: var(--ink-soft, #6b6559); }
.ml-tpl-panel {
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 14px;
  background: #fffef9;
  padding: 14px;
  margin-bottom: 14px;
}
.tpl-section + .tpl-section { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line, #e2ddd0); }
.tpl-section h4 {
  margin: 0 0 10px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink, #14120e);
}
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.tpl-field { display: flex; flex-direction: column; gap: 5px; }
.tpl-field > span {
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-soft, #6b6559);
  letter-spacing: 0.02em;
}
.tpl-field input,
.tpl-field textarea {
  width: 100%;
  padding: 7px 9px;
  font-size: 0.78rem;
  font-family: inherit;
  line-height: 1.45;
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 9px;
  background: #fff;
  color: var(--ink, #14120e);
  resize: vertical;
}
.tpl-field input:focus,
.tpl-field textarea:focus { outline: 2px solid rgba(20, 18, 14, 0.14); border-color: var(--line-strong, #d8d2c4); }
.tpl-fact-head,
.tpl-fact-row { display: grid; grid-template-columns: 2fr 1fr 0.7fr 44px; gap: 8px; align-items: center; }
.tpl-fact-head {
  font-size: 0.7rem;
  color: var(--ink-soft, #6b6559);
  padding: 0 2px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tpl-fact-rows { display: flex; flex-direction: column; gap: 6px; }
.tpl-fact-row input {
  padding: 6px 8px;
  font-size: 0.76rem;
  border: 1px solid var(--line, #e2ddd0);
  border-radius: 8px;
  background: #fff;
}
.tpl-fact-actions { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.ghost-btn.tiny { padding: 5px 11px; font-size: 0.74rem; border: 1px solid var(--line-strong, #d8d2c4); border-radius: 999px; background: transparent; cursor: pointer; }
.tpl-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tpl-actions .ghost-btn { padding: 8px 16px; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--line-strong, #d8d2c4); border-radius: 999px; background: transparent; cursor: pointer; }
.tpl-actions .ghost-btn.primary { background: var(--ink, #14120e); color: #fff; border-color: var(--ink, #14120e); }
@media (max-width: 820px) {
  .tpl-grid { grid-template-columns: 1fr; }
}

/* 六国内容溢出时的一键修法 */
.ml-fix-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid #e6c9a8;
  border-radius: 12px;
  background: #fdf6ec;
  font-size: 0.8rem;
  color: #7a5a2e;
}
.ml-fix-box .ghost-btn {
  padding: 6px 13px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #d9b98c;
  border-radius: 999px;
  background: #fff;
  color: #7a5a2e;
  cursor: pointer;
}

/* ==========================================================================
   2026-11 三栏布局（左栏导航 / 中栏内容 / 右栏预览）
   —— 覆盖文件前面的单列与两栏规则，不改动原组件样式，避免影响既有逻辑
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  min-height: 100vh;
  align-items: stretch;
}

body.rail-collapsed .app {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app > .topbar {
  grid-column: 2;
  grid-row: 1;
}

.app > .container {
  grid-column: 2;
  grid-row: 2;
  max-width: none;
  width: 100%;
  /* 底部留出悬浮操作条的高度，最后一行内容不会被压住 */
  padding: 22px 26px 112px;
  overflow-x: hidden;
}

/* ---------------- 左栏 ---------------- */
.rail {
  grid-column: 1;
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 70;
  overflow: hidden;
  transition: width 180ms ease, transform 180ms ease;
}

body.rail-collapsed .rail {
  width: 0;
  border-right: none;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.rail-brand .brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.rail-brand .brand-text h1 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rail-brand .subtitle {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.rail-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rail-scroll::-webkit-scrollbar { width: 6px; }
.rail-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.rail-group { display: flex; flex-direction: column; gap: 6px; }

.rail-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.rail-counter {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--canvas-2);
  border-radius: 999px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

/* 一级：模块列表（竖向） */
.rail-nav.segmented {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin: 0;
  padding: 0;
  width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.rail-nav .tab {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  flex: 0 0 auto;
  margin: 0;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}

.rail-nav .tab svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  opacity: 0.72;
}

.rail-nav .tab:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.rail-nav .tab.active {
  background: var(--ink);
  color: #f7f4ec;
  border-color: var(--ink);
  box-shadow: none;
}

.rail-nav .tab.active svg { opacity: 1; }

/* 二级：当前模块的步骤 */
.rail-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.rail-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 8px 10px 8px 8px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease;
}

.rail-step:hover { background: var(--surface-2); }

.rail-step.is-current {
  background: var(--canvas-2);
  border-color: var(--line-strong);
}

.rail-step-no {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.rail-step.is-current .rail-step-no {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.rail-step.is-done:not(.is-current) .rail-step-no {
  background: var(--ok-soft);
  border-color: #bcdcc8;
  color: var(--ok);
}

.rail-step-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.rail-step-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.35;
}

.rail-step.is-current .rail-step-title { color: var(--ink); }

.rail-step-desc {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 三级：当前步骤内的字段分组 */
.rail-substeps {
  list-style: none;
  margin: 4px 0 6px 18px;
  padding-left: 9px;
  border-left: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rail-substep {
  display: block;
  width: 100%;
  padding: 4px 8px;
  border-radius: 7px;
  background: transparent;
  border: none;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  line-height: 1.4;
}

.rail-substep:hover { background: var(--surface-2); color: var(--ink-2); }
.rail-substep.is-visible { color: var(--ink); font-weight: 600; }

.rail-foot {
  flex: 0 0 auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.rail-foot .auth-area { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------- 顶栏（上下文条） ---------------- */
.topbar-in {
  max-width: none;
  padding: 0 22px;
  gap: 14px;
  justify-content: space-between;
}

.rail-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  flex: 0 0 auto;
}

.rail-toggle svg { width: 17px; height: 17px; }
.rail-toggle:hover { border-color: var(--line-strong); color: var(--ink); }

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.crumb-mod {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.crumb-sep { color: var(--line-strong); }

.crumb-step {
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.head-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.topbar-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.topbar-btn svg { width: 16px; height: 16px; }
.topbar-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.topbar-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------------- 中栏 + 右栏 ---------------- */
.workspace {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  gap: 22px;
  align-items: start;
}

.lab-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  gap: 22px;
  align-items: start;
}

/* 一次只显示一步 */
.step-off { display: none !important; }

/* 右栏常驻 */
.ws-stage,
.lab-preview {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 34px);
  overflow-y: auto;
  padding-right: 2px;
}

.ws-stage::-webkit-scrollbar,
.lab-preview::-webkit-scrollbar { width: 6px; }
.ws-stage::-webkit-scrollbar-thumb,
.lab-preview::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

/* 操作条：贴在中栏底部 */
.ws-form .panel-cta {
  position: sticky;
  bottom: 10px;
  z-index: 20;
  background: rgba(255, 254, 251, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  box-shadow: var(--sh-2);
}

/* 窄屏：左栏变抽屉，中右栏单列 */
@media (max-width: 1180px) {
  .app { grid-template-columns: 0 minmax(0, 1fr); }
  .app > .topbar { grid-column: 1 / -1; }
  .app > .container { grid-column: 1 / -1; }
  .rail {
    position: fixed;
    left: 0;
    top: 0;
    width: 274px;
    transform: translateX(-100%);
    box-shadow: var(--sh-3);
  }
  .rail.is-open { transform: none; }
  body.rail-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 14, 0.28);
    z-index: 65;
  }
}

@media (max-width: 1024px) {
  .workspace,
  .lab-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .ws-stage,
  .lab-preview {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .app > .container { padding: 16px 14px 48px; }
  .topbar-in { padding: 0 14px; }
  .rail { width: min(86vw, 300px); }
}

/* 三级分组被点击时的定位提示 */
.group-ping {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 10px;
  transition: outline-color 300ms ease;
}

/* ==========================================================================
   浮窗系统（侧窗 / 模态 / 气泡 / 轻提示）
   ========================================================================== */
.pfw {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  pointer-events: none;
}

.pfw[hidden] { display: none; }
.pfw.is-open { pointer-events: auto; }

.pfw-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 14, 0.30);
  opacity: 0;
  transition: opacity 190ms ease;
}

.pfw.is-open .pfw-mask { opacity: 1; }

.pfw-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--sh-3);
  min-height: 0;
}

/* 侧窗：从右侧滑出 */
.pfw-sheet { justify-content: stretch; }

.pfw-sheet .pfw-card {
  margin-left: auto;
  width: var(--pfw-w, 520px);
  max-width: min(96vw, 720px);
  height: 100%;
  border-radius: 0;
  border-right: none;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.22, 0.75, 0.2, 1);
}

.pfw-sheet.is-open .pfw-card { transform: none; }

/* 模态：居中浮窗 */
.pfw-modal { align-items: center; justify-content: center; }

.pfw-modal .pfw-card {
  width: var(--pfw-w, 680px);
  max-width: min(94vw, 1000px);
  max-height: min(88vh, var(--pfw-h, 88vh));
  border-radius: var(--r-lg);
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  transition: opacity 180ms ease, transform 200ms cubic-bezier(0.22, 0.75, 0.2, 1);
}

.pfw-modal.is-open .pfw-card { opacity: 1; transform: none; }

.pfw-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.pfw-head-text { flex: 1 1 auto; min-width: 0; }

.pfw-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.pfw-sub {
  margin-top: 3px;
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
}

.pfw-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.pfw-close svg { width: 15px; height: 15px; }
.pfw-close:hover { border-color: var(--ink); color: var(--ink); }

.pfw-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pfw-body::-webkit-scrollbar { width: 8px; }
.pfw-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.pfw-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.pfw-foot[hidden] { display: none; }

.pfw-btn {
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.pfw-btn:hover { border-color: var(--ink); }
.pfw-btn.primary { background: var(--ink); color: #f7f4ec; border-color: var(--ink); }
.pfw-btn.primary:hover { opacity: 0.9; }
.pfw-btn.danger { color: var(--danger); border-color: #e7c4bd; }

.pfw-note { font-size: 0.74rem; color: var(--muted); }

body.pfw-active { overflow: hidden; }

/* 提示气泡 */
.pf-bubble {
  position: fixed;
  z-index: 1200;
  max-width: min(340px, 84vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ink);
  color: #f7f4ec;
  font-size: 0.78rem;
  line-height: 1.6;
  box-shadow: var(--sh-2);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}

.pf-bubble.is-in { opacity: 1; transform: none; }
.pf-bubble p { margin: 0; }
.pf-bubble a { color: var(--accent); }

/* 行内问号 */
.pf-hint { display: inline-flex; align-items: center; margin-left: 5px; vertical-align: middle; }

.pf-hint-btn {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: help;
  opacity: 0.75;
}

.pf-hint-btn svg { width: 14px; height: 14px; }
.pf-hint-btn:hover { color: var(--ink); opacity: 1; }

/* 轻提示 */
.pf-toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}

.pf-toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: min(400px, 80vw);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: #f7f4ec;
  font-size: 0.79rem;
  line-height: 1.55;
  box-shadow: var(--sh-2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: auto;
}

.pf-toast.is-in { opacity: 1; transform: none; }

.pf-toast-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.pf-toast.ok .pf-toast-dot { background: #7ee0a8; }
.pf-toast.warn .pf-toast-dot { background: #f2c14e; }
.pf-toast.error .pf-toast-dot { background: #ff7a63; }

/* ==========================================================================
   三栏收尾：操作条悬浮、去掉底部无用块、侧边栏登录
   ========================================================================== */
/* 内容区底部那块 CTA 不再占版面：按钮移到悬浮工具条 */
.ws-form .panel-cta,
.lab-form .panel-cta,
.settings-form .panel-cta {
  display: none !important;
}

.floatbar {
  position: fixed;
  left: calc(268px + 26px);
  bottom: 18px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(255, 254, 251, 0.95);
  border: 1px solid var(--line-strong);
  box-shadow: var(--sh-2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: left 180ms ease;
}

body.rail-collapsed .floatbar { left: 26px; }

.floatbar-hint {
  font-size: 0.74rem;
  color: var(--muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floatbar .generate-btn {
  padding: 9px 20px;
  font-size: 0.84rem;
  width: auto;
  min-width: 132px;
}

.floatbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.floatbar-btn:hover { border-color: var(--ink); color: var(--ink); }
.floatbar-btn svg { width: 15px; height: 15px; }

/* 侧边栏底部：账号入口 */
.rail-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.rail-user:hover { border-color: var(--line-strong); background: var(--surface); }

.rail-avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #f7f4ec;
  font-size: 0.78rem;
  font-weight: 700;
}

.rail-user-text { min-width: 0; flex: 1 1 auto; }
.rail-user-name {
  display: block;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-user-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-user-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.rail-user.is-guest .rail-avatar { background: var(--canvas-2); color: var(--muted); }
.rail-user.is-guest .rail-user-dot { background: var(--line-strong); }

.rail-auth-actions { display: flex; gap: 6px; margin-top: 8px; }

.rail-auth-actions button {
  flex: 1;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.rail-auth-actions button.primary { background: var(--ink); color: #f7f4ec; border-color: var(--ink); }

/* 顶栏快捷键按钮 */
.kbd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
}

.kbd-btn:hover { border-color: var(--ink); color: var(--ink); }
.kbd-btn kbd {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--canvas-2);
  border: 1px solid var(--line);
}

/* 快捷键表 */
.kbd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 18px;
  font-size: 0.8rem;
}

.kbd-grid dt { color: var(--ink-2); }
.kbd-grid dd { margin: 0; text-align: right; }
.kbd-grid dd kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 7px;
  margin-left: 4px;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  text-align: center;
  border-radius: 6px;
  background: var(--canvas-2);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

/* 命令面板（Ctrl/⌘+K） */
.cmdk-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}

.cmdk-input:focus { outline: 2px solid rgba(20, 18, 14, 0.12); }

.cmdk-list { display: flex; flex-direction: column; gap: 2px; }

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 0.83rem;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.cmdk-item:hover,
.cmdk-item.is-active { background: var(--canvas-2); border-color: var(--line-strong); color: var(--ink); }
.cmdk-item small { margin-left: auto; font-size: 0.7rem; color: var(--muted); }

@media (max-width: 1180px) {
  .floatbar { left: 16px; right: 16px; }
  .pfw-sheet .pfw-card { max-width: 100vw; }
}

/* 尺寸选择：比例卡片（替代纯文字 select） */
.visually-hidden-select {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.size-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.size-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 140ms ease, background 140ms ease;
}

.size-card:hover { border-color: var(--line-strong); background: var(--surface-2); }

.size-card.is-on {
  border-color: var(--ink);
  background: #fffdf6;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.size-card-glyph {
  flex: 0 0 auto;
  border-radius: 3px;
  border: 1.6px solid var(--ink-2);
  background: var(--canvas-2);
}

.size-card.is-on .size-card-glyph { border-color: var(--ink); background: var(--accent-soft); }
.size-card-glyph.is-custom { display: grid; place-items: center; width: 26px; height: 20px; font-size: 0.7rem; color: var(--muted); }

.size-card-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.size-card-text b { font-size: 0.76rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.size-card-text i { font-style: normal; font-size: 0.66rem; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 长列表搜索 */
.select-search { margin-bottom: 6px; }

.select-search input {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-family: inherit;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.select-search input::placeholder { color: var(--muted); }
.select-search input:focus { outline: 2px solid rgba(20, 18, 14, 0.12); border-color: var(--line-strong); }

/* 日志浮窗内部 */
.pfw-log-host .log-body { max-height: none; }

/* 顶部工具栏按钮组紧凑 */
.head-right .kbd-btn { margin-right: 2px; }

/* 面板标题行给说明问号留位置 */
.panel-title h2 { display: flex; align-items: center; gap: 4px; }

/* 六国合并图浮窗内部 */
.ml-sheet-float { display: flex; flex-direction: column; gap: 12px; }
.ml-sheet-float .ml-sheet-stage { padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: repeating-conic-gradient(#f1efe8 0% 25%, #faf9f5 0% 50%) 50% / 18px 18px; }
.ml-sheet-float .ml-sheet-img { width: 100%; height: auto; }

/* 模板浮窗里的分组标题 */
.pfw-body .tpl-section { margin-bottom: 16px; }
.pfw-body .tpl-section:last-child { margin-bottom: 0; }

/* 模板浮窗：中文名 + 英文键名，长字段整行 */
.tpl-field-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-2);
}

.tpl-field-name i {
  font-style: normal;
  font-family: var(--ff-mono);
  font-size: 0.64rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.tpl-field.is-wide { grid-column: 1 / -1; }

.tpl-grid .tpl-field textarea {
  min-height: 62px;
  resize: vertical;
}

/* 浮窗里的字段不再嵌套滚动 */
.pfw-body .tpl-field textarea,
.pfw-body .tpl-field input { max-height: none; }

/* 提交时缺的字段：滚到它并短暂标红，避免「点了没反应」 */
.field-missing {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(184, 51, 31, 0.14) !important;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

/* 三层：面板内的分组芯片 */
.panel-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 12px;
}

.sub-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.sub-chip:hover { border-color: var(--line-strong); color: var(--ink); }

.sub-chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f4ec;
}

.sub-off { display: none !important; }

@media (max-width: 640px) {
  .panel-subs { padding: 0 14px 10px; }
}

/* 旧日志浮块退役：日志已改成浮窗（Ctrl+L / 底部工具条），这里只保留 DOM 给脚本用 */
.log-panel { display: none !important; }

/* 门禁横幅：压成一行紧凑提示，不再占一大块首屏 */
.gate-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px !important;
  margin-bottom: 14px;
  border-radius: 12px !important;
  font-size: 0.79rem;
  line-height: 1.5;
}

.gate-banner > * { min-width: 0; }

.gate-banner b { font-weight: 700; }

.gate-banner .gate-actions,
.gate-banner button {
  margin-left: auto;
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .gate-banner { flex-wrap: wrap; }
  .gate-banner .gate-actions,
  .gate-banner button { margin-left: 0; }
}

/* 中栏内容不足一屏时，让预览区与表单顶部对齐，视觉重心不下坠 */
.ws-form, .lab-form { align-self: start; }
