/* 速笔生章 — 设计 token 体系 (M1.1)
 * 编辑设计感现代数据看板：克制 / 墨色 / 骨白 / 留白 / 节奏
 * 单浅色主题（不引入暗色 / 自动跟随）。
 */

:root {
  /* --- 基础语义色（浅色默认） --- */
  --surface: #f6f4ee;            /* 骨白 — 卡片底 */
  --surface-soft: #efede5;       /* 次级面板底 */
  --surface-raised: #ffffff;     /* 抬起卡 / 模态 */
  --bg: var(--surface);          /* 页面底（兼容旧 --bg 引用） */
  --ink: #0f1311;                /* 墨色 — 主文字 */
  --ink-strong: #050807;        /* 标题 / 强对比 */
  --ink-muted: #313a36;          /* 次级文字（旧 label 色） */
  --muted: #5a625e;              /* 三级文字（兼容旧 --muted） */
  --line: #d8ddd7;               /* 1px 分割线（兼容旧 --line） */
  --line-soft: #e6e8e0;          /* 浅分割 */

  /* --- 品牌与状态（墨青 / 品红） --- */
  --accent: #1f4e4a;             /* 烟青（主品牌，旧 --accent 重定向） */
  --accent-strong: #0f3a37;      /* 强对比（兼容旧 --accent-strong） */
  --accent-soft: #d9e7e5;        /* 浅底纹 */
  --accent-emphasis: #b8336a;    /* 品红 — 高权重 CTA */
  --accent-emphasis-strong: #8c1f4f;

  /* --- 状态五态（角色层） --- */
  --status-running: #1f4e4a;
  --status-ready: #2f7a55;
  --status-failed: #b04a3a;
  --status-needs-review: #c08a2a;
  --status-empty: #8a857a;
  --status-running-soft: #d9e7e5;
  --status-ready-soft: #dfece3;
  --status-failed-soft: #f0dad5;
  --status-needs-review-soft: #f5e6cd;
  --status-empty-soft: #e8e6df;

  /* --- 语义色 --- */
  --success: #287049;
  --success-soft: #dfece3;
  --warn: #7a5213;               /* 兼容旧 --warn */
  --warn-soft: #f5e6cd;
  --danger: #b04a3a;             /* 兼容旧 --danger */
  --danger-soft: #f0dad5;
  --info: #3a6ea5;
  --info-soft: #d8e3f0;

  /* --- 阴影 / 焦点 / 选区 --- */
  --shadow-1: 0 1px 2px rgba(15, 19, 17, 0.04), 0 2px 6px rgba(15, 19, 17, 0.04);
  --shadow-2: 0 4px 12px rgba(15, 19, 17, 0.08), 0 12px 28px rgba(15, 19, 17, 0.06);
  --shadow-3: 0 12px 32px rgba(15, 19, 17, 0.14), 0 24px 56px rgba(15, 19, 17, 0.10);
  --shadow: var(--shadow-2);     /* 兼容旧 --shadow 引用 */
  --focus-ring: 0 0 0 3px rgba(31, 78, 74, 0.32);
  --focus-ring-danger: 0 0 0 3px rgba(176, 74, 58, 0.32);
  --selection-bg: rgba(31, 78, 74, 0.18);

  /* --- 圆角 --- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;                 /* 兼容旧 --radius */
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* --- 间距节奏 (8 / 12 / 16 / 24 / 32) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* --- 类型尺度 (type scale) --- */
  --font-display: "Fraunces", "Lora", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Inter", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Menlo", "Consolas", ui-monospace, monospace;

  --text-12: 12px;
  --text-13: 13px;
  --text-14: 14px;
  --text-16: 16px;
  --text-20: 20px;
  --text-28: 28px;
  --text-40: 40px;
  --text-56: 56px;
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;
  --leading-display: 1.05;

  /* --- 动效 (motion) --- */
  --ease-editorial: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-emphasis: cubic-bezier(0.32, 0.72, 0, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;

  /* --- 4 档断点（JS 监听用，CSS @media 见底部） --- */
  --bp-desktop: 1320px;
  --bp-laptop: 1024px;
  --bp-tablet: 768px;
  --bp-mobile: 480px;

  color-scheme: light;
  --bg: var(--surface);          /* 二次保险：旧 var(--bg) 仍可用 */
  font-family: var(--font-body);
}

/* === 旧 token 兼容垫片（保证 100+ 处旧 var() 不崩） ===
   新代码请直接用语义层 / 角色层 / 类型 / 动效 token。 */
:root {
  --bg: var(--surface);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(640px 220px at 12% 18%, rgba(31, 122, 88, 0.055), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 247, 0.98)),
    var(--bg);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  opacity: 0.12;
}

body::before {
  left: -40px;
  top: 116px;
  width: 410px;
  height: 150px;
  background:
    radial-gradient(ellipse at 72% 78%, rgba(83, 97, 91, 0.62) 0 8px, transparent 9px),
    radial-gradient(ellipse at 84% 75%, rgba(83, 97, 91, 0.5) 0 6px, transparent 7px),
    radial-gradient(ellipse at 68% 92%, rgba(83, 97, 91, 0.34) 0 68px, transparent 69px),
    radial-gradient(ellipse at 88% 96%, rgba(83, 97, 91, 0.28) 0 46px, transparent 47px),
    linear-gradient(178deg, transparent 71%, rgba(83, 97, 91, 0.28) 72% 74%, transparent 75%);
}

body::after {
  right: -20px;
  bottom: 16px;
  width: 430px;
  height: 170px;
  background:
    radial-gradient(ellipse at 62% 82%, rgba(83, 97, 91, 0.62) 0 7px, transparent 8px),
    radial-gradient(ellipse at 78% 78%, rgba(83, 97, 91, 0.5) 0 5px, transparent 6px),
    radial-gradient(ellipse at 58% 96%, rgba(83, 97, 91, 0.34) 0 70px, transparent 71px),
    radial-gradient(ellipse at 82% 96%, rgba(83, 97, 91, 0.26) 0 50px, transparent 51px),
    linear-gradient(178deg, transparent 73%, rgba(83, 97, 91, 0.26) 74% 76%, transparent 77%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  padding: 0 18px;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
  box-shadow: 0 10px 22px rgba(31, 122, 88, 0.18);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-strong);
  box-shadow: none;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  padding: 9px 12px;
  resize: vertical;
}

input[readonly] {
  background: #fbfcfb;
  color: var(--accent-strong);
  font-weight: 600;
}

.target-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
}

.target-field input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.target-field > span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #fbfcfb;
  color: var(--muted);
  font-weight: 500;
}

input[type="file"] {
  color: transparent;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  border: 0;
  border-radius: 6px;
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(31, 122, 88, 0.2);
  outline-offset: 2px;
}

label {
  display: grid;
  gap: 6px;
  color: #313a36;
  font-size: 13px;
  font-weight: 600;
}

.control-hint {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-shell {
  width: min(100% - 2px, 1548px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0;
  border-inline: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.main-panel {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto auto 1fr;
}

.app-header {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 116px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  position: relative;
  width: 48px;
  height: 62px;
}

.brand-mark::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 3px;
  width: 10px;
  height: 45px;
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, #151c19 0 67%, #d9c59b 68% 100%);
  transform: rotate(23deg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 7px;
  width: 38px;
  height: 12px;
  border-bottom: 2px solid #151c19;
  border-radius: 50%;
  transform: rotate(-8deg);
}

.brand-mark span {
  position: absolute;
  left: 8px;
  bottom: 4px;
  width: 30px;
  height: 8px;
  border-bottom: 1px solid rgba(21, 28, 25, 0.55);
  border-radius: 50%;
  transform: rotate(-13deg);
}

.brand-lockup h1 {
  margin: 0;
  font-size: 31px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.12;
}

.brand-lockup p {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 17px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-label {
  color: var(--muted);
  font-size: 13px;
}

.theme-toggle {
  min-height: 36px;
  min-width: 36px;
  padding: 0 10px;
  font-size: 16px;
  line-height: 1;
}

.theme-toggle-icon {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 16px;
}

.command-band {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(200px, 0.82fr) minmax(230px, 1fr) minmax(210px, 0.72fr) minmax(220px, 0.84fr);
  gap: 20px;
  align-items: end;
}

.upload-control {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 0;
  align-items: end;
}

.command-upload {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
}

.command-upload::before {
  content: "X";
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, #16875f, #0c6847);
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  box-shadow: inset -7px 0 0 rgba(255, 255, 255, 0.18);
}

.command-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-read-button {
  min-height: 62px;
  border-left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  color: #53615b;
  padding-inline: 12px;
  white-space: nowrap;
}

.start-button {
  min-height: 62px;
  min-width: 210px;
  background: linear-gradient(180deg, #16805b, #0f684a);
  box-shadow: 0 14px 26px rgba(31, 122, 88, 0.22);
  font-size: 19px;
}

.start-button:disabled {
  border: 1px solid #dce3dd;
  background: #dfe7e2;
  color: #7d8a84;
  box-shadow: none;
  opacity: 1;
}

.status-strip {
  grid-column: 2 / -1;
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 0;
}

.status-strip.error {
  color: var(--danger);
}

.progress-ribbon {
  display: grid;
  grid-template-columns: 108px minmax(220px, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 6px 18px;
  align-items: center;
  min-height: 58px;
  padding: 11px 28px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.progress-state {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--accent);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state-dot {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
}

.progress-ribbon.is-idle .state-dot {
  border-color: #9aa59f;
  border-top-color: #9aa59f;
}

.progress-ribbon.is-idle .progress-state {
  color: var(--muted);
}
.progress-ribbon:not(.is-active) .progress-state,
.progress-ribbon:not(.is-active) .progress-layout,
.progress-ribbon:not(.is-active) .progress-meta {
  display: none;
}

.progress-ribbon.is-idle #progressFill {
  background: transparent;
}

.progress-ribbon.is-active .state-dot {
  animation: spin 900ms linear infinite;
}

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

.progress-layout {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 56px;
  gap: 10px;
  align-items: center;
}

.progress-meter {
  height: 13px;
  border-radius: 999px;
  background: #edf0ed;
  overflow: hidden;
}

#progressFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #72aa85);
  transition: width 240ms ease;
}

.progress-meta {
  display: flex;
  gap: 24px;
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
}

.page-delivery {
  display: grid;
  grid-template-columns: 330px minmax(360px, 0.92fr) minmax(420px, 1.2fr);
  grid-template-areas: "wb preview";
  column-gap: 16px;
  align-items: start;
}

.page-delivery > .chapter-workbench {
  grid-area: wb;
}

.page-delivery > .preview-panel {
  grid-area: preview;
}

.library-panel,
.chapter-workbench,
.preview-panel {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  overflow: hidden;
}

.library-panel {
  display: grid;
  grid-template-rows: auto auto minmax(160px, 1fr) auto;
  align-self: start;
}

.chapter-workbench {
  overflow: auto;
  overscroll-behavior: contain;
}

.preview-panel {
  border-right: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.92)),
    radial-gradient(560px 220px at 78% 92%, rgba(33, 51, 43, 0.10), transparent 68%);
}

.panel-head,
.preview-head,
.chapter-workbench > h2 {
  margin: 0;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.preview-head h2,
.chapter-workbench > h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.ink-landscape {
  min-height: 74px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)),
    radial-gradient(86px 30px at 77% 76%, rgba(23, 33, 29, 0.12), transparent 72%),
    radial-gradient(54px 22px at 91% 74%, rgba(23, 33, 29, 0.10), transparent 72%),
    radial-gradient(130px 34px at 83% 92%, rgba(23, 33, 29, 0.10), transparent 73%);
}

.project-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px 16px 8px;
}

.project-tools label {
  gap: 4px;
}

.project-tools input,
.project-tools select {
  min-height: 36px;
  padding-block: 7px;
}

.project-sort-note,
.detail-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

#projectListNotice {
  display: none;
}

.project-pager span {
  flex: 1 1 auto;
  min-width: 86px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.project-pager button {
  flex: 0 0 auto;
  min-height: 38px;
  min-width: 76px;
  padding-inline: 14px;
  white-space: nowrap;
}

.project-list,
.execution-list,
.book-list,
.chapter-list {
  display: grid;
}

.project-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 10px 10px;
}

.execution-list {
  max-height: 148px;
  overflow: auto;
  margin: 10px 22px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.execution-list.empty {
  display: none;
}

.project-list.empty,
.result-panel.empty,
.book-panel.empty,
.chapter-list-panel.empty,
.chapter-panel.empty,
.download-panel.empty,
.summary-box.empty {
  color: var(--muted);
}

.book-panel.empty,
.chapter-list-panel.empty,
.chapter-panel.empty,
.download-panel.empty {
  align-self: start;
  height: auto;
  min-height: 96px;
  padding: 18px 16px;
  border-radius: 8px;
  background: rgba(15, 75, 67, 0.04);
  border: 1px dashed rgba(15, 75, 67, 0.18);
}

.empty-workbench.with-illustration {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
  gap: 24px;
  align-items: center;
  padding: 28px 4px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86));
  border: 1px dashed var(--line);
}

.empty-workbench.with-illustration > .empty-workbench-text {
  display: grid;
  gap: 8px;
}

.empty-workbench.with-illustration > .empty-workbench-illustration {
  font-size: 64px;
  line-height: 1;
  text-align: center;
  color: rgba(15, 75, 67, 0.18);
}

.project-row,
.project-item,
.execution-item,
.book-select {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  padding: 0;
}

.project-row.active {
  border-left: 4px solid var(--accent);
}

.project-row .project-item {
  display: grid;
  align-content: center;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 0;
}

.project-item:hover,
.project-row.active .project-item,
.execution-item:hover,
.execution-item.active,
.book-select:hover,
.book-select.active {
  background: linear-gradient(90deg, rgba(225, 240, 231, 0.88), rgba(246, 250, 247, 0.88));
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.project-item span,
.execution-item span,
.book-select span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.project-item strong,
.execution-item strong,
.book-select strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item small,
.execution-item small,
.book-select span {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.project-item em,
.execution-item em {
  display: grid;
  gap: 6px;
  flex: 0 0 118px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  text-align: right;
}

.project-item em {
  display: flex;
  gap: 8px;
  flex: 0 1 auto;
  justify-content: space-between;
  min-width: 0;
  text-align: left;
}

.project-item em strong,
.execution-item em strong {
  color: var(--accent);
  font-size: 13px;
}

.project-item em small,
.execution-item em small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-delete-button {
  flex: 0 0 auto;
  align-self: center;
  min-height: 34px;
  margin-right: 0;
  border: 1px solid var(--danger-soft);
  border-radius: 6px;
  background: #fff;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
}

.project-delete-button:hover {
  border-color: rgba(176, 74, 58, 0.48);
  background: var(--danger-soft);
}

.summary-box,
.result-panel,
.book-panel,
.chapter-list-panel {
  margin: 0 24px 16px;
}

.summary-box,
.result-panel {
  border-bottom: 1px solid var(--line);
  padding: 18px 0 16px;
}

.summary-box.empty,
.result-panel.empty {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 0;
}

.empty-workbench {
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.empty-workbench strong {
  color: #3a4740;
  font-size: 17px;
}

.empty-workbench.compact {
  padding-block: 8px;
}

.summary-head,
.result-summary,
.chapter-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.result-summary {
  flex-wrap: wrap;
}

.summary-head h3,
.result-summary h3,
.chapter-heading h3 {
  margin: 0;
  font-size: 22px;
}

.chapter-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.chapter-heading-actions .secondary-button {
  white-space: nowrap;
}

.chapter-regenerate-body {
  display: grid;
  gap: 12px;
}

.chapter-regenerate-target {
  margin: 0;
  color: var(--ink-strong);
  font-weight: 700;
}

.chapter-regenerate-note,
.form-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.chapter-regenerate-body textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  line-height: 1.65;
}

.inline-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.result-meta {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

.result-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 3px 9px;
}

.readiness-line {
  display: grid;
  flex: 1 0 100%;
  gap: 3px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.readiness-line strong {
  color: var(--ink);
  font-size: 14px;
}

.readiness-line small {
  color: var(--warn);
}

.state-pill {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  white-space: nowrap;
}

.state-pill.pending {
  background: #f7ead8;
  color: var(--warn);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.summary-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px;
}

.summary-grid strong {
  display: block;
  font-size: 20px;
}

.summary-grid small,
.chapter-heading span {
  color: var(--muted);
}

.retry-box {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex: 1 0 100%;
  margin-top: 6px;
  border: 1px solid rgba(22, 112, 77, 0.22);
  border-radius: var(--radius);
  background: rgba(241, 248, 244, 0.82);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}

.retry-button {
  flex: 0 0 auto;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  padding: 8px 14px;
  font-weight: 600;
}

.retry-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.retry-button.secondary {
  background: white;
  color: var(--accent-strong);
}

.retry-button:hover {
  background: var(--accent-strong);
}

.retry-button.secondary:hover {
  background: rgba(22, 112, 77, 0.08);
}

.book-panel {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-top: 0;
}

.book-panel h3 {
  margin: 0;
  font-size: 27px;
  line-height: 1.2;
}

.book-panel p {
  margin: 8px 0 14px;
  color: var(--muted);
}

.book-cover {
  display: grid;
  place-items: center;
  width: 96px;
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.86)),
    radial-gradient(76px 34px at 62% 80%, rgba(27, 40, 34, 0.20), transparent 72%),
    radial-gradient(46px 22px at 82% 78%, rgba(27, 40, 34, 0.15), transparent 72%),
    linear-gradient(178deg, transparent 73%, rgba(27, 40, 34, 0.16) 74% 76%, transparent 77%),
    #eef1ee;
  color: #151c19;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  padding: 12px 20px;
  text-align: center;
  writing-mode: vertical-rl;
}

.book-list {
  gap: 0;
}

.book-list .book-select {
  min-height: 56px;
  padding-inline: 0;
}

.chapter-list-panel {
  margin-top: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.chapter-list-panel h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.chapter-list {
  gap: 0;
  border-top: 1px solid var(--line);
}

.chapter-list button {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 72px 88px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  text-align: left;
}

.chapter-list button:hover,
.chapter-list button.active {
  background: var(--accent-soft);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.chapter-list button.active span::before {
  content: "▶";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
}

.chapter-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-list small {
  color: var(--muted);
  text-align: right;
}

.chapter-state {
  color: var(--accent) !important;
}

.chapter-chars {
  color: #48534e !important;
}

.preview-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  min-height: 100%;
}

.preview-head {
  grid-row: 1;
}

.chapter-bookmark-bar {
  grid-row: 2;
}

.chapter-search-history {
  grid-row: 3;
}

.preview-illustration {
  position: absolute;
  right: 22px;
  bottom: 76px;
  width: 410px;
  height: 168px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.95;
}

.preview-illustration img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.chapter-panel {
  grid-row: 4;
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 34px 50px 28px;
}

.chapter-panel.empty {
  display: grid;
  place-items: center;
  margin: 22px 42px 18px;
  min-height: 0;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: rgba(246, 248, 246, 0.72);
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.chapter-panel pre {
  max-width: 760px;
  margin: 26px 0 0;
  color: #202722;
  font-size: 18px;
  line-height: 2.08;
  white-space: pre-wrap;
  word-break: break-word;
}

.download-panel {
  grid-row: 5;
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 18px 42px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.download-panel.empty {
  justify-content: center;
  padding-block: 14px;
  color: var(--muted);
}

.download-button {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-width: 210px;
  border: 1px solid #bfc7c0;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.download-button span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 24px;
  border-radius: 3px;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.download-button.word-download span {
  background: #2e66b3;
}

.download-button.word-download span::before {
  content: "W";
}

.download-button.zip-download span {
  background: #2d8a5e;
}

.download-button.zip-download span::before {
  content: "Z";
}

.download-button.generic-download span {
  background: var(--accent);
}

.download-button.generic-download span::before {
  content: "↓";
}

.download-button:hover:not(:disabled) {
  background: var(--surface-soft);
}

.warning-list {
  margin-top: 12px;
  color: var(--warn);
}

.target-adjustment {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(28, 126, 90, 0.18);
  border-radius: 8px;
  background: rgba(28, 126, 90, 0.06);
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1.6;
}

.warning-list p {
  margin: 6px 0 0;
}

.preflight-warning-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(183, 121, 31, 0.22);
  border-radius: 8px;
  background: rgba(183, 121, 31, 0.06);
}

.preflight-warning-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--warn);
}

.preflight-warning-head span,
.preflight-warning-group h4 span,
.preflight-warning-meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.preflight-warning-group + .preflight-warning-group {
  margin-top: 12px;
}

.preflight-warning-group h4 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text);
}

.preflight-warning-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.preflight-warning-item + .preflight-warning-item {
  margin-top: 8px;
}

.preflight-warning-message {
  margin: 0;
  color: var(--warn);
  font-weight: 650;
}

.preflight-warning-item p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.preflight-warning-item strong {
  color: var(--text);
}

.preflight-warning-item.severity-blocking {
  border-color: rgba(176, 58, 46, 0.3);
}

.preflight-warning-item.severity-blocking .preflight-warning-message {
  color: var(--danger);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 28px;
  align-items: start;
  min-height: 100vh;
  padding: 12vh 28px 0;
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 54px);
}

.auth-copy p {
  color: var(--muted);
  line-height: 1.7;
}

.auth-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.auth-form {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 22px;
  box-shadow: var(--shadow);
}

.registration-notice {
  grid-column: 1 / -1;
  border: 1px solid rgba(167, 111, 0, 0.24);
  background: rgba(255, 248, 225, 0.72);
  color: #795000;
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.7;
}

.message-line {
  grid-column: 1 / -1;
  min-height: 24px;
  color: var(--danger);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1320px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .command-band {
    grid-template-columns: minmax(220px, 1fr) minmax(240px, 1fr) minmax(190px, 0.8fr) minmax(210px, 0.9fr);
    gap: 16px;
  }

  .start-button {
    min-width: 0;
  }

  .delivery-workspace {
    grid-template-columns: 340px minmax(380px, 0.95fr) minmax(360px, 1.05fr);
    height: calc(100vh - 192px);
  }

  .preview-panel {
    grid-column: auto;
    border-top: 0;
  }
}

@media (max-width: 820px) {
  .delivery-shell {
    width: 100%;
    border-inline: 0;
  }

  .app-header,
  .progress-ribbon,
  .delivery-workspace,
  .auth-panel,
  .auth-forms {
    grid-template-columns: 1fr;
  }

  .app-header {
    padding: 18px;
  }

  .command-band {
    grid-template-columns: 1fr;
  }

  .progress-ribbon {
    gap: 10px;
    padding: 12px 18px;
  }

  .status-strip {
    grid-column: 1;
  }

  .progress-meta {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .library-panel,
  .chapter-workbench,
  .preview-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .book-panel {
    grid-template-columns: 1fr;
  }

  .book-cover {
    display: none;
  }

  .chapter-panel {
    padding: 24px 20px;
  }

  .chapter-panel pre {
    font-size: 16px;
  }

  .download-panel {
    padding: 16px 20px 22px;
  }
}

@media (max-width: 520px) {
  .brand-lockup h1 {
    font-size: 26px;
  }

  .brand-mark {
    width: 38px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chapter-list button {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
  }

  .chapter-title {
    grid-column: 1 / -1;
  }

  .chapter-list small,
  .chapter-chars,
  .chapter-state {
    text-align: left;
  }

  .project-pager {
    display: grid;
    grid-template-columns: 1fr;
  }

  .download-button {
    width: 100%;
  }
}

/* ============================================================
 * M1.4 — 4 档断点 + 类型尺度（覆盖整个工作台）
 * 1320 / 1024 / 768 / 480
 * ============================================================ */

/* 全局焦点环：保留浏览器默认 outline（键盘可达性）+ 视觉层 box-shadow */
:focus-visible {
  box-shadow: var(--focus-ring);
}

/* === 通用工具类 === */
.font-display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
.font-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-12 { font-size: var(--text-12); }
.text-13 { font-size: var(--text-13); }
.text-14 { font-size: var(--text-14); }
.text-16 { font-size: var(--text-16); }
.text-20 { font-size: var(--text-20); }
.text-28 { font-size: var(--text-28); }
.text-40 { font-size: var(--text-40); line-height: var(--leading-tight); }
.text-56 { font-size: var(--text-56); line-height: var(--leading-display); }
.muted { color: var(--muted); }
.ink-strong { color: var(--ink-strong); }

::selection {
  background: var(--selection-bg);
  color: var(--ink-strong);
}

/* === === === 1320 桌面：默认布局 === === === */
@media (max-width: 1319.98px) {
  .app-header {
    grid-template-columns: 280px minmax(0, 1fr) auto;
    padding: 16px 20px;
  }
  .command-band {
    grid-template-columns: minmax(180px, 0.9fr) minmax(200px, 1fr) minmax(180px, 0.7fr) minmax(200px, 0.8fr);
    gap: 14px;
  }
  .delivery-workspace {
    grid-template-columns: 340px minmax(380px, 0.95fr) minmax(360px, 1.05fr);
    height: calc(100vh - 192px);
  }
  .preview-panel {
    grid-column: auto;
    border-top: 0;
  }
}

/* === === === 窄笔记本 / 平板横屏：两列 + 预览下沉 === === === */
@media (max-width: 1119.98px) {
  .app-header {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 14px;
    min-height: 0;
    padding: 14px 18px;
  }
  .brand-lockup { grid-column: 1; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .command-band {
    grid-column: 1 / -1;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(160px, 0.7fr) minmax(180px, 0.8fr);
  }
  .start-button { min-width: 0; }
  .delivery-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .library-panel,
  .chapter-workbench,
  .preview-panel,
  .project-list,
  .chapter-list-panel,
  .chapter-panel {
    overflow: visible;
  }

  .library-panel,
  .chapter-workbench {
    display: block;
  }

  .execution-list {
    max-height: none;
  }

  .preview-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }
  .text-40 { font-size: 32px; }
  .text-56 { font-size: 44px; }
}

@media (max-width: 820px) {
  .delivery-workspace {
    grid-template-columns: 1fr;
  }
}

/* === === === 768 平板：上下堆叠 === === === */
@media (max-width: 767.98px) {
  html, body { min-width: 0; }
  .delivery-shell { border-inline: 0; }
  .app-header {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 12px 14px;
  }
  .brand-lockup h1 { font-size: 24px; }
  .command-band {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .command-band > label:nth-child(2),
  .command-band > .upload-control {
    grid-column: 1 / -1;
  }
  .start-button { min-height: 52px; }
  .progress-ribbon {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 10px 14px;
    gap: 6px;
  }
  .progress-state, .progress-layout, .progress-meta { grid-column: 1; }
  .delivery-workspace {
    grid-template-columns: 1fr;
  }
  .library-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .chapter-workbench { border-right: 0; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head, .preview-head, .chapter-workbench > h2 { padding: 16px 16px 12px; }
  .panel-head h2, .preview-head h2, .chapter-workbench > h2 { font-size: 20px; }
  .summary-box, .result-panel, .book-panel, .chapter-list-panel { margin: 0 16px 12px; }
  .project-tools { padding: 12px 14px 8px; }
  .text-40 { font-size: 28px; }
  .text-56 { font-size: 36px; }
}

/* === === === 480 手机：极致紧凑 === === === */
@media (max-width: 479.98px) {
  .command-band {
    grid-template-columns: 1fr;
  }
  .command-band > * { grid-column: 1; }
  .start-button { font-size: 16px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-head, .result-summary, .chapter-heading { flex-direction: column; align-items: flex-start; }
  .book-panel { grid-template-columns: 1fr; }
  .book-cover { width: 64px; min-height: 92px; font-size: 18px; }
  .text-40 { font-size: 32px; }
  .text-56 { font-size: 40px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
 * M3 组件库样式（Card / Chip / DataTile / ProgressBar / EmptyState
 * / Skeleton / Toast / Modal / Drawer）
 * 设计：编辑感数据看板 — 骨白 / 1px 分割 / 衬线大数字 / 状态色语义
 * ============================================================ */

/* === Card === */
.surface-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-1);
  padding: var(--space-4) var(--space-5);
  transition: box-shadow var(--duration-base) var(--ease-editorial),
              transform var(--duration-base) var(--ease-editorial),
              border-color var(--duration-base) var(--ease-editorial);
}
.surface-card.is-interactive {
  cursor: pointer;
}
.surface-card.is-interactive:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
  border-color: var(--accent-soft);
}
.surface-card.elevation-2 { box-shadow: var(--shadow-2); }
.surface-card.elevation-3 { box-shadow: var(--shadow-3); }
.surface-card.has-accent-top    { border-top: 3px solid var(--accent); }
.surface-card.has-accent-bottom { border-bottom: 3px solid var(--accent); }
.surface-card.has-accent-left   { border-left: 3px solid var(--accent); }
.surface-card.has-accent-right  { border-right: 3px solid var(--accent); }
.surface-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: var(--space-3);
}
.surface-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-20);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--ink-strong);
}
.surface-card-body { color: var(--ink); }
.surface-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-top: 1px solid var(--line-soft);
  padding-top: var(--space-3);
  color: var(--muted);
  font-size: var(--text-13);
}

/* === Chip === */
.surface-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--text-12);
  line-height: 1;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid transparent;
  background: var(--surface-soft);
  color: var(--ink);
}
.surface-chip.size-sm { padding: 2px 8px; font-size: 11px; }
.surface-chip.size-md { padding: 4px 10px; font-size: var(--text-12); }
.surface-chip.size-lg { padding: 6px 14px; font-size: var(--text-13); }
.surface-chip.is-clickable { cursor: pointer; transition: background var(--duration-fast) var(--ease-editorial); }
.surface-chip.is-clickable:hover { filter: brightness(0.96); }
.surface-chip .chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; opacity: 0.85;
}
.surface-chip .chip-dot.is-pulsing {
  animation: chip-pulse 1.6s var(--ease-editorial) infinite;
}
@keyframes chip-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.surface-chip.status-running    { background: var(--status-running-soft);    color: var(--status-running); }
.surface-chip.status-ready      { background: var(--status-ready-soft);      color: var(--status-ready); }
.surface-chip.status-failed     { background: var(--status-failed-soft);     color: var(--status-failed); }
.surface-chip.status-needs_review { background: var(--status-needs-review-soft); color: var(--status-needs-review); }
.surface-chip.status-empty      { background: var(--status-empty-soft);      color: var(--status-empty); }
.surface-chip.status-neutral    { background: var(--surface-soft);           color: var(--ink-muted); }
.surface-chip.status-info       { background: var(--info-soft);             color: var(--info); }
.surface-chip.status-success    { background: var(--success-soft);          color: var(--success); }
.surface-chip.status-warn       { background: var(--warn-soft);             color: var(--warn); }
.surface-chip.status-danger     { background: var(--danger-soft);           color: var(--danger); }

/* === DataTile === */
.surface-data-tile {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-1);
}
.surface-data-tile-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-12);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.surface-data-tile-value {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-40);
  line-height: var(--leading-tight);
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}
.surface-data-tile-unit {
  font-family: var(--font-body);
  font-size: var(--text-16);
  font-weight: 500;
  color: var(--muted);
}
.surface-data-tile-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--text-13);
  font-weight: 600;
}
.surface-data-tile-delta.is-up   { color: var(--success); }
.surface-data-tile-delta.is-down { color: var(--danger); }
.surface-data-tile-baseline {
  color: var(--muted);
  font-size: var(--text-12);
}
.surface-data-tile.size-compact .surface-data-tile-value { font-size: var(--text-28); }
.surface-data-tile.size-hero    .surface-data-tile-value { font-size: var(--text-56); line-height: var(--leading-display); }

/* === ProgressBar === */
.surface-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}
.surface-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--ink);
  font-size: var(--text-13);
  font-weight: 600;
}
.surface-progress-head .progress-percent {
  font-family: var(--font-mono);
  color: var(--ink-muted);
}
.surface-progress-track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  overflow: hidden;
}
.surface-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--status-ready));
  transition: width var(--duration-slow) var(--ease-editorial);
}
.surface-progress.is-indeterminate .surface-progress-fill {
  width: 35% !important;
  animation: progress-indeterminate 1.4s var(--ease-editorial) infinite;
}
@keyframes progress-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(285%); }
}
.surface-progress.segmented .surface-progress-track {
  display: flex;
  gap: 4px;
  height: 10px;
  background: transparent;
}
.surface-progress.segmented .surface-progress-segment {
  flex: 1;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  transition: background var(--duration-base) var(--ease-editorial);
}
.surface-progress.segmented .surface-progress-segment.is-done {
  background: var(--status-ready);
}
.surface-progress.segmented .surface-progress-segment.is-current {
  background: var(--accent);
  animation: chip-pulse 1.6s var(--ease-editorial) infinite;
}

/* 圆环进度 */
.surface-progress-ring {
  --ring-size: 64px;
  --ring-thickness: 8px;
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  border-radius: 50%;
  background:
    conic-gradient(var(--accent) calc(var(--ring-percent) * 1%), var(--surface-soft) 0);
  display: grid;
  place-items: center;
}
.surface-progress-ring::before {
  content: "";
  position: absolute;
  inset: var(--ring-thickness);
  background: var(--surface-raised);
  border-radius: 50%;
}
.surface-progress-ring-text {
  position: relative;
  font-family: var(--font-mono);
  font-size: var(--text-13);
  font-weight: 600;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

/* === EmptyState === */
.surface-empty-state {
  display: grid;
  place-items: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--muted);
}
.surface-empty-state-icon {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink-muted);
}
.surface-empty-state-icon svg { width: 28px; height: 28px; }
.surface-empty-state-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-20);
  font-weight: 600;
  color: var(--ink-strong);
}
.surface-empty-state-desc {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  line-height: var(--leading-relaxed);
}
.surface-empty-state-actions {
  display: inline-flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

/* === Skeleton === */
.surface-skeleton {
  display: block;
  background: linear-gradient(
    90deg,
    var(--surface-soft) 0%,
    var(--line-soft) 50%,
    var(--surface-soft) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s var(--ease-editorial) infinite;
  border-radius: var(--radius-sm);
}
.surface-skeleton.is-text { height: 1em; margin-bottom: 0.5em; border-radius: 4px; }
.surface-skeleton.is-circle { border-radius: 50%; }
.surface-skeleton.is-rect { border-radius: var(--radius-sm); }
@keyframes skeleton-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .surface-skeleton { animation: none; }
  .surface-skeleton.is-pulsing { animation: none; opacity: 0.7; }
}

/* === Toast === */
.surface-toast-region {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 9999;
  max-width: 360px;
  pointer-events: none;
}
.surface-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-2);
  padding: var(--space-3) var(--space-4);
  color: var(--ink);
  pointer-events: auto;
  animation: toast-enter var(--duration-slow) var(--ease-emphasis);
}
.surface-toast.is-leaving { animation: toast-leave var(--duration-base) var(--ease-emphasis) forwards; }
.surface-toast.level-info    { border-left-color: var(--info); }
.surface-toast.level-success { border-left-color: var(--success); }
.surface-toast.level-warn    { border-left-color: var(--warn); }
.surface-toast.level-danger  { border-left-color: var(--danger); }
.surface-toast-title {
  margin: 0;
  font-weight: 600;
  font-size: var(--text-14);
  color: var(--ink-strong);
}
.surface-toast-message {
  margin: 2px 0 0;
  font-size: var(--text-13);
  line-height: var(--leading-normal);
  color: var(--ink-muted);
}
.surface-toast-dismiss {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 var(--space-1);
  font-size: var(--text-20);
  line-height: 1;
  min-height: 0;
}
.surface-toast-dismiss:hover { color: var(--ink-strong); background: transparent; box-shadow: none; }
.surface-toast-action {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: var(--text-13);
  cursor: pointer;
  padding: 0;
  min-height: 0;
}
.surface-toast-action:hover { color: var(--accent-strong); background: transparent; box-shadow: none; }
@keyframes toast-enter  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-leave { from { opacity: 1; } to { opacity: 0; transform: translateY(4px); } }

/* === Modal & Drawer === */
.surface-modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 19, 17, 0.42);
  z-index: 9000;
  padding: var(--space-5);
  animation: overlay-enter var(--duration-base) var(--ease-editorial);
}
.surface-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  padding: var(--space-5) var(--space-5) var(--space-4);
  animation: modal-enter var(--duration-slow) var(--ease-emphasis);
}
.surface-modal.size-sm { width: min(380px, 100%); }
.surface-modal.size-md { width: min(560px, 100%); }
.surface-modal.size-lg { width: min(820px, 100%); }
.surface-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.surface-modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-20);
  font-weight: 600;
  color: var(--ink-strong);
}
.surface-modal-close {
  border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: var(--text-20); line-height: 1;
  padding: 0; min-height: 0;
}
.surface-modal-close:hover { color: var(--ink-strong); background: transparent; box-shadow: none; }
.surface-modal-body {
  overflow-y: auto;
  color: var(--ink);
  line-height: var(--leading-relaxed);
}
.surface-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  border-top: 1px solid var(--line-soft);
  padding-top: var(--space-3);
}

.surface-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--surface-raised);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  width: min(420px, 100%);
  padding: var(--space-5);
  z-index: 9100;
  animation: drawer-enter var(--duration-slow) var(--ease-emphasis);
  overflow-y: auto;
}
.surface-drawer.size-sm { width: min(320px, 100%); }
.surface-drawer.size-md { width: min(420px, 100%); }
.surface-drawer.size-lg { width: min(640px, 100%); }

@keyframes overlay-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-enter   { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes drawer-enter  { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .surface-modal, .surface-drawer, .surface-modal-overlay, .surface-toast { animation: none; }
}

/* === App.js 复用样式（与 surface 组件库同 token） === */

/* danger-button：删除、重置、重试等破坏性主要操作的色板 */
.danger-button {
  background: var(--danger);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  min-height: 42px;
  padding: 0 18px;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.danger-button:hover:not(:disabled) {
  background: #8c3a2d;
  box-shadow: 0 10px 22px rgba(176, 74, 58, 0.22);
  transform: translateY(-1px);
}
.danger-button:disabled { cursor: not-allowed; opacity: 0.55; }
.danger-button:focus-visible { outline: none; box-shadow: var(--focus-ring-danger); }

/* 列表行 active 态：项目选择 / execution 选中 */
.project-row.active,
.project-item.active,
.execution-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* execution 列表暂停态：暂停按钮高亮 */
.execution-pause-toggle {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-size: var(--text-12);
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
  min-height: 0;
  transition: all 160ms ease;
}
.execution-pause-toggle.is-paused {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}
.execution-pause-toggle:hover { background: var(--surface-soft); }
.execution-pause-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* 顶部状态条 + 项目行/执行行骨架 */
.project-list-skeleton,
.execution-list-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) 0;
}

/* 主面板首屏骨架（项目列表 + 章节列表） */
.shell-skeleton {
  display: grid;
  grid-template-columns: 320px 1fr 1fr;
  gap: var(--space-5);
  padding: var(--space-5) 0;
}
.shell-skeleton-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
}
@media (max-width: 1024px) {
  .shell-skeleton { grid-template-columns: 1fr; }
}

/* 项目列表 empty 态统一 */
.project-list.empty .empty-state-card,
.execution-list.empty .empty-state-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

/* execution 行增加右上角 meta 容纳暂停按钮 */
.execution-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.execution-list-head h3 {
  margin: 0;
  font-size: var(--text-13);
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* === 演示模式 / 登录态过期 / 错误恢复 (M4c) === */

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--text-12);
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid var(--warn);
}
.demo-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
}

.auth-expiry-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--text-12);
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--danger);
  cursor: pointer;
}
.auth-expiry-badge:hover { background: var(--danger); color: #fff; }
.auth-expiry-badge:focus-visible { outline: none; box-shadow: var(--focus-ring-danger); }

/* 状态条 + 网络错误时的内联重试按钮 */
.status-strip.is-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.status-strip-retry {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  min-height: 0;
  font-size: inherit;
}
.status-strip-retry:hover { color: #8c3a2d; background: transparent; box-shadow: none; }
.status-strip-retry:focus-visible { outline: none; box-shadow: var(--focus-ring-danger); }

/* 章节搜索输入 */
.chapter-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.chapter-search input {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: var(--text-13);
  color: var(--ink);
  min-height: 0;
}
.chapter-search input:focus { outline: none; box-shadow: none; }
.chapter-search-count {
  font-size: var(--text-12);
  color: var(--muted);
  white-space: nowrap;
}

/* 章节正文高亮（M4c 与 editor.ts search 风格保持一致） */
.chapter-text mark.search-highlight {
  background: rgba(192, 138, 42, 0.32);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* provider 健康指示点 */
.provider-health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.provider-health-dot.is-ready { background: var(--success); }
.provider-health-dot.is-warn  { background: var(--warn); }
.provider-health-dot.is-down  { background: var(--danger); }

/* === M4e 状态色彩 pill / 网络离线提示 === */

.status-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-12);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  border: 1px solid transparent;
  vertical-align: baseline;
  margin-right: 4px;
}
.status-pill.status-pass { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.status-pill.status-failed { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.status-pill.status-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.status-pill.status-running { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.status-pill.status-empty { background: var(--surface-soft); color: var(--muted); border-color: var(--line); }

.execution-progress {
  display: inline-block;
  font-weight: 600;
  color: var(--ink);
  margin-right: 2px;
}

/* execution 行 active 之外，按状态给左侧色条提示 */
.execution-item.status-pass { border-left: 3px solid var(--success); }
.execution-item.status-failed { border-left: 3px solid var(--danger); }
.execution-item.status-warn { border-left: 3px solid var(--warn); }
.execution-item.status-running { border-left: 3px solid var(--accent); }
.execution-item.status-empty { border-left: 3px solid var(--line); }
.task-main-card.status-pass { border-left: 3px solid var(--success); }
.task-main-card.status-failed { border-left: 3px solid var(--danger); }
.task-main-card.status-warn { border-left: 3px solid var(--warn); }
.task-main-card.status-running { border-left: 3px solid var(--accent); }
.task-main-card.status-empty { border-left: 3px solid var(--line); }
.execution-item.active { box-shadow: inset 0 0 0 1px var(--accent); }

/* 顶部状态条：离线态 */
.status-strip.is-offline {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* === M4f execution 状态 filter chip + download 分组 === */

.execution-status-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line-soft);
}
.execution-filter-chip,
.task-main-filter-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-size: var(--text-12);
  font-weight: 500;
  padding: 3px 10px;
  cursor: pointer;
  min-height: 0;
  transition: all 160ms ease;
}
.execution-filter-chip:hover:not(:disabled),
.task-main-filter-chip:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.execution-filter-chip.active,
.task-main-filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.execution-filter-chip:disabled,
.task-main-filter-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.execution-filter-chip:focus-visible,
.task-main-filter-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* download 分组容器 */
.download-group {
  margin-bottom: var(--space-3);
}
.download-group:last-child { margin-bottom: 0; }
.download-group-title {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-12);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.download-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* === M4g 质量摘要 tile + 章节阅读进度条 === */

.quality-summary {
  margin: var(--space-3) 0 var(--space-2) 0;
  padding: var(--space-3);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
}
.quality-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}
@media (max-width: 720px) {
  .quality-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.quality-summary-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.quality-summary-tile strong {
  font-size: var(--text-16);
  font-weight: 600;
  color: var(--ink-strong);
  font-family: var(--font-display);
}
.quality-summary-tile small {
  font-size: var(--text-12);
  color: var(--muted);
  letter-spacing: 0.02em;
}
.quality-summary-hint {
  margin: var(--space-2) 0 0 0;
  font-size: var(--text-13);
  color: var(--ink-muted);
}

/* 章节阅读进度 */
.chapter-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.chapter-progress-track {
  flex: 1 1 auto;
  height: 4px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}
.chapter-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 120ms linear;
}
.chapter-progress-label {
  font-size: var(--text-12);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
.chapter-text:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* 章节正文区可独立滚动 */
.chapter-text {
  display: block;
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-3);
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-body);
  font-size: var(--text-14);
  line-height: var(--leading-relaxed);
  color: var(--ink);
}

/* === M4h 多 tab 入口（默认隐藏，由 app.js 按 entry_mode 启用） === */

.dashboard-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-2) var(--space-4);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}
.dashboard-tabs[hidden] { display: none; }

.dashboard-tab {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: var(--text-14);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 0;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease;
}
.dashboard-tab:hover { background: var(--surface); color: var(--ink); }
.dashboard-tab[aria-selected="true"] {
  background: var(--surface-raised);
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.dashboard-tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* === 页面级工作区：创作 / 作品 / 任务 / 成稿 / 质量复盘 / 模型服务 / 设置 === */

.app-header {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 98px;
}

.app-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: calc(100vh - 151px);
  overflow: hidden;
}

.app-page-stack {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 251, 249, 0.88)),
    var(--surface);
}

.app-page {
  min-width: 0;
  padding: 24px;
}

.app-page[hidden] {
  display: none !important;
}

.page-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.page-hero-head {
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 245, 0.92)),
    radial-gradient(360px 120px at 88% 36%, rgba(31, 78, 74, 0.10), transparent 70%);
  box-shadow: var(--shadow-1);
  padding: 22px 24px;
}

.page-head-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 420px;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 11px;
  white-space: nowrap;
}

.metric-chip.is-ready {
  border-color: rgba(40, 112, 73, 0.28);
  background: var(--success-soft);
  color: var(--success);
}

.page-section-head h2 {
  margin: 0;
  color: var(--ink-strong);
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.page-section-head p {
  max-width: 560px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.page-create {
  display: grid;
  gap: 18px;
  align-content: start;
}

.page-create .command-band {
  grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 1fr) minmax(180px, 0.72fr) minmax(210px, 0.8fr);
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-1);
}

.page-create .progress-ribbon {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.project-main-board,
.task-main-board {
  display: grid;
  gap: 16px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-1);
  padding: 18px;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.board-toolbar h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 20px;
}

.board-toolbar p {
  max-width: 640px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.project-main-list,
.task-main-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.project-main-card,
.task-main-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.project-main-card.is-active,
.task-main-card.is-active {
  border-color: rgba(31, 78, 74, 0.42);
  box-shadow: inset 3px 0 0 var(--accent);
}

.project-main-select,
.task-main-select {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.project-main-select:hover,
.task-main-select:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.project-main-select strong,
.task-main-select strong {
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-main-select small,
.task-main-select small,
.task-main-meta,
.project-main-metrics {
  color: var(--muted);
  font-size: 13px;
}

.project-main-status {
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}

.project-main-metrics,
.task-main-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1;
}

.project-main-metrics span,
.task-main-meta span {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  padding: 3px 8px;
}

.project-main-delete {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 36px;
  border: 1px solid var(--danger-soft);
  background: #fff;
  color: var(--danger);
  padding-inline: 12px;
}

.task-main-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.task-main-card {
  grid-template-columns: minmax(0, 1fr);
}

.task-main-select {
  width: 100%;
}

.task-main-status {
  display: inline-flex;
}

.task-main-progress {
  height: 8px;
  border-radius: var(--radius-pill);
  background: #edf0ed;
  overflow: hidden;
}

.task-main-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #72aa85);
}

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

.page-projects,
.page-tasks,
.page-review,
.page-settings,
.page-models {
  display: grid;
  gap: 18px;
  align-content: start;
}

.page-tasks #progressDetail,
.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.page-delivery {
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 1fr);
  grid-auto-rows: min-content;
  gap: 18px;
  align-content: start;
}

.page-delivery > .page-section-head {
  grid-column: 1 / -1;
}

.page-delivery .book-panel,
.page-delivery .chapter-list-panel {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.page-delivery .preview-panel {
  grid-column: 2;
  grid-row: 2 / span 2;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.page-review .result-panel {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.review-downloads {
  flex: 1 0 100%;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.review-downloads h4 {
  margin: 0 0 10px;
  color: var(--ink-strong);
  font-size: 15px;
}

.review-download-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.settings-card h2,
.settings-card h3 {
  margin: 0 0 12px;
  color: var(--ink-strong);
  font-size: 20px;
}

.main-panel[data-active-page="models"] .app-workspace,
.main-panel[data-active-page="settings"] .app-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.model-config-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.model-config-panel,
.provider-model-form {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  padding: 18px;
  box-shadow: var(--shadow-1);
}

.model-config-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.provider-model-list {
  display: grid;
  gap: 12px;
}

.provider-model-list.empty {
  color: var(--muted);
}

.provider-model-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  padding: 14px;
}

.provider-model-card.is-editing {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.provider-model-card.is-disabled {
  opacity: 0.74;
}

.provider-model-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.provider-model-head h3 {
  margin: 0;
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-model-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.provider-model-head strong {
  color: var(--accent-strong);
  font-size: 12px;
  white-space: nowrap;
}

.provider-model-meta {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px 10px;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.provider-model-meta dt {
  color: var(--muted);
}

.provider-model-meta dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.provider-model-technical {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
}

.provider-model-technical summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 10px;
}

.provider-model-technical dl {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  border-top: 1px solid var(--line-soft);
  padding: 10px;
}

.provider-model-technical dt {
  color: var(--muted);
}

.provider-model-technical dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.provider-model-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.provider-model-reasons span {
  min-width: 0;
  border: 1px solid var(--warn-soft);
  border-radius: var(--radius-pill);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  overflow-wrap: anywhere;
  padding: 3px 8px;
}

.provider-model-actions,
.form-actions,
.form-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.provider-model-actions button,
.form-actions button {
  min-height: 38px;
  padding-inline: 14px;
}

.secondary-button.danger {
  border-color: var(--danger-soft);
  color: var(--danger);
}

.secondary-button.danger:hover:not(:disabled) {
  background: var(--danger-soft);
}

.provider-model-form h3 {
  margin: 0 0 14px;
  color: var(--ink-strong);
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label,
.model-config-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.form-checks {
  margin: 14px 0;
}

.form-checks label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
}

.form-checks input {
  width: auto;
  min-height: 0;
}

.provider-model-form.is-readonly {
  background: rgba(248, 249, 247, 0.94);
}

.page-models .message-line {
  min-height: 20px;
  color: var(--muted);
}

.page-models .message-line.is-error {
  color: var(--danger);
}

.provider-health-dot.is-disabled { background: var(--status-empty); }

/* tab panel 容器 */
.dashboard-panels[hidden] { display: none; }
.dashboard-panel {
  padding: var(--space-4);
  min-height: 200px;
}
.dashboard-panel[hidden] { display: none; }
.dashboard-panel h2 {
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-20);
  font-family: var(--font-display);
  color: var(--ink-strong);
}
.dashboard-panel p.muted {
  color: var(--muted);
  font-size: var(--text-13);
}

/* === M4i 模型服务详情 + 跨作品搜索提示 === */

.provider-health-details {
  margin-top: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
}
.provider-health-details[hidden] { display: none; }
.provider-health-details-title {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--text-13);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.provider-health-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2);
}
.provider-health-tile {
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
}
.provider-health-tile-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.provider-health-tile-head strong {
  font-size: var(--text-13);
  font-weight: 600;
  color: var(--ink-strong);
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.provider-health-status {
  font-size: var(--text-12);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  color: var(--muted);
}
.provider-health-tile-body {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px var(--space-2);
  margin: 0;
  font-size: var(--text-12);
}
.provider-health-tile-body dt {
  color: var(--muted);
}
.provider-health-tile-body dd {
  margin: 0;
  color: var(--ink);
  word-break: break-all;
}

/* === M4j 多 tab 列表 / 统计 / 资料 渲染 === */

.multi-tab-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.multi-tab-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.multi-tab-list li > strong {
  font-size: var(--text-13);
  font-weight: 600;
  color: var(--ink-strong);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.multi-tab-list li > small {
  font-size: var(--text-12);
  color: var(--muted);
}
.multi-tab-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin: var(--space-3) 0;
}
.multi-tab-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.multi-tab-stats strong {
  font-size: var(--text-16);
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--ink-strong);
}
.multi-tab-stats small {
  font-size: var(--text-12);
  color: var(--muted);
  letter-spacing: 0.02em;
}
.multi-tab-profile dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-3);
  margin: 0;
}
.multi-tab-profile dt {
  color: var(--muted);
  font-size: var(--text-12);
  align-self: center;
}
.multi-tab-profile dd {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-14);
}

.account-settings-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.account-settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-13);
}

.account-settings-form input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}

.account-settings-form button {
  justify-self: start;
}

.registration-settings-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.registration-settings-panel h3 {
  margin: 0 0 6px;
}

.registration-settings-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.registration-settings-panel.readonly-note {
  display: block;
  color: var(--muted);
}

/* === M4k 章节书签条 === */

.chapter-bookmark-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-2) 0;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: var(--text-13);
  color: var(--accent-strong, var(--ink-strong));
}
.chapter-bookmark-bar[hidden] { display: none; }
.chapter-bookmark-bar .bookmark-label {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-bookmark-bar .bookmark-jump,
.chapter-bookmark-bar .bookmark-clear {
  border: 1px solid var(--accent);
  background: var(--surface-raised);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  font-size: var(--text-12);
  min-height: 0;
  font-weight: 600;
}
.chapter-bookmark-bar .bookmark-jump:hover,
.chapter-bookmark-bar .bookmark-clear:hover {
  background: var(--accent);
  color: #fff;
}
.chapter-bookmark-bar .bookmark-clear {
  border-color: var(--line);
  color: var(--muted);
}

/* === M4l execution 详情 modal === */
.execution-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
}
.execution-detail-modal[hidden] { display: none; }
.execution-detail-modal .surface-modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 19, 17, 0.42);
  z-index: 9000;
  padding: var(--space-5);
}
.execution-detail-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.execution-detail-row {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-3);
  align-items: center;
  font-size: var(--text-13);
}
.execution-detail-row > strong {
  color: var(--muted);
  font-weight: 500;
  min-width: 80px;
}
.execution-detail-row > code {
  font-family: var(--font-mono);
  font-size: var(--text-12);
  background: var(--surface-soft);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  word-break: break-all;
}

/* === M4m 章节搜索历史 === */

.chapter-search-history {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: var(--space-2);
  padding: 4px 0;
  font-size: var(--text-12);
}
.chapter-search-history[hidden] { display: none; }
.chapter-search-history .search-history-label {
  color: var(--muted);
  margin-right: 4px;
}
.search-history-chip {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink-muted);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  font-size: var(--text-12);
  cursor: pointer;
  min-height: 0;
}
.search-history-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.search-history-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* === M4n 复制下载链接 === */

.download-item-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.download-copy-link {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--ink-muted);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: var(--text-12);
  cursor: pointer;
  min-height: 0;
  font-weight: 500;
  transition: all 160ms ease;
}
.download-copy-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.download-copy-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.download-copy-link.copied {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
}

/* === 首次使用引导面板快速开始 === */
.onboarding-panel {
  max-width: 960px;
  margin: 24px auto 0;
  padding: 0 28px;
}
.onboarding-card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 32px;
  box-shadow: var(--shadow-1);
}
.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.onboarding-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-strong);
}
.onboarding-header p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.onboarding-step {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 124px;
}
.onboarding-step.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-1);
}
.onboarding-step.is-done {
  border-color: var(--success);
  background: var(--success-soft);
}
.onboarding-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.onboarding-step.is-done .onboarding-step-num {
  background: var(--success);
  content: "\2713";
}
.onboarding-step-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-strong);
}
.onboarding-step-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}
.onboarding-step-status {
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
  margin-top: 4px;
}
@media (max-width: 720px) {
  .onboarding-steps { grid-template-columns: 1fr; }
}

@media (max-width: 1119.98px) {
  .app-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: auto;
    overflow: visible;
  }

  .app-page-stack {
    overflow: visible;
  }

  .page-create .command-band,
  .model-config-layout {
    grid-template-columns: 1fr;
  }

  .model-config-toolbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .page-delivery {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-delivery .preview-panel {
    grid-column: 1;
    grid-row: auto;
    min-height: 0;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .app-header {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .dashboard-tabs {
    flex-wrap: wrap;
    overflow-x: hidden;
    padding-inline: 10px;
  }

  .dashboard-tab {
    flex: 1 1 calc(25% - 8px);
    text-align: center;
    padding-inline: 12px;
  }

  .app-workspace {
    grid-template-columns: 1fr;
  }

  .app-page-stack {
    grid-row: 1;
  }

  .app-page {
    padding: 16px;
  }

  .page-section-head {
    display: grid;
  }

  .page-head-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .page-section-head h2 {
    font-size: 24px;
  }

  .page-create .command-band {
    padding: 14px;
  }

  .model-config-toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .board-toolbar,
  .project-main-card,
  .project-main-select,
  .task-main-select {
    grid-template-columns: 1fr;
  }

  .board-toolbar {
    display: grid;
  }

  .project-main-delete {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .task-main-controls {
    justify-content: flex-start;
  }

  .form-grid .span-2 {
    grid-column: 1;
  }

  .provider-model-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .provider-model-head strong {
    grid-column: 2;
  }

  .provider-model-meta {
    grid-template-columns: 1fr;
  }

  .provider-model-actions button {
    flex: 1 1 calc(50% - 10px);
    min-width: 0;
  }
}

/* === Figma Redesign Cover alignment (2026-07-03) === */

body {
  background:
    radial-gradient(560px 180px at 12% 0%, rgba(15, 75, 67, 0.055), transparent 64%),
    linear-gradient(180deg, #f7f4ec 0%, #f7f4ec 100%);
}

body::before,
body::after {
  display: none;
}

.delivery-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  border: 0;
  background: #f7f4ec;
}

.main-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  min-height: 100vh;
  padding: 24px;
}

.app-header {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) max-content;
  gap: 24px;
  align-items: start;
  min-height: 118px;
  padding: 24px;
  border: 0;
  border-radius: 8px;
  background: #efeadf;
  box-shadow: none;
}

.brand-lockup {
  gap: 0;
  align-items: flex-start;
}

.brand-mark {
  display: none;
}

.brand-lockup h1 {
  color: #17211c;
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-lockup p {
  margin-top: 8px;
  color: #53615a;
  font-size: 15px;
}

.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.dashboard-tab {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 44px;
  border-radius: 8px;
  background: #e6e0d3;
  color: #35423b;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 12px;
  text-align: center;
  box-shadow: none;
}

.dashboard-tab:nth-child(n+5) {
  min-width: 116px;
}

.dashboard-tab:nth-child(7) {
  min-width: 128px;
}

.dashboard-tab:hover:not(:disabled) {
  background: #eee8dc;
  box-shadow: none;
  transform: none;
}

.dashboard-tab[aria-selected="true"] {
  background: #ffffff;
  color: #0f4b43;
  box-shadow: 0 1px 0 rgba(15, 75, 67, 0.18);
}

.header-actions {
  justify-content: flex-end;
  align-items: flex-start;
  min-width: 120px;
}

.header-actions.is-empty {
  display: none;
}

.demo-badge,
.auth-expiry-badge {
  min-height: 40px;
  border-radius: 999px;
  background: #fff6d9;
  color: #8a5a11;
  font-weight: 800;
  padding: 10px 18px;
}

.account-label {
  max-width: 180px;
  overflow: hidden;
  color: #53615a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  min-height: 0;
  height: calc(100vh - 186px);
  overflow: hidden;
}

.library-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) minmax(0, 190px);
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.panel-head,
.preview-head,
.chapter-workbench > h2 {
  padding: 18px;
  border-bottom: 0;
}

.panel-head h2,
.preview-head h2,
.chapter-workbench > h2 {
  color: #17211c;
  font-size: 20px;
  font-weight: 800;
}

.project-tools {
  gap: 12px;
  padding: 0 18px 12px;
  border-bottom: 0;
}

.project-tools label {
  gap: 7px;
  color: #53615a;
  font-size: 12px;
}

.project-tools input,
.project-tools select {
  min-height: 42px;
  border: 0;
  background: #f7f8f5;
}

.project-sort-note,
#projectListNotice {
  color: #6b746c;
  font-size: 12px;
}

.project-pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.project-pager button {
  min-height: 38px;
  padding: 0 10px;
}

.project-list,
.execution-list {
  min-height: 0;
  overflow: auto;
}

.project-list:focus-visible,
.execution-list:focus-visible {
  outline: 3px solid rgba(31, 78, 74, 0.32);
  outline-offset: -3px;
}

.project-list {
  padding: 0 18px 18px;
}

.execution-list {
  border-top: 1px solid var(--line-soft);
  padding: 12px 18px 18px;
}

.project-item,
.execution-item {
  border: 0;
  border-radius: 8px;
  background: #fafbf8;
  box-shadow: none;
}

.project-item.active,
.project-item[aria-current="true"] {
  background: #eef6f0;
}

.app-page-stack {
  min-height: 0;
  height: 100%;
  border-radius: 8px;
  background: transparent;
  overflow: auto;
}

.app-page-stack:focus-visible {
  outline: 3px solid rgba(31, 78, 74, 0.32);
  outline-offset: 3px;
}

.app-page {
  min-height: 100%;
  padding: 0;
}

.page-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  gap: 18px;
  align-content: start;
}

.page-create .page-hero-head,
.page-create #onboardingPanel,
.page-create #uploadSummary,
.page-create #contractEditorPanel {
  grid-column: 1 / -1;
}

.page-section-head,
.page-hero-head {
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  padding: 24px 26px;
}

.page-hero-head {
  min-height: 154px;
  align-items: flex-start;
}

.page-section-head h2 {
  color: #17211c;
  font-family: var(--font-body);
  font-size: 30px;
  font-weight: 800;
}

.page-section-head p {
  max-width: 680px;
  color: #53615a;
  font-size: 17px;
}

.metric-chip {
  min-height: 32px;
  border: 0;
  background: #fffdf7;
  color: #53615a;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
}

.metric-chip.is-ready {
  background: #e5f4ea;
  color: #0f6b55;
}

.page-create .command-band,
.page-create .progress-ribbon {
  height: 298px;
  min-height: 298px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  padding: 22px;
}

.page-create .command-band {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
}

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

.command-upload {
  justify-content: flex-start;
  min-height: 62px;
  border: 0;
  border-radius: 8px;
  background: #fafbf8;
  padding: 0 18px;
}

.upload-read-button {
  justify-self: auto;
  min-height: 62px;
  border: 1px solid var(--line-soft);
  border-left: 0;
  border-radius: 0 8px 8px 0;
}

.upload-control .command-upload {
  border-radius: 8px 0 0 8px;
}

.page-create .command-band label,
.model-config-toolbar label,
.form-grid label {
  color: #17211c;
  font-size: 14px;
  font-weight: 800;
}

.page-create .command-band input,
.page-create .command-band select,
.model-config-toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 0;
  background: #f7f8f5;
}

.target-field > span {
  border: 0;
  background: #f7f8f5;
}

.start-button {
  width: 100%;
  min-height: 52px;
  border-radius: 8px;
  font-size: 16px;
}

.page-create .progress-ribbon {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto 72px;
  gap: 16px;
  align-content: start;
}

.progress-state {
  color: #17211c;
  font-size: 20px;
  font-weight: 800;
}

.progress-layout {
  grid-template-columns: minmax(0, 1fr) 52px;
}

.progress-meter {
  height: 16px;
  background: #e7ece6;
}

.progress-meta {
  display: grid;
  gap: 10px;
  color: #53615a;
  font-size: 14px;
}

.status-strip {
  grid-column: auto;
  min-height: 72px;
  border-radius: 8px;
  background: #f7f8f5;
  padding: 14px;
  font-size: 14px;
}

.summary-box[hidden] {
  display: none !important;
}

#onboardingPanel {
  display: block;
  max-width: none;
  margin: 0;
  padding: 0;
}

#onboardingPanel[hidden] {
  display: none !important;
}

.onboarding-card {
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
  padding: 22px;
}

.onboarding-header {
  display: none;
}

.onboarding-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.onboarding-step {
  min-height: 130px;
  border: 0;
  border-radius: 8px;
  background: #fafbf8;
  padding: 16px;
}

.onboarding-step.is-active,
.onboarding-step.is-done {
  background: #f0f7f2;
}

.onboarding-step-num {
  display: none;
}

.onboarding-step-title {
  color: #17211c;
  font-size: 16px;
  font-weight: 800;
}

.onboarding-step.is-done .onboarding-step-title,
.onboarding-step.is-active .onboarding-step-title {
  color: #0f6b55;
}

.onboarding-step-hint {
  color: #53615a;
  font-size: 13px;
  line-height: 1.45;
}

.project-main-board,
.task-main-board,
.page-tasks #progressDetail,
.settings-card,
.model-config-panel,
.provider-model-form,
.page-review .result-panel,
.page-delivery .book-panel,
.page-delivery .chapter-list-panel,
.page-delivery .preview-panel {
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.page-delivery {
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.chapter-workbench {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.page-delivery .preview-panel {
  min-height: 0;
}

.main-panel[data-active-page="models"] .app-workspace,
.main-panel[data-active-page="settings"] .app-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.main-panel[data-active-page="models"] .app-page-stack,
.main-panel[data-active-page="settings"] .app-page-stack {
  max-width: none;
}

.model-config-layout {
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
}

@media (max-width: 1320px) {
  .main-panel {
    padding: 16px;
  }

  .app-header {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .header-actions {
    grid-column: 2;
    justify-self: end;
    margin-top: -54px;
  }

  .header-actions.is-empty {
    display: none;
  }

  .app-workspace {
    height: calc(100vh - 170px);
  }
}

@media (max-width: 1119.98px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .header-actions {
    grid-column: auto;
    justify-self: start;
    margin-top: 0;
  }

  .header-actions.is-empty {
    display: none;
  }

  .app-workspace {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .library-panel {
    max-height: 780px;
  }

  .page-create {
    grid-template-columns: 1fr;
  }

  .model-config-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .delivery-shell {
    width: 100%;
  }

  .main-panel {
    gap: 14px;
    padding: 12px;
  }

  .app-header {
    gap: 14px;
    min-height: 0;
    padding: 8px;
    background: transparent;
  }

  .dashboard-tabs {
    order: -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 6px;
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    background: #efeadf;
  }

  .dashboard-tab,
  .dashboard-tab:nth-child(n+5),
  .dashboard-tab:nth-child(7) {
    min-width: 0;
    min-height: 36px;
    padding: 8px 9px;
    font-size: 14px;
  }

  .dashboard-tab:nth-child(n+5) {
    grid-column: span 1;
  }

  .dashboard-tab:nth-child(5),
  .dashboard-tab:nth-child(6) {
    grid-column: span 1;
  }

  .dashboard-tab:nth-child(7) {
    grid-column: span 2;
  }

  .brand-lockup,
  .header-actions {
    border-radius: 8px;
    background: #ffffff;
    padding: 16px;
  }

  .header-actions.is-empty {
    display: none;
  }

  .brand-lockup h1 {
    font-size: 28px;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .app-workspace {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-page-stack {
    grid-row: 1;
    height: auto;
    overflow: visible;
  }

  .app-page {
    padding: 0;
  }

  .page-section-head,
  .page-hero-head {
    padding: 18px;
  }

  .page-section-head h2 {
    font-size: 28px;
  }

  .page-section-head p {
    font-size: 15px;
  }

  .page-head-actions {
    justify-content: flex-start;
  }

  .page-create .command-band,
  .page-create .progress-ribbon,
  .onboarding-card {
    padding: 16px;
  }

  .onboarding-steps {
    grid-template-columns: 1fr;
  }

  .page-delivery {
    grid-template-columns: 1fr;
  }

  .page-delivery .preview-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .model-config-toolbar,
  .form-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .dashboard-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-tab,
  .dashboard-tab:nth-child(n+5),
  .dashboard-tab:nth-child(7) {
    font-size: 13px;
    padding-inline: 7px;
  }

  .dashboard-tab:nth-child(5),
  .dashboard-tab:nth-child(6) {
    grid-column: span 2;
  }

  .dashboard-tab:nth-child(7) {
    grid-column: span 2;
  }
}

/* === UX flow alignment (2026-07-03) === */

#createReadinessSummary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.create-reset-button {
  min-height: 32px;
  border-color: rgba(15, 75, 67, 0.18);
  background: #ffffff;
  color: #0f4b43;
  font-size: 13px;
  font-weight: 800;
  padding: 7px 12px;
}

.main-panel[data-active-page="create"] .app-workspace,
.main-panel[data-active-page="models"] .app-workspace,
.main-panel[data-active-page="settings"] .app-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.main-panel[data-active-page="projects"] .project-tools {
  padding-bottom: 18px;
}

.page-create .command-band,
.page-create .progress-ribbon {
  height: auto;
  min-height: 0;
}

.page-create .command-band {
  overflow: visible;
}

.page-create .progress-ribbon {
  grid-template-rows: auto auto auto minmax(72px, auto);
}

.task-main-actions .secondary-button[data-main-open-delivery] {
  border-color: rgba(15, 75, 67, 0.2);
  color: #0f4b43;
  font-weight: 800;
}

.provider-model-form.is-collapsed {
  display: none;
}

.provider-more-actions {
  position: relative;
  min-height: 38px;
}

.provider-more-actions summary {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink-muted);
  cursor: pointer;
  font-size: var(--text-13);
  font-weight: 700;
  list-style: none;
  padding: 0 14px;
}

.provider-more-actions summary::-webkit-details-marker {
  display: none;
}

.provider-more-actions[open] {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.provider-more-actions[open] summary {
  background: var(--surface-soft);
}

.provider-health-details {
  margin-top: 0;
}

@media (max-width: 767.98px) {
  .page-delivery .chapter-list-panel {
    max-height: 58vh;
    overflow: auto;
  }

  .page-delivery .preview-panel {
    display: flex;
    flex-direction: column;
  }

  .page-delivery #downloadPanel {
    order: 3;
  }

  .page-delivery #chapterPanel {
    order: 4;
  }

  .page-delivery .preview-illustration {
    order: 5;
  }

  .provider-more-actions,
  .provider-more-actions[open] {
    display: flex;
    width: 100%;
  }

  .provider-more-actions summary,
  .provider-more-actions button {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* === Main-flow presentation refinement (2026-07-05) === */

.main-panel[data-active-page="create"] .app-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.main-panel[data-active-page="create"] .app-page-stack {
  max-width: none;
}

.page-create .page-hero-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 22px;
  align-items: start;
  border: 1px solid rgba(15, 75, 67, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(249, 247, 240, 0.94)),
    radial-gradient(420px 130px at 8% 0%, rgba(15, 75, 67, 0.08), transparent 70%);
}

.create-context-line {
  display: inline-flex;
  max-width: 100%;
  margin-top: 14px;
  border-left: 3px solid #0f4b43;
  border-radius: 0 8px 8px 0;
  background: #f6f2e8;
  color: #53615a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  padding: 8px 11px;
}

.create-step-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.create-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 1px solid #e7e1d5;
  border-radius: 8px;
  background: #fbfaf6;
  padding: 10px;
}

.create-step span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #eee8dc;
  color: #5d6a62;
  font-weight: 800;
}

.create-step strong,
.create-step small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-step strong {
  color: #17211c;
  font-size: 13px;
}

.create-step small {
  grid-column: 2;
  color: #6b746c;
  font-size: 12px;
}

.create-step.is-current {
  border-color: rgba(15, 75, 67, 0.28);
  background: #edf6f0;
}

.create-step.is-current span,
.create-step.is-done span {
  background: #0f4b43;
  color: #ffffff;
}

.create-step.is-warning {
  border-color: rgba(192, 138, 42, 0.35);
  background: #fff8e7;
}

.create-step.is-warning span {
  background: #c08a2a;
  color: #ffffff;
}

#createReadinessSummary {
  justify-content: flex-end;
}

.next-action-card {
  flex: 1 1 100%;
  display: grid;
  gap: 4px;
  min-width: 250px;
  border: 1px solid #e7e1d5;
  border-radius: 8px;
  background: #fffdf7;
  padding: 14px;
}

.next-action-card span {
  color: #6b746c;
  font-size: 12px;
  font-weight: 800;
}

.next-action-card strong {
  color: #17211c;
  font-size: 17px;
}

.next-action-card.is-ready {
  border-color: rgba(15, 75, 67, 0.24);
  background: #edf6f0;
}

.metric-chip.is-warning {
  background: #fff4d8;
  color: #8a5a11;
}

.page-create .command-band {
  position: relative;
  gap: 14px;
  border-color: rgba(15, 75, 67, 0.12);
}

.page-create .command-band > * {
  min-width: 0;
}

.page-create .command-band label {
  display: grid;
  gap: 8px;
}

.page-create .upload-control {
  position: relative;
}

.page-create:not(.has-upload) .upload-control::after {
  content: "先选文件，再读取预检";
  position: absolute;
  left: 18px;
  bottom: 9px;
  color: #7c847c;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.page-create.has-upload .upload-control::after {
  display: none;
}

.page-create .command-upload {
  min-height: 76px;
  align-items: start;
  padding-top: 14px;
}

.page-create .upload-read-button {
  min-height: 76px;
}

.page-create .command-band select,
.page-create .command-band input {
  min-height: 46px;
}

.control-hint {
  color: #6b746c;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.start-button:not(:disabled) {
  background: #0f4b43;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 75, 67, 0.18);
  transform: translateY(-1px);
}

.start-button:disabled {
  background: #ece8df;
  color: #8a8f88;
  box-shadow: none;
}

.preflight-warning-panel {
  border-color: rgba(192, 138, 42, 0.26);
  background: #fffaf0;
}

.preflight-warning-head {
  align-items: flex-start;
}

.preflight-warning-head p {
  margin: 4px 0 0;
  color: #6b746c;
  font-size: 13px;
  line-height: 1.45;
}

.preflight-warning-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.preflight-warning-summary-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid rgba(192, 138, 42, 0.2);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.9);
  padding: 12px;
}

.preflight-warning-summary-card span {
  color: #8a5a11;
  font-size: 12px;
  font-weight: 900;
}

.preflight-warning-summary-card strong {
  color: #17211c;
  font-size: 18px;
}

.preflight-warning-summary-card small,
.preflight-warning-summary-card em {
  color: #6b746c;
  font-size: 12px;
  line-height: 1.45;
}

.preflight-warning-summary-card em {
  display: -webkit-box;
  overflow: hidden;
  font-style: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.preflight-warning-group {
  border: 1px solid rgba(192, 138, 42, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.preflight-warning-group + .preflight-warning-group {
  margin-top: 10px;
}

.preflight-warning-group > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  padding: 12px;
}

.preflight-warning-group > summary::-webkit-details-marker,
.preflight-warning-more > summary::-webkit-details-marker {
  display: none;
}

.preflight-warning-group > summary span {
  display: grid;
  gap: 3px;
}

.preflight-warning-group > summary strong {
  color: #17211c;
  font-size: 14px;
}

.preflight-warning-group > summary small {
  color: #6b746c;
  font-size: 12px;
}

.preflight-warning-group > summary em {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f3ead3;
  color: #8a5a11;
  font-style: normal;
  font-weight: 800;
  padding: 5px 9px;
}

.preflight-warning-default {
  margin: 0 12px 10px;
  border-radius: 8px;
  background: #f8f3e7;
  color: #53615a;
  font-size: 13px;
  line-height: 1.55;
  padding: 10px;
}

.preflight-warning-items {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.preflight-warning-item + .preflight-warning-item {
  margin-top: 0;
}

.preflight-warning-more {
  padding: 0 12px 12px;
}

.preflight-warning-more > summary {
  cursor: pointer;
  color: #0f4b43;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.preflight-warning-more .preflight-warning-items {
  padding: 10px 0 0;
}

@media (max-width: 1119.98px) {
  .main-panel[data-active-page="create"] .app-workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .page-create .page-hero-head {
    grid-template-columns: 1fr;
  }

  .page-create {
    grid-template-columns: 1fr;
  }

  .page-create .command-band,
  .page-create .progress-ribbon {
    grid-column: auto;
  }

  #createReadinessSummary {
    justify-content: flex-start;
  }
}

@media (max-width: 767.98px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    order: 1;
    grid-row: auto;
  }

  .dashboard-tabs {
    order: 2;
    grid-row: auto;
  }

  .header-actions {
    order: 3;
    grid-row: auto;
    grid-column: auto;
  }

  .main-panel[data-active-page="create"] .app-workspace {
    grid-template-columns: 1fr;
  }

  .main-panel[data-active-page="create"] .app-page-stack {
    grid-row: 1;
  }

  .create-step-rail {
    grid-template-columns: 1fr 1fr;
  }

  .page-create .command-band::before {
    grid-column: 1;
  }

  .preflight-warning-summary-grid {
    grid-template-columns: 1fr;
  }

  .preflight-warning-head {
    display: grid;
  }
}

/* === Workspace display consolidation (2026-07-05) === */

.page-section-head,
.page-hero-head {
  border-radius: 8px;
}

.page-create .page-hero-head {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  min-height: 0;
  padding: 22px 26px;
}

#createReadinessSummary {
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

.next-action-line {
  display: grid;
  gap: 2px;
  border-left: 3px solid #0f4b43;
  background: transparent;
  color: #17211c;
  padding: 4px 0 4px 12px;
}

.next-action-line span {
  color: #6b746c;
  font-size: 12px;
  font-weight: 800;
}

.next-action-line strong {
  font-size: 17px;
  line-height: 1.45;
}

.next-action-line.is-ready {
  border-left-color: #0f6b55;
}

.readiness-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  color: #5c675f;
  font-size: 13px;
  line-height: 1.7;
}

.readiness-status {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  border: 0;
  background: transparent;
  color: #6b746c;
  font-weight: 700;
  padding: 0;
}

.readiness-status + .readiness-status::before {
  content: " / ";
  color: #b2aa9b;
  font-weight: 500;
  padding: 0 7px;
}

.readiness-status.is-ready {
  color: #0f6b55;
}

.readiness-status.is-warning {
  color: #8a5a11;
}

.create-reset-button {
  justify-self: start;
}

.create-step-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  border-top: 1px solid #e5ded0;
}

.create-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px 10px 0 0;
}

.create-step-index {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ede8dc;
  color: #5d6a62;
  font-size: 13px;
  font-weight: 900;
}

.create-step strong {
  font-size: 13px;
  line-height: 1.2;
}

.create-step small {
  grid-column: 2;
  color: #7c847c;
  font-size: 12px;
}

.create-step.is-current,
.create-step.is-warning {
  background: transparent;
  border-color: transparent;
}

.create-step.is-current .create-step-index,
.create-step.is-done .create-step-index {
  background: #0f4b43;
  color: #fff;
}

.create-step.is-warning .create-step-index {
  background: #c08a2a;
  color: #fff;
}

.page-create .command-band::before {
  content: none;
}

.page-create .command-band,
.page-create .progress-ribbon,
.summary-box,
.project-main-board,
.task-main-board,
.page-delivery .book-panel,
.page-delivery .chapter-list-panel,
.page-delivery .preview-panel,
.page-review .result-panel,
.model-config-panel,
.provider-model-form,
.settings-card {
  border: 1px solid rgba(15, 75, 67, 0.08);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.provider-model-form.is-collapsed {
  display: none !important;
}

.page-create .command-band {
  gap: 12px;
}

.summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid #eee7da;
  border-bottom: 1px solid #eee7da;
  padding: 8px 0;
}

.summary-grid div {
  min-width: auto;
  border: 0;
  background: transparent;
  padding: 0;
}

.summary-grid div + div::before {
  content: " / ";
  color: #b2aa9b;
  padding: 0 9px;
}

.summary-grid strong {
  margin-right: 4px;
  font-size: 15px;
}

.summary-grid small {
  font-size: 12px;
}

.preflight-warning-panel {
  border-color: rgba(192, 138, 42, 0.22);
  background: #fffaf0;
}

.preflight-warning-head {
  display: flex;
  border-bottom: 1px solid rgba(192, 138, 42, 0.18);
  margin-bottom: 0;
  padding-bottom: 10px;
}

.preflight-warning-summary-table {
  display: grid;
  gap: 0;
  margin: 10px 0;
  border-top: 1px solid rgba(192, 138, 42, 0.18);
  border-bottom: 1px solid rgba(192, 138, 42, 0.18);
}

.preflight-warning-summary-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.95fr) 70px minmax(130px, 1fr) minmax(220px, 1.7fr);
  gap: 12px;
  align-items: start;
  border: 0;
  border-bottom: 1px solid rgba(192, 138, 42, 0.14);
  background: transparent;
  padding: 10px 0;
}

.preflight-warning-summary-row:last-child {
  border-bottom: 0;
}

.preflight-warning-summary-row span,
.preflight-warning-summary-row strong,
.preflight-warning-summary-row small,
.preflight-warning-summary-row em {
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
}

.preflight-warning-summary-row span {
  color: #8a5a11;
  font-weight: 900;
}

.preflight-warning-summary-row strong {
  color: #17211c;
}

.preflight-warning-summary-row small,
.preflight-warning-summary-row em {
  color: #6b746c;
  font-style: normal;
}

.preflight-warning-group {
  border: 0;
  border-top: 1px solid rgba(192, 138, 42, 0.14);
  border-radius: 0;
  background: transparent;
}

.preflight-warning-group > summary {
  padding: 10px 0;
}

.preflight-warning-default {
  margin: 0 0 8px;
  border-radius: 6px;
  background: #f8f3e7;
}

.preflight-warning-items {
  padding: 0 0 10px;
}

.preflight-warning-item {
  border: 0;
  border-left: 2px solid rgba(192, 138, 42, 0.38);
  border-radius: 0;
  background: transparent;
  padding: 6px 0 6px 10px;
}

.project-list,
.execution-list {
  display: grid;
  gap: 0;
}

.project-item,
.execution-item {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 10px 12px;
}

.project-item + .project-item,
.execution-item + .execution-item,
.project-row + .project-row {
  border-top: 1px solid #eee7da;
}

.project-item.active,
.project-item[aria-current="true"],
.execution-item.active {
  border-left: 3px solid #0f4b43;
  background: #edf6f0;
  box-shadow: none;
}

.task-main-list,
.project-main-list {
  gap: 0;
}

.task-main-card,
.project-main-card {
  border-radius: 0;
  border-width: 0 0 1px;
  box-shadow: none;
}

.task-main-actions {
  padding-top: 8px;
}

.download-item-row,
.book-select,
.chapter-list button,
.provider-model-card {
  border-radius: 6px;
}

@media (max-width: 767.98px) {
  #createReadinessSummary {
    justify-items: start;
  }

  .create-step-rail {
    grid-template-columns: 1fr;
  }

  .create-step {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    padding-right: 0;
  }

  .create-step small {
    grid-column: 3;
    justify-self: end;
  }

  .preflight-warning-summary-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
  }

  .preflight-warning-summary-row small,
  .preflight-warning-summary-row em {
    grid-column: 1 / -1;
  }
}

/* === 作品入口收敛：作品页集中选择，其他页面只显示当前作品上下文 === */
.app-workspace,
.main-panel[data-active-page="create"] .app-workspace,
.main-panel[data-active-page="projects"] .app-workspace,
.main-panel[data-active-page="tasks"] .app-workspace,
.main-panel[data-active-page="delivery"] .app-workspace,
.main-panel[data-active-page="review"] .app-workspace,
.main-panel[data-active-page="models"] .app-workspace,
.main-panel[data-active-page="settings"] .app-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.project-main-board {
  display: grid;
  gap: 16px;
}

.project-main-board[data-project-mode="detail"] {
  align-content: start;
}

.project-list-toolbar {
  align-items: center;
}

.project-tools-inline {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) auto minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  padding: 14px 0 10px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.project-tools-inline label {
  min-width: 0;
}

.project-tools-inline .project-sort-note {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
}

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

.project-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  overflow: hidden;
}

.project-file-row.active {
  border-color: rgba(15, 75, 67, 0.35);
  background: linear-gradient(90deg, rgba(15, 75, 67, 0.08), rgba(255, 255, 255, 0.96));
}

.project-file-row.active::before {
  content: "";
  width: 4px;
  background: var(--primary);
  grid-row: 1;
  grid-column: 1;
}

.project-file-row .project-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 12px 14px;
}
.project-file-title { grid-column: 1; grid-row: 1; }
.project-file-status { grid-column: 2; grid-row: 1; align-self: start; }
.project-file-title small { display: block; margin-top: 4px; }
.project-file-time { grid-column: 1; grid-row: 2; margin-top: 4px; }
.project-file-action { grid-column: 2; grid-row: 2; justify-self: end; align-self: end; }

.project-file-row.active .project-item {
  padding-left: 18px;
}

.project-file-title {
  min-width: 0;
}

.project-file-title strong {
  overflow: hidden;
  color: var(--ink-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-file-title small,
.project-file-time {
  color: var(--muted);
  font-size: 13px;
}

.project-file-status {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.project-file-action {
  justify-self: end;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.project-file-row .project-main-delete {
  align-self: center;
  margin-right: 10px;
  white-space: nowrap;
}

.project-detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
  padding: 18px;
}

.project-detail-card {
  display: grid;
  gap: 16px;
}

.project-detail-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 12px;
}

.project-detail-nav span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.project-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.project-detail-head h3 {
  margin: 6px 0 4px;
  color: var(--ink-strong);
  font-size: 24px;
  line-height: 1.25;
}

.project-detail-head p {
  margin: 0;
  color: var(--muted);
}

.project-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.project-detail-summary div {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 12px;
}

.project-detail-summary dt {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-detail-summary dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.project-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-state-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  padding: 5px 10px;
  text-decoration: none;
}

@media (max-width: 900px) {
  .project-tools-inline,
  .project-file-row .project-item,
  .project-detail-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-file-action {
    justify-self: start;
  }

  .project-detail-head {
    display: grid;
  }
}

/* === 滚动与中等屏重叠修复：桌面只保留工作区滚动，导航自然换行 === */
@media (min-width: 1120px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .delivery-shell,
  .main-panel {
    height: 100vh;
    min-height: 0;
  }

  .app-workspace {
    min-height: 0;
  }

  .app-page-stack {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

@media (min-width: 1120px) and (max-width: 1320px) {
  .app-header {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .header-actions {
    grid-column: 1 / -1;
    justify-self: end;
    margin-top: 0;
    max-width: 100%;
  }

  .dashboard-tabs {
    align-content: start;
  }
}

.page-head-actions,
.project-detail-actions,
.task-main-actions,
.provider-model-actions,
.download-actions {
  min-width: 0;
}

.metric-chip,
.secondary-link,
.project-file-status,
.project-file-action,
.project-file-time {
  overflow-wrap: anywhere;
  white-space: normal;
}

.provider-advanced-form {
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

.provider-advanced-form summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  padding: 0 12px;
}

.provider-advanced-form summary::-webkit-details-marker {
  display: none;
}

.provider-advanced-form summary::after {
  content: "展开";
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.provider-advanced-form[open] summary::after {
  content: "收起";
}

.provider-advanced-grid,
.provider-advanced-form .form-checks {
  margin-top: 12px;
}

/* === 成稿阅读页滚动修复：桌面局部滚动，移动端自然页面滚动 === */
.page-delivery {
  min-width: 0;
}

.page-delivery .chapter-workbench,
.page-delivery .preview-panel,
.page-delivery .book-panel,
.page-delivery .chapter-list-panel,
.page-delivery .chapter-panel,
.page-delivery .chapter-text {
  min-width: 0;
  min-height: 0;
}

.page-delivery .preview-illustration {
  opacity: 0.28;
}

.page-delivery .chapter-list-panel {
  scrollbar-width: thin;
}

.page-delivery .chapter-list-panel,
.page-delivery .chapter-text {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.page-delivery .chapter-text {
  box-sizing: border-box;
  width: min(100%, 820px);
  max-width: 820px;
  margin-top: 22px;
  padding: 0 10px 22px 0;
  outline: none;
  scrollbar-width: thin;
}

.page-delivery .chapter-text:focus-visible {
  box-shadow: none;
  outline: 2px solid rgba(15, 75, 67, 0.28);
  outline-offset: 4px;
}

@media (min-width: 1120px) {
  .page-delivery {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100vh - 220px);
    min-height: 560px;
    align-content: stretch;
  }

  .page-delivery > .page-section-head {
    grid-column: 1 / -1;
  }

  .page-delivery .chapter-workbench {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
  }

  .page-delivery .book-panel {
    overflow: hidden;
  }

  .page-delivery .chapter-list-panel {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
  }

  .page-delivery .preview-panel {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .page-delivery .chapter-panel {
    overflow: hidden;
  }

  .page-delivery .chapter-panel:not(.empty) {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    align-content: stretch;
    padding: 24px 42px 18px;
  }

  .page-delivery .chapter-panel.empty {
    min-height: 220px;
  }

  .page-delivery .chapter-text {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .page-delivery .download-panel {
    max-height: 154px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 32px 16px;
  }
}

@media (max-width: 1119.98px) {
  .page-delivery {
    height: auto;
    min-height: 0;
  }

  .page-delivery .chapter-workbench,
  .page-delivery .preview-panel,
  .page-delivery .chapter-list-panel,
  .page-delivery .chapter-panel,
  .page-delivery .chapter-text {
    overflow: visible;
  }

  .page-delivery .preview-panel {
    min-height: 0;
  }

  .page-delivery .preview-illustration {
    display: none;
  }

  .page-delivery .chapter-panel:not(.empty) {
    padding: 22px 18px;
  }

  .page-delivery .chapter-text {
    width: 100%;
    max-width: none;
    padding-right: 0;
  }

  .page-delivery .download-panel {
    max-height: none;
    overflow: visible;
  }
}

/* === 成稿页阅读收敛：左栏只保留章节列表，正文优先 === */
.page-delivery .book-panel.is-hidden,
.page-delivery #bookPanel[hidden] {
  display: none !important;
}

.page-delivery .chapter-workbench {
  gap: 0;
}

.page-delivery .chapter-list-panel {
  margin: 0;
}

.page-delivery .chapter-list-panel h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #17211c;
  font-size: 17px;
  letter-spacing: 0;
}

.page-delivery .chapter-list button {
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 10px;
  min-height: 48px;
  padding: 10px 12px 10px 14px;
  border-left: 3px solid transparent;
}

.page-delivery .chapter-list button.active {
  border-left-color: var(--accent);
  background: rgba(15, 75, 67, 0.08);
}

.page-delivery .chapter-list .chapter-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-delivery .chapter-list .chapter-state {
  color: var(--muted);
}

.page-delivery .preview-illustration {
  display: none;
}

.page-delivery .chapter-panel:not(.empty) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 251, 247, 0.96));
}

.page-delivery .chapter-text {
  width: min(100%, 900px);
  max-width: 900px;
  max-height: none;
  color: #18231e;
  font-size: 18px;
  line-height: 2.12;
  background: transparent;
  border: 0;
  border-radius: 0;
}

@media (min-width: 1120px) {
  .page-delivery {
    grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
    height: 100%;
    min-height: 0;
  }

  .page-delivery .chapter-workbench {
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    max-height: 100%;
    align-self: stretch;
    overflow: hidden;
  }

  .page-delivery .chapter-workbench > h2 {
    grid-row: 1;
  }

  .page-delivery .chapter-list-panel {
    grid-row: 2;
    height: auto;
    max-height: 100%;
    min-height: 0;
    padding: 16px 12px 12px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .page-delivery .preview-panel {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  .page-delivery .preview-head {
    padding: 16px 32px 10px;
  }

  .page-delivery .chapter-panel:not(.empty) {
    grid-template-rows: auto auto auto minmax(0, 1fr);
    padding: 20px 46px 12px;
  }

  .page-delivery .chapter-text {
    height: 100%;
    min-height: 420px;
    margin-top: 16px;
    padding: 0 14px 28px 0;
  }

  .page-delivery .download-panel[hidden] {
    display: none;
  }

  .page-delivery .download-panel {
    max-height: 72px;
    padding: 8px 32px 10px;
  }

  .page-delivery .download-group {
    gap: 8px;
  }

  .page-delivery .download-group-title {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .page-delivery .download-button,
  .page-delivery .download-copy-link {
    min-height: 32px;
    padding-block: 7px;
  }

  .main-panel[data-active-page="delivery"] .app-page-stack {
    overflow: hidden;
  }
}

.page-delivery .download-panel[hidden] {
  display: none;
}

@media (max-width: 1119.98px) {
  .page-delivery .chapter-workbench {
    display: block;
  }

  .page-delivery .chapter-list-panel {
    padding: 14px;
  }
}

@media (max-width: 767.98px) {
  .page-delivery #chapterPanel {
    order: 3;
  }

  .page-delivery #downloadPanel {
    order: 4;
  }

  .page-delivery .chapter-text {
    font-size: 16px;
    line-height: 2;
  }
}

/* === 信息展示继续收敛：模型服务、作品、任务、复盘 === */
.page-projects .page-section-head,
.page-models .page-section-head,
.page-tasks .page-section-head,
.page-review .page-section-head {
  align-items: end;
}

.page-projects .page-head-actions,
.page-models .page-head-actions,
.page-tasks .page-head-actions,
.page-review .page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.project-list-toolbar {
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  border: 0;
  padding-bottom: 0;
}

.project-list-toolbar h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
}

.project-list-toolbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.project-tools-inline {
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 0.65fr) auto minmax(150px, 0.6fr);
  gap: 10px;
  padding: 10px 0;
}

.project-tools-inline .project-sort-note {
  display: none;
}

.project-detail-summary div,
.project-main-metrics span {
  border-radius: 6px;
  box-shadow: none;
}

.provider-model-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(0, 2fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid rgba(15, 75, 67, 0.12);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px 16px;
}

.provider-model-summary.is-ready {
  border-color: rgba(15, 75, 67, 0.2);
  background: #f5fbf7;
}

.provider-model-summary.is-warning {
  border-color: rgba(192, 138, 42, 0.24);
  background: #fffaf0;
}

.provider-summary-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.provider-summary-main strong,
.provider-summary-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-summary-main strong {
  color: var(--ink-strong);
  font-size: 17px;
}

.provider-summary-main small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.provider-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-left: 1px solid var(--line-soft);
}

.provider-summary-stats div {
  min-width: 0;
  border-right: 1px solid var(--line-soft);
  padding: 0 14px;
}

.provider-summary-stats dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.provider-summary-stats dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-config-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.model-config-panel,
.provider-model-form {
  border-radius: 8px;
  padding: 16px;
}

.model-config-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 12px;
}

.model-config-toolbar h3,
.provider-form-head h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
}

.model-config-toolbar p,
.provider-form-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.provider-model-list {
  gap: 0;
  border-top: 1px solid var(--line-soft);
}

.provider-disabled-group {
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.provider-disabled-group > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 0;
  font-weight: 700;
  color: var(--muted-strong);
}

.provider-disabled-group > summary::-webkit-details-marker {
  display: none;
}

.provider-disabled-group > summary::before {
  content: "+";
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.provider-disabled-group[open] > summary::before {
  content: "-";
}

.provider-disabled-list {
  border-top: 1px dashed var(--line-soft);
}

.provider-disabled-list .provider-model-card {
  opacity: 0.68;
}

.provider-model-card {
  grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 1.4fr) auto;
  gap: 12px 18px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  padding: 13px 0;
}

.provider-model-card.is-editing {
  border-bottom-color: rgba(15, 75, 67, 0.38);
  background: linear-gradient(90deg, rgba(15, 75, 67, 0.07), transparent);
  box-shadow: none;
}

.provider-model-head {
  align-items: center;
}

.provider-model-meta {
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 4px 8px;
}

.provider-model-technical,
.provider-model-reasons {
  grid-column: 1 / -1;
}

.provider-model-actions {
  justify-content: flex-end;
}

.provider-model-form.is-collapsed {
  display: none !important;
}

.provider-form-head {
  margin-bottom: 12px;
}

.task-main-card {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.8fr) auto;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 0;
}

.task-main-card.is-active {
  background: linear-gradient(90deg, rgba(15, 75, 67, 0.08), transparent);
}

.task-main-progress,
.task-main-meta,
.task-main-actions {
  margin: 0;
}

.task-main-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 13px;
}

.task-main-actions {
  justify-content: flex-end;
}

.page-review .result-panel {
  padding: 0;
}

.page-review .result-summary {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.page-review .result-summary > h3 {
  margin: 0;
  font-size: 22px;
}

.page-review .quality-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.page-review .quality-summary-tile {
  border: 0;
  border-right: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  padding: 10px 12px;
}

.page-review .review-downloads {
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

@media (max-width: 1119.98px) {
  .provider-model-summary,
  .provider-model-card,
  .task-main-card,
  .project-tools-inline {
    grid-template-columns: minmax(0, 1fr);
  }

  .provider-summary-stats {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    padding-top: 10px;
  }

  .provider-model-actions,
  .task-main-actions {
    justify-content: flex-start;
  }

  .page-review .quality-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .provider-summary-stats,
  .provider-model-meta,
  .page-review .quality-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .provider-summary-stats div,
  .page-review .quality-summary-tile {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 8px 0;
  }
}

/* === 创作页局部修复：避免上传控件和上传后摘要在窄宽度下文字重叠 === */
.page-create .upload-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 0;
  align-items: stretch;
  min-width: 0;
}

.page-create .command-upload {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
  min-height: 62px;
  padding: 0 16px;
}

.page-create .command-upload span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-create .upload-read-button {
  min-width: 0;
  min-height: 62px;
  padding-inline: 10px;
}

.page-create:not(.has-upload) .upload-control::after {
  position: static;
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-left: 2px;
  color: #6f776f;
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

.page-create .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  border-top: 1px solid #eee7da;
  border-bottom: 1px solid #eee7da;
  padding: 10px 0;
}

.page-create .summary-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.page-create .summary-grid div + div::before {
  content: none;
}

.page-create .summary-grid strong,
.page-create .summary-grid small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.page-create .summary-grid strong {
  margin-right: 0;
  color: var(--ink-strong);
  font-size: 16px;
  line-height: 1.25;
}

.page-create .summary-grid small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* === Final UX consolidation: reduce stacked blocks and stabilize readable flows === */
.context-summary,
.metric-chip {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  justify-content: flex-end;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #53615a;
  box-shadow: none;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-section-head {
  border: 0;
  border-bottom: 1px solid #e7e1d5;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 0 16px;
}

.page-section-head h2 {
  letter-spacing: 0;
}

.page-section-head p {
  max-width: 720px;
}

.page-head-actions {
  min-width: 0;
}

.page-create .page-hero-head {
  border-bottom: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(250, 248, 241, 0.72));
  padding: 20px 22px;
}

.page-create .command-band {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  grid-template-areas:
    "upload upload"
    "provider target"
    "start start";
  gap: 12px;
  align-items: end;
  align-content: start;
  border-radius: 10px;
  background: #fffdf8;
  padding: 16px;
}

.page-create .command-band > .upload-control {
  grid-area: upload;
}

.page-create .command-band > label {
  min-width: 0;
  max-width: 100%;
}

.page-create .command-band > label:nth-of-type(1) {
  grid-area: provider;
}

.page-create .command-band > label:nth-of-type(2) {
  grid-area: target;
}

.page-create .command-band > .start-button {
  grid-area: start;
  justify-self: stretch;
}

.page-create .upload-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 0;
  align-items: stretch;
  min-width: 0;
}

.page-create .command-upload {
  justify-content: flex-start;
  min-width: 0;
  min-height: 58px;
  padding: 0 14px;
  overflow: hidden;
  text-align: left;
}

.page-create .command-upload::before {
  flex: 0 0 auto;
  width: 26px;
  height: 28px;
}

.page-create .command-upload span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-create .upload-read-button {
  min-width: 0;
  min-height: 58px;
  padding-inline: 10px;
}

.page-create:not(.has-upload) .upload-control::after {
  position: static;
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-left: 2px;
  white-space: normal;
}

.page-create .summary-box {
  border-radius: 10px;
  padding: 16px 18px;
}

.page-create .summary-head {
  gap: 12px;
  align-items: flex-start;
}

.page-create .summary-head h3 {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.page-create .summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 12px;
  border-top: 1px solid #eee7da;
  border-bottom: 1px solid #eee7da;
  padding: 10px 0;
}

.page-create .summary-metric,
.page-create .summary-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0 12px;
}

.page-create .summary-grid div:first-child {
  padding-left: 0;
}

.page-create .summary-grid div:last-child {
  padding-right: 0;
}

.page-create .summary-grid div + div {
  border-left: 1px solid #eee7da;
}

.page-create .summary-grid div + div::before {
  content: none !important;
}

.page-create .summary-grid strong {
  display: block;
  color: #16221c;
  font-size: 20px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.page-create .summary-grid small {
  order: -1;
  color: #6b746c;
  font-size: 12px;
  font-weight: 800;
}

.preflight-warning-panel {
  border-radius: 10px;
  padding: 12px 14px;
}

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

.preflight-warning-summary-table {
  overflow: hidden;
  border: 1px solid rgba(192, 138, 42, 0.2);
  border-radius: 8px;
  background: #fffdf8;
}

.preflight-warning-summary-row {
  grid-template-columns: minmax(120px, 0.7fr) 72px minmax(160px, 0.9fr) minmax(220px, 1.3fr);
  border-bottom: 1px solid rgba(192, 138, 42, 0.16);
  background: transparent;
}

.preflight-warning-summary-row:last-child {
  border-bottom: 0;
}

.preflight-warning-group {
  margin-top: 10px;
  border-radius: 8px;
  background: #fffefa;
}

.preflight-warning-group:not([open]) .preflight-warning-default,
.preflight-warning-group:not([open]) .preflight-warning-items,
.preflight-warning-group:not([open]) .preflight-warning-more {
  display: none;
}

.project-main-board,
.task-main-board,
.model-config-panel,
.provider-model-form,
.page-review .result-panel,
.settings-card {
  border-radius: 10px;
  box-shadow: none;
}

.project-list-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.project-tools-inline {
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 0.55fr) auto;
  align-items: end;
}

.project-tools-inline .project-sort-note {
  display: none !important;
}

.project-file-row .project-item {
  grid-template-columns: minmax(240px, 1.6fr) minmax(84px, 0.45fr) minmax(132px, 0.62fr) 76px;
  min-height: 58px;
  padding-block: 10px;
}

.project-file-action,
.project-file-status,
.project-file-time {
  white-space: nowrap;
}

.project-detail-card {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.project-detail-nav {
  border-bottom: 1px solid #eee7da;
  padding-bottom: 12px;
}

.project-detail-summary,
.project-main-metrics {
  gap: 0;
  border-top: 1px solid #eee7da;
  border-bottom: 1px solid #eee7da;
}

.project-detail-summary div,
.project-main-metrics span {
  border: 0;
  border-right: 1px solid #eee7da;
  border-radius: 0;
  background: transparent;
}

.project-detail-summary div:last-child,
.project-main-metrics span:last-child {
  border-right: 0;
}

.task-main-card {
  border: 0;
  border-bottom: 1px solid #eee7da;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.task-main-list .task-main-card:last-child {
  border-bottom: 0;
}

.task-main-select {
  text-align: left;
}

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

.secondary-button.danger {
  border-color: rgba(172, 61, 55, 0.26);
  color: #9b332f;
}

.page-delivery .preview-illustration {
  display: none;
}

.page-delivery .preview-panel {
  border-radius: 10px;
  background: #fffefa;
}

.page-delivery .chapter-text {
  max-width: 860px;
  padding-right: 6px;
}

.page-delivery .download-panel {
  border-top: 1px solid #eee7da;
  background: #fffefa;
}

.page-review .result-summary {
  gap: 10px;
}

.page-review .quality-summary-grid {
  border-color: #eee7da;
}

.provider-model-summary {
  border-radius: 10px;
  box-shadow: none;
}

.provider-model-card {
  min-height: 64px;
}

.provider-model-actions .readonly-note {
  color: #6b746c;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.provider-model-technical summary {
  color: #53615a;
  font-size: 13px;
  font-weight: 800;
}

.settings-grid {
  align-items: start;
}

.settings-card {
  padding: 18px;
}

.account-settings-form {
  border-top: 1px solid #eee7da;
  margin-top: 14px;
  padding-top: 14px;
}

@media (max-width: 1119.98px) {
  .page-create .command-band,
  .project-tools-inline,
  .provider-model-summary,
  .provider-model-card,
  .task-main-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-create .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-file-row .project-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .project-file-time,
  .project-file-action {
    grid-column: 1 / -1;
  }
}

@media (max-width: 767.98px) {
  .context-summary,
  .metric-chip {
    justify-content: flex-start;
    white-space: normal;
  }

  .page-section-head,
  .page-create .page-hero-head {
    padding-inline: 0;
  }

  .page-create .command-band,
  .summary-box,
  .project-main-board,
  .task-main-board,
  .model-config-panel,
  .provider-model-form,
  .settings-card {
    padding: 14px;
  }

  .page-create .summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-create .summary-grid div,
  .page-create .summary-grid div:first-child,
  .page-create .summary-grid div:last-child {
    border-left: 0;
    border-bottom: 1px solid #eee7da;
    padding: 8px 0;
  }

  .page-create .summary-grid div:last-child {
    border-bottom: 0;
  }

  .preflight-warning-head,
  .preflight-warning-summary-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-detail-summary,
  .project-main-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-detail-summary div,
  .project-main-metrics span {
    border-right: 0;
    border-bottom: 1px solid #eee7da;
  }

  .project-detail-summary div:last-child,
  .project-main-metrics span:last-child {
    border-bottom: 0;
  }
}


.contract-editor-panel {
  margin: 0 24px 16px;
  padding: 16px 20px;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 10px;
}
.contract-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.contract-editor-head h3 { margin: 0; font-size: 1.05rem; }
.contract-editor-head p { margin: 4px 0 0; color: var(--text-muted, #6b7280); font-size: 0.85rem; }
.contract-editor-status {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
}
.contract-editor-status.is-dirty { background: #fff7ed; color: #c2410c; }
.contract-editor-status.is-clean { background: #ecfdf5; color: #047857; }
.contract-editor-section { border-top: 1px solid var(--border-subtle, #e5e7eb); padding: 8px 0; }
.contract-editor-section:first-of-type { border-top: none; }
.contract-editor-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.contract-editor-section > summary::-webkit-details-marker { display: none; }
.contract-editor-section-title { font-weight: 600; }
.contract-editor-section-dirty {
  margin-left: auto;
  font-style: normal;
  font-size: 0.78rem;
  color: #c2410c;
}
.contract-editor-section-body { padding: 8px 0 12px; }
.contract-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.contract-editor-field.span-2 { grid-column: span 2; }
.contract-editor-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.contract-editor-field > span { color: #4b5563; }
.contract-editor-input {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle, #d1d5db);
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}
.contract-editor-input:focus { outline: 2px solid #2563eb33; border-color: #2563eb; }
.contract-editor-card {
  border: 1px solid var(--border-subtle, #e5e7eb);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contract-editor-card > header {
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}
.contract-editor-card label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.contract-editor-card label > span { color: #4b5563; }
.contract-editor-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle, #e5e7eb);
  margin-top: 12px;
}
.contract-editor-foot span { color: #6b7280; font-size: 0.85rem; }
.contract-editor-actions { display: flex; gap: 8px; }
.settings-card-meta { margin: 0 0 8px; color: #6b7280; font-size: 0.85rem; }


.create-role-hint {
  margin: 12px 24px 0;
  padding: 10px 14px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 8px;
  color: #9a3412;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.create-role-hint strong { color: #7c2d12; }
.summary-box-hint { font-size: 1rem; color: #111827; display: block; margin-bottom: 4px; }
.summary-box-hint-detail { font-size: 0.85rem; color: #6b7280; margin: 0; }
.summary-box-hint-detail code { background: #f3f4f6; padding: 1px 5px; border-radius: 3px; font-size: 0.8em; }


.preflight-warning-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.preflight-warning-head-actions .preflight-mark-all {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
.preflight-warning-group .preflight-reviewed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #4b5563;
  cursor: pointer;
  margin-left: 8px;
}
.preflight-warning-group .preflight-reviewed-toggle input {
  margin: 0;
  cursor: pointer;
}
.preflight-warning-group.is-reviewed > summary {
  background: rgba(15, 75, 67, 0.04);
}
.preflight-warning-group.is-reviewed > summary em {
  color: #047857;
  background: #ecfdf5;
  padding: 1px 6px;
  border-radius: 999px;
}


/* === empty 状态不再被基础 min-height 拉低 (M-fix 2026-07) === */
.book-panel.empty,
.chapter-list-panel.empty,
.chapter-panel.empty,
.download-panel.empty {
  min-height: 96px !important;
  height: auto !important;
  align-self: start !important;
}
.chapter-workbench:has(.book-panel.is-hidden) {
  align-self: start !important;
  height: auto !important;
}


/* === preview-panel collapse in empty state (M-fix-2 2026-07) === */
.preview-panel:has(> .chapter-panel.empty) {
  grid-template-rows: auto auto !important;
  min-height: 0 !important;
  height: auto !important;
}
.preview-panel:has(> .chapter-panel.empty) > .preview-illustration {
  display: none !important;
}
