/* ============================================
   财经视频生成器 — 设计系统 v4 · 财经新闻视频
   基于 Stitch AI 设计稿，Material 3 暖纸质色系
   ============================================ */

:root {
  /* ── 字体 ──────────────────────────────── */
  --font-sans: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Noto Serif SC", "Noto Serif", Georgia, serif;
  --font-body: var(--font-sans);
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;

  /* ── 表面层级（从深到浅：纸张叠层隐喻） ── */
  --bg-page:      #fbf9f4;  /* background / surface-bright */
  --bg-primary:   #f5f3ee;  /* surface-container-low — 主内容区 */
  --bg-secondary: #ffffff;  /* surface-container-lowest — 卡片/输入框 */
  --bg-sidebar:   #f5f3ee;  /* surface-container-low — 侧栏 */
  --bg-elevated:  #f0eee9;  /* surface-container — 工具栏/footer */
  --bg-recessed:  #eae8e3;  /* surface-container-high — 按下态/输入底 */
  --bg-dim:       #e4e2dd;  /* surface-variant — 标签/chip 底 */

  /* ── 主色（深棕墨色） ────────────────── */
  --color-primary: #4a371d;
  --color-primary-hover: #634e32;    /* primary-container */
  --color-primary-rgb: 74, 55, 29;
  --color-on-primary: #ffffff;

  /* ── 辅助色 ──────────────────────────── */
  --nav-accent: #715b3e;              /* surface-tint */
  --nav-accent-rgb: 113, 91, 62;
  --color-secondary: #645d53;
  --color-tertiary: #2e3c4d;          /* 深蓝灰 — 用于图表正向指标 */

  /* ── 语义色 ──────────────────────────── */
  --color-success: #3d8b6e;
  --color-success-rgb: 61, 139, 110;
  --color-warning: #715b3e;
  --color-error: #ba1a1a;

  /* ── 文字层级 ────────────────────────── */
  --color-text-primary:   #1b1c19;    /* on-surface */
  --color-text-secondary: #4d453c;    /* on-surface-variant */
  --color-text-tertiary:  #7f756b;    /* outline */
  --color-text-muted:     #d1c4b8;    /* outline-variant */

  /* ── 边框 & 分割 ────────────────────── */
  --color-border: #d1c4b8;            /* outline-variant */
  --surface-border: rgba(209, 196, 184, 0.2);  /* ghost border */

  /* ── 阴影（暖色调投影） ─────────────── */
  --shadow-sm: 0 1px 2px rgba(45, 39, 33, 0.03);
  --shadow-md: 0 4px 16px rgba(45, 39, 33, 0.05);
  --shadow-lg: 0 12px 40px rgba(45, 39, 33, 0.06);  /* editorial-shadow */
  --shadow-elevated: 0 12px 40px rgba(45, 39, 33, 0.06);
  --shadow-nav: none;

  /* ── 圆角 ────────────────────────────── */
  --radius-sm: 0.5rem;    /* 8px — 小元素 */
  --radius-md: 1rem;      /* 16px — 卡片默认 */
  --radius-lg: 2rem;      /* 32px — 大卡片/输入框 */
  --radius-full: 9999px;  /* 胶囊 */

  /* ── 动效 ────────────────────────────── */
  --transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out,
    border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out,
    transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  --ease-premium: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-page);
}

.app-body {
  position: relative;
}

/* ── 顶部导航栏 — Antiqua 风格：与页面融合 ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-page);
  border-bottom: none;  /* No-Line Rule */
  display: flex;
  align-items: center;
  padding: 0 32px;
  z-index: 10050;
  box-shadow: none;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

.navbar-brand::before { display: none; }

.navbar-brand i {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  display: none;
}

.navbar-version {
  margin-left: 8px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  align-self: center;
}

.navbar-menu {
  margin-left: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 4px 0;
  height: auto;
  margin: auto 0;
  border-radius: 0;
  color: rgba(74, 55, 29, 0.5);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.01em;
  transition: color 0.3s ease-in-out;
  border: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.nav-item:hover {
  color: var(--color-primary);
  background: none;
}

.nav-item.active {
  color: var(--color-primary);
  font-weight: 600;
  border-bottom-color: var(--color-primary);
  background: none;
}

.nav-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

.nav-item i {
  width: 0;
  height: 0;
  overflow: hidden;
  /* Stitch 设计中 nav 无图标，仅文字 */
}

/* 视图容器 */
.view-container {
  max-width: 1200px;
  margin: 0 auto;
  animation: viewEnter 0.5s var(--ease-premium) both;
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.view-header h2 {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.search-bar {
  position: relative;
  margin-bottom: 24px;
}

.search-bar i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-secondary);
}

.search-bar input {
  width: 100%;
  padding: 12px 16px 12px 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   新闻库 — 全屏视图（editorial · 财经资讯台）
   ═══════════════════════════════════════════════════════════════ */

.library-view {
  animation: viewEnter 0.45s var(--ease-premium) both;
}

.library-hero {
  position: relative;
  padding: 8px 0 28px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--surface-border);
}

.library-hero::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 6px;
  width: 4px;
  height: calc(100% - 20px);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--color-primary) 0%, rgba(var(--nav-accent-rgb), 0.85) 100%);
  opacity: 0.9;
}

.library-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary-hover);
  margin-bottom: 8px;
  padding-left: 12px;
}

.library-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 2.5vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  line-height: 1.2;
  margin-bottom: 10px;
  padding-left: 12px;
}

.library-subtitle {
  max-width: 52ch;
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.55;
  padding-left: 12px;
  margin-bottom: 20px;
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-left: 12px;
}

.library-toolbar--wrap .btn {
  flex: 0 1 auto;
}

.library-body {
  padding-top: 8px;
}

.library-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 0 16px;
  min-height: 48px;
  background: var(--bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  margin-bottom: 24px;
}

.library-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}

.library-search i {
  width: 18px;
  height: 18px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.library-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--color-text-primary);
  outline: none;
  padding: 12px 16px 12px 0;
}

.library-search--compact {
  min-height: 40px;
  margin-bottom: 0;
  max-width: 220px;
}

.library-search--compact input {
  padding: 8px 12px 8px 0;
  font-size: 13px;
}

.article-grid--library {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.article-card--library {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: linear-gradient(165deg, #ffffff 0%, #faf9f6 55%, #f3f0ea 100%);
  box-shadow: var(--shadow-sm);
  transition: transform 0.28s var(--ease-premium), box-shadow 0.28s var(--ease-premium),
    border-color 0.2s ease;
}

.article-card--library::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.article-card--library:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
  border-color: rgba(var(--color-primary-rgb), 0.35);
}

.article-card--library .article-card__body {
  padding: 20px 20px 16px;
  flex: 1;
  overflow: hidden;
}

.article-card--library .article-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  -webkit-line-clamp: 3;
}

.article-card--library .article-meta {
  margin-top: 10px;
  font-size: 11px;
}

.article-card--library .article-preview {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.55;
  -webkit-line-clamp: 4;
}

.article-card--library .article-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.03);
  border-top: 1px solid var(--surface-border);
}

.article-card--library .article-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-card--library .article-generate-btn {
  flex-shrink: 0;
}

.article-card--library .delete-article {
  position: static;
  opacity: 1;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.article-card--library .delete-article:hover {
  background: rgba(220, 38, 38, 0.12);
  color: var(--color-error);
}

.library-date-group {
  grid-column: 1 / -1;
  margin-bottom: 8px;
}

.library-date-group .date-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  padding: 0 4px 12px;
}

.library-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border);
  background: rgba(255, 255, 255, 0.6);
}

.library-empty i {
  width: 48px;
  height: 48px;
  color: var(--color-text-secondary);
  opacity: 0.4;
  margin-bottom: 12px;
}

.library-empty p {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.library-empty .empty-hint {
  font-size: 13px;
  margin-top: 6px;
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════════
   新闻库重构：导入区 + 提取预览
   ═══════════════════════════════════════════════════════════════ */

/* ── 导入区：URL + 手动粘贴 并排卡片 ──────── */
.news-import-zone {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  margin-bottom: 28px;
  align-items: stretch;
}

@media (max-width: 800px) {
  .news-import-zone { grid-template-columns: 1fr; }
}

.import-card {
  background: var(--bg-secondary);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.25s var(--ease-premium), box-shadow 0.25s var(--ease-premium);
  display: flex;
  flex-direction: column;
}

.import-card--paste {
  justify-content: center;
}

.import-card:hover {
  border-color: rgba(var(--color-primary-rgb), 0.3);
  box-shadow: var(--shadow-md);
}

.import-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.import-card--url .import-card__icon {
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
}

.import-card--paste .import-card__icon {
  background: rgba(var(--color-success-rgb), 0.12);
  color: var(--color-success);
}

.import-card__icon i {
  width: 20px;
  height: 20px;
}

.import-card__title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.import-card__desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  line-height: 1.45;
}

.import-card__input-row {
  display: flex;
  gap: 8px;
}

.import-card__input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  outline: none;
  transition: var(--transition);
}

.import-card__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}

/* 覆盖 .btn-primary 的 width:100% + 巨大 padding，在导入卡片内保持紧凑 */
.import-card .import-card__btn,
.import-card .import-card__btn.btn-primary {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  width: auto;
  box-shadow: 0 2px 8px rgba(var(--color-primary-rgb), 0.25);
}

.import-card .import-card__btn i {
  width: 16px;
  height: 16px;
}

.import-card__btn-full {
  width: 100%;
  max-width: 240px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--color-text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: auto;
}

.import-card__btn-full:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.04);
}

/* ── URL 提取预览 ──────────────────────────── */
.extract-preview {
  margin-top: 16px;
}

.extract-preview__card {
  background: var(--bg-primary);
  border: 1px solid rgba(var(--color-primary-rgb), 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
}

.extract-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.extract-preview__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
}

.extract-preview__badge--rule {
  background: rgba(var(--color-success-rgb), 0.12);
  color: var(--color-success);
}

.extract-preview__words {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.extract-preview__field {
  margin-bottom: 10px;
}

.extract-preview__field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.extract-preview__field .form-input,
.extract-preview__field .form-textarea {
  width: 100%;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  outline: none;
  transition: var(--transition);
}

.extract-preview__field .form-input:focus,
.extract-preview__field .form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}

.extract-preview__field .form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.extract-preview__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.extract-preview__actions .btn {
  font-size: 12px;
  padding: 7px 14px;
}

/* ── 文章列表区标题 ────────────────────────── */
.library-list-section {
  margin-top: 4px;
}

.library-list-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--surface-border);
}

.library-list-header__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.library-list-header .library-search--wide {
  flex: 0 1 280px;
  margin-left: auto;
}

.workflow-tree {
  width: 100%;
  padding: 8px 0 24px;
  overflow-y: auto;
  max-height: calc(100vh - 300px);
}


/* 详情区内容样式 */
.detail-row {
  font-size: 12px;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.detail-row.muted {
  color: var(--color-text-secondary);
}

.detail-row.error-msg {
  color: var(--color-error);
}

.detail-section {
  margin-bottom: 12px;
}

/* Skill 详情统一外壳（与树节点内容区配合） */
.skill-detail-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-detail-shell .detail-section {
  margin-bottom: 0;
}

.detail-section--input,
.detail-section--output,
.detail-section--meta {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--bg-secondary);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.detail-section--input {
  border-left: 3px solid rgba(var(--color-primary-rgb), 0.55);
  background: linear-gradient(
    165deg,
    rgba(var(--color-primary-rgb), 0.07) 0%,
    var(--bg-secondary) 52%
  );
}

.detail-section--output {
  border-left: 3px solid rgba(var(--color-success-rgb), 0.45);
  background: linear-gradient(
    165deg,
    rgba(var(--color-success-rgb), 0.07) 0%,
    var(--bg-secondary) 52%
  );
}

.detail-section--meta {
  border-left: 3px solid rgba(142, 142, 147, 0.45);
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.detail-label--input,
.detail-label--output,
.detail-label--meta,
.detail-label--media {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.detail-label--input {
  color: var(--color-primary);
}

.detail-label--output {
  color: var(--color-success);
}

.detail-label--meta {
  color: var(--color-text-secondary);
}

.detail-label--media {
  color: var(--color-text-primary);
}

.detail-pre {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  overflow-x: auto;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre;
  line-height: 1.5;
  color: var(--color-text-primary);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.detail-table th,
.detail-table td {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.detail-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 11px;
}

/* ── Skill 步骤结构化详情（skill_detail_views.js）──────────── */
.skill-detail-time {
  margin-bottom: 8px;
}

.skill-structured {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.skill-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
}

.skill-stat .l {
  display: block;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.skill-stat .v {
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 13px;
}

.skill-section {
  margin-top: 4px;
}

.skill-entity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-entity-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--bg-secondary);
}

.skill-entity-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.skill-entity-cat {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.skill-entity-name {
  font-size: 13px;
  color: var(--color-text-primary);
}

.skill-score {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text-secondary);
}

.skill-score.is-high {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.skill-score.is-mid {
  background: rgba(234, 179, 8, 0.2);
  color: #a16207;
}

.skill-score.is-low {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.skill-entity-query {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.skill-entity-query .k {
  opacity: 0.8;
  margin-right: 4px;
}

.skill-thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-thumb-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.skill-thumb-wrap.thumb-error {
  display: none;
}

.skill-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.skill-empty-inline {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-style: italic;
}

.skill-dp-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-dp-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  background: var(--bg-secondary);
}

.skill-dp-name {
  font-weight: 600;
  color: var(--color-text-primary);
}

.skill-dp-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.skill-title-cards {
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.12), rgba(0, 0, 0, 0.04));
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.skill-title-main {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.35;
}

.skill-title-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.skill-warn-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-warning, #d97706);
  margin-left: 6px;
}

.skill-text-snippet {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-primary);
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 8px;
}

.skill-intent-card {
  background: var(--bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-primary);
}

.skill-intent-row {
  line-height: 1.5;
  word-break: break-word;
}

.skill-intent-row strong {
  color: var(--color-text-secondary);
  font-weight: 600;
}

.skill-path-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--color-primary);
}

.skill-path-list a {
  color: var(--color-primary);
  word-break: break-all;
}

.skill-kv {
  display: flex;
  gap: 8px;
  font-size: 12px;
  margin-top: 6px;
}

.skill-kv .k {
  color: var(--color-text-secondary);
}

.skill-kv .v {
  font-weight: 600;
  color: var(--color-text-primary);
}

.skill-link-video {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-primary);
}

.skill-kv-table td pre.inline-json {
  margin: 0;
  font-size: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

.skill-detail-raw {
  margin-top: 10px;
  font-size: 12px;
}

.skill-detail-raw-summary {
  cursor: pointer;
  color: var(--color-text-secondary);
  user-select: none;
}

.skill-detail-raw-pre {
  margin-top: 6px;
  max-height: 200px;
}

/* ── JSON 多条结果卡片栈 ─────────────────────────────────── */
.skill-card-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-json-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  overflow: hidden;
  border-left: 3px solid var(--color-primary);
}

.skill-json-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid var(--color-border);
}

.skill-json-card-idx {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-primary);
  min-width: 28px;
}

.skill-json-card-cat {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.skill-json-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.skill-json-card-body {
  padding: 8px 10px 10px;
}

.skill-jrow {
  display: grid;
  grid-template-columns: minmax(72px, 100px) 1fr;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
  align-items: start;
}

.skill-jrow--images {
  grid-template-columns: minmax(72px, 100px) 1fr;
}

.skill-jk {
  color: var(--color-text-secondary);
  font-size: 11px;
  padding-top: 2px;
}

.skill-jv {
  color: var(--color-text-primary);
  word-break: break-word;
}

.skill-jv-mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  line-height: 1.45;
}

.skill-jmini {
  margin: 0;
  font-size: 11px;
  font-family: ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 140px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.04);
  padding: 6px 8px;
  border-radius: 4px;
}

.skill-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* 素材详情：大图直出（COS/本站直连；外链仍走代理） */
.skill-img-direct-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.skill-img-direct-gallery--news {
  flex-flow: row wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.skill-img-direct-gallery--news .skill-fig-inline {
  flex: 1 1 140px;
  max-width: calc(50% - 4px);
  min-width: 120px;
}

.skill-fig-inline {
  margin: 0;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--bg-secondary);
  max-width: 100%;
}

.skill-fig-inline.thumb-error {
  display: none;
}

.skill-img-direct-link {
  display: block;
  line-height: 0;
}

.skill-img-direct {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(280px, 42vh);
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

.skill-jrow--images .skill-jv.skill-img-direct-gallery {
  flex: 1;
  min-width: 0;
}

/* Skill 详情：视频内嵌预览 */
.skill-media-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.skill-media-gallery--video {
  gap: 10px;
}

.skill-jrow--media .skill-jv.skill-media-gallery {
  flex: 1;
  min-width: 0;
}

.skill-video-card {
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--bg-secondary);
  overflow: hidden;
  max-width: 100%;
}

.skill-video-inline {
  display: block;
  width: 100%;
  max-height: min(320px, 50vh);
  background: #000;
  vertical-align: middle;
}

.skill-video-open {
  display: block;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-top: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.03);
}

.skill-video-open:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.skill-audio-card {
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--bg-secondary);
  overflow: hidden;
  max-width: 100%;
}

.skill-audio-inline {
  display: block;
  width: 100%;
  padding: 8px 10px;
  min-height: 42px;
  background: rgba(0, 0, 0, 0.04);
}

.skill-audio-open {
  display: block;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-top: 1px solid var(--color-border);
  background: rgba(0, 0, 0, 0.03);
}

.skill-audio-open:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.skill-section--media {
  margin-top: 2px;
}

.skill-detail-shell .skill-detail-raw {
  margin-top: 6px;
}

/* ── 旧画布样式（保留不移除，以免其他地方意外引用）─────────── */
.workflow-canvas {
  display: none; /* 隐藏旧画布，由 workflow-tree 取代 */
}

.skill-node {
  position: absolute;
  width: 176px;
  min-height: 72px;
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  z-index: 10;
  transition: all 0.3s ease;
  cursor: pointer;
  color: var(--color-text-primary);
}

.skill-node.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.1);
}

.skill-node.completed {
  border-color: var(--color-success);
}

.skill-node.error {
  border-color: var(--color-error);
}

.skill-node.selected {
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.05);
}

.node-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.35;
}

.node-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  color: var(--color-primary);
  font-size: 12px;
  line-height: 1.4;
}

.node-title {
  flex: 1;
  min-width: 0;
  color: var(--color-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.node-status {
  font-size: 11px;
  color: var(--color-text-secondary);
  line-height: 1.3;
  word-break: break-word;
}

/* 连接线 */
.workflow-link {
  position: absolute;
  height: 2px;
  background: var(--color-border);
  z-index: 5;
  transform-origin: left center;
  transition: all 0.3s ease;
}

.workflow-link.active {
  background: var(--color-primary);
}


.navbar-subtitle {
  margin-left: auto;
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 400;
}

/* 主容器 — 卡片化栅格 + 呼吸留白 */
.app-container.app-layout {
  display: flex;
  align-items: stretch;
  margin-top: 56px;
  height: calc(100vh - 56px);
  min-height: 0;
  padding: 0;
  gap: 0;
  box-sizing: border-box;
}

.app-layout .sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: none;  /* No-Line Rule: 用背景色差代替边框 */
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 16px 16px;
  border-bottom: none;
  background: transparent;
}

.btn-new-task {
  width: 100%;
  padding: 12px 16px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: none;
}

.btn-new-task:hover {
  background: var(--color-primary-hover);
}

.btn-new-task:active {
  transform: scale(0.98);
}

.btn-new-task:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.btn-new-task i {
  width: 18px;
  height: 18px;
}

/* ── 侧栏 Tab 切换 ────────────────────── */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 0;
  margin: 8px 16px 4px;
  border-bottom: none;
  background: none;
  border-radius: 0;
}

.app-layout .sidebar-tabs {
  margin: 8px 16px 4px;
}

.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: rgba(74, 55, 29, 0.45);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-tab i {
  width: 16px;
  height: 16px;
}

.sidebar-tab:hover {
  color: var(--color-primary);
  background: rgba(251, 249, 244, 0.5);
}

.sidebar-tab.active {
  background: var(--bg-secondary);
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.sidebar-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* 历史记录区域 */
/* 新闻库区域 */
.articles-section {
  padding: 16px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--color-primary);
  background: white;
}

.search-box i {
  width: 16px;
  height: 16px;
  color: var(--color-text-secondary);
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--color-text-primary);
  outline: none;
}

.search-box input::placeholder {
  color: var(--color-text-secondary);
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.article-item {
  padding: 12px 14px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.22s var(--ease-premium), box-shadow 0.22s var(--ease-premium),
    background 0.2s, border-color 0.2s;
  display: flex;
  gap: 12px;
  position: relative;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.article-item:hover {
  background: #e2e8f0;
  border-color: var(--color-border);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.article-info {
  flex: 1;
  min-width: 0;
}

.article-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.article-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-meta i {
  width: 12px;
  height: 12px;
}

.article-preview {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.delete-article {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.article-item:hover .delete-article {
  opacity: 1;
}

.delete-article:hover {
  background: var(--color-error);
  color: white;
}

.delete-article i {
  width: 16px;
  height: 16px;
}

.date-group {
  margin-bottom: 16px;
}

.date-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  padding: 0 8px 8px;
}

/* 设置区域 */
.settings-section {
  padding: 16px;
  border-top: 1px solid var(--color-border);
}

.settings-toggle {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.settings-toggle:hover {
  background: var(--bg-primary);
}

.settings-toggle i {
  width: 16px;
  height: 16px;
}

/* 主工作区 */
.main-stage {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  background: var(--bg-page);
  position: relative;
}

/* ── 切换任务时的加载遮罩 ─────────────────────────────────── */
.task-loading-mask {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.task-loading-mask.visible {
  opacity: 1;
  pointer-events: auto;
}
.task-loading-mask__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(var(--color-primary-rgb), 0.18);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: task-spin 0.7s linear infinite;
}
.task-loading-mask__text {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}
@keyframes task-spin {
  to { transform: rotate(360deg); }
}

.app-layout .main-stage {
  padding: 32px 40px;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: var(--bg-page);
}

/* 输入模式 */
.input-mode {
  max-width: 720px;
  margin: 32px auto;
}

/* ── 顶部 hero ──────────────────────────── */
.input-hero {
  text-align: center;
  margin-bottom: 28px;
}

.input-hero__badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
  margin-bottom: 12px;
}

.input-hero__title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.input-hero__sub {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ── 输入卡片 ────────────────────────────── */
.input-card {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-elevated);
  border: 1px solid rgba(15, 23, 42, 0.06);
  margin-bottom: 20px;
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease-premium);
}

.input-card:hover {
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(var(--color-primary-rgb), 0.08);
}

/* ── Textarea 区 ─────────────────────────── */
.textarea-wrap {
  display: flex;
  flex-direction: column;
}

.input-card .form-textarea {
  border: none;
  border-radius: 0;
  min-height: 240px;
  padding: 24px 28px 16px;
  font-size: 15px;
  font-family: var(--font-body);
  line-height: 1.75;
  resize: vertical;
  background: transparent;
  color: var(--color-text-primary);
}

.input-card .form-textarea::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.55;
}

.input-card .form-textarea:focus {
  outline: none;
  box-shadow: none;
}

.textarea-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 28px 12px;
  border-top: 1px solid var(--surface-border);
  background: rgba(15, 23, 42, 0.015);
}

.textarea-footer__count {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.textarea-footer__hint {
  font-size: 11px;
  color: var(--color-text-secondary);
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── 底栏：时长 + 提交 ─────────────────── */
.form-submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px 18px;
  background: var(--bg-primary);
  border-top: 1px solid var(--surface-border);
}

.duration-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.duration-picker__label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.duration-picker__label i {
  width: 14px;
  height: 14px;
}

.duration-picker__input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
}

.duration-picker__input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
}

.duration-picker__input {
  width: 56px;
  padding: 6px 4px 6px 10px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  -moz-appearance: textfield;
}

.duration-picker__input::-webkit-outer-spin-button,
.duration-picker__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.duration-picker__unit {
  font-size: 12px;
  color: var(--color-text-secondary);
  padding-right: 10px;
  user-select: none;
}

.btn-generate {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: linear-gradient(165deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s var(--ease-premium), box-shadow 0.2s var(--ease-premium);
  box-shadow: 0 4px 14px rgba(var(--color-primary-rgb), 0.3);
  white-space: nowrap;
}

.btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.4);
}

.btn-generate:active { transform: translateY(0); }

.btn-generate:disabled {
  background: var(--color-border);
  color: var(--color-text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-generate i {
  width: 16px;
  height: 16px;
}

/* ── 底部特性标签 ────────────────────────── */
.input-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.input-feature {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--color-text-secondary);
  opacity: 0.75;
}

.input-feature i {
  width: 13px;
  height: 13px;
}

/* ── 通用表单（保留给弹窗等场景） ─────── */
.form-group {
  margin-bottom: 24px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  background: var(--bg-secondary);
}

.form-textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.6;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

.form-hint {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 6px;
}

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

.btn-primary {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(
    165deg,
    var(--color-primary) 0%,
    var(--color-primary-hover) 100%
  );
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--ease-premium), box-shadow 0.2s var(--ease-premium);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(var(--color-primary-rgb), 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(var(--color-primary-rgb), 0.42);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.btn-primary:disabled {
  background: var(--color-border);
  color: var(--color-text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary i {
  width: 20px;
  height: 20px;
}

/* 生成模式 */
.generation-mode {
  max-width: 900px;
  margin: 0 auto;
}

/* 整体进度条 */
.overall-progress {
  position: sticky;
  top: -32px;
  margin: -32px -32px 32px -32px;
  padding: 20px 32px;
  background: rgba(241, 245, 249, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.app-layout .overall-progress {
  top: -36px;
  margin: -36px -40px 28px -40px;
  padding: 18px 40px 20px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.overall-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.overall-progress-top .overall-progress-label {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.overall-progress-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.btn-cancel-main {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-cancel-main:hover {
  background: #fee2e2;
  border-color: #f87171;
}

.btn-retry-failed {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-retry-failed:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

.overall-progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.overall-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, var(--color-primary), #ea580c);
  transition: width 0.5s ease;
  border-radius: 3px;
}

/* 右侧信息面板 */
.info-panel {
  width: 300px;
  background: var(--bg-primary);
  border-left: 1px solid rgba(209, 196, 184, 0.1);
  overflow-y: auto;
  display: flex !important; /* 强制显示为 flex，如果需要隐藏使用 .hidden 类 */
  flex-direction: column;
  box-shadow: none;
}

.info-panel[style*="display: none"] {
  display: none !important;
}

.app-layout .info-panel {
  width: 300px;
  background: var(--bg-primary);
  border-left: 1px solid rgba(209, 196, 184, 0.1);
  border-radius: 0;
  box-shadow: none;
  display: flex !important;
}

.app-layout .info-panel[style*="display: none"] {
  display: none !important;
}

.panel-section {
  padding: 20px;
  border-bottom: none;  /* No-Line Rule */
}

.app-layout .panel-section:last-child {
  border-bottom: none;
}

.panel-section-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.panel-section-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  margin: -8px 0 14px;
}

.panel-section--flow .panel-section-title {
  margin-bottom: 8px;
}

/* 右栏：Skill 流程（可点击跳转左侧时间轴） */
.skill-flow-overview {
  min-height: 48px;
}

.skill-flow-empty {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 0;
}

/* ── 右侧面板重构 ───────────────────────── */
.panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--surface-border);
}

.panel-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.panel-header__time {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.panel-header__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.panel-header__id {
  font-size: 10px;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--color-text-secondary);
  opacity: 0.7;
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-header__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.panel-header__actions .btn-action {
  flex: 0 1 auto;
  min-width: 0;
  justify-content: center;
  font-size: 12px;
  padding: 7px 12px;
}

.panel-preview {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.panel-preview .panel-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-preview__body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.panel-preview__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.skill-flow-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
}

.skill-flow-node {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--color-border);
  background: var(--bg-primary);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.skill-flow-node-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.08);
  color: var(--color-text-secondary);
}

.skill-flow-node-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 8rem;
}

.skill-flow-node-tech {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 9px;
  font-weight: 500;
  opacity: 0.85;
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-flow-node:hover {
  border-color: rgba(var(--color-primary-rgb), 0.45);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.skill-flow-node--pending {
  opacity: 0.65;
  color: var(--color-text-secondary);
}

.skill-flow-node--running {
  border-color: rgba(var(--color-primary-rgb), 0.55);
  background: rgba(var(--color-primary-rgb), 0.1);
  color: var(--color-primary);
}

.skill-flow-node--done {
  border-color: rgba(var(--color-success-rgb), 0.35);
  background: rgba(var(--color-success-rgb), 0.1);
  color: var(--color-success);
}

.skill-flow-node--error {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  color: var(--color-error);
}

.skill-flow-join {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  user-select: none;
  padding: 0 2px;
}

.skill-flow-join::after {
  content: "→";
  opacity: 0.55;
}

.task-overview-item {
  margin-bottom: 16px;
}

.task-overview-item:last-child {
  margin-bottom: 0;
}

.task-overview-label {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.task-overview-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.task-overview-value.task-overview-id {
  font-size: 13px;
  font-weight: 400;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  word-break: break-all;
  line-height: 1.35;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.pending {
  background: #f0f0f5;
  color: var(--color-text-secondary);
}

.status-badge.running {
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
}

.status-badge.completed {
  background: #e8f5e9;
  color: var(--color-success);
}

.status-badge.failed {
  background: #ffebee;
  color: var(--color-error);
}

.status-badge.cancelled {
  background: #eceff1;
  color: #546e7a;
}

/* 成本统计 */
.cost-display {
  text-align: center;
  padding: 22px 18px;
  background: linear-gradient(
    165deg,
    rgba(var(--color-primary-rgb), 0.08) 0%,
    var(--bg-primary) 55%
  );
  border-radius: var(--radius-md);
  border: 1px solid rgba(var(--color-primary-rgb), 0.12);
}

.cost-amount {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.cost-label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* 操作按钮组 */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.btn-action {
  /* 默认全宽；横向 flex 行内由下方覆盖为 auto */
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* 横向排列的工具按钮：禁止 width:100% 抢满整行，否则会把标题挤成一字宽 */
.action-buttons-row .btn-action {
  width: auto;
  flex-shrink: 0;
  align-self: center;
  padding: 10px 18px;
  white-space: nowrap;
}

.action-buttons-grid .btn-action {
  width: auto;
  flex: 1 1 120px;
  min-width: 0;
}

.article-card__actions .btn-action {
  width: auto;
  flex: 0 1 auto;
}

.library-toolbar .btn-action,
.library-inline-tools .btn-action {
  width: auto;
}

.btn-action i {
  width: 16px;
  height: 16px;
}

.btn-action.primary {
  background: linear-gradient(
    165deg,
    var(--color-primary) 0%,
    var(--color-primary-hover) 100%
  );
  color: white;
  box-shadow: 0 4px 14px rgba(var(--color-primary-rgb), 0.3);
  transition: transform 0.2s var(--ease-premium), box-shadow 0.2s;
}

.btn-action.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(var(--color-primary-rgb), 0.38);
}

.btn-action.primary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-action.secondary {
  background: var(--bg-primary);
  color: var(--color-text-primary);
}

.btn-action.secondary:hover {
  background: #e2e8f0;
}

.btn-action.danger {
  background: transparent;
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

.btn-action.danger:hover {
  background: var(--color-error);
  color: white;
}

/* 响应式设计 */
@media (max-width: 1199px) {
  .info-panel {
    display: none;
  }
}

@media (max-width: 767px) {
  .app-container.app-layout {
    padding: 12px;
    gap: 12px;
  }

  .sidebar {
    position: fixed;
    left: -240px;
    top: 64px;
    height: calc(100vh - 64px);
    z-index: 999;
    transition: var(--transition);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .main-stage {
    padding: 16px;
  }

  .app-layout .main-stage {
    padding: 16px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════
   Toast 通知 + Confirm 确认弹窗
   ═══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 10100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 420px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-elevated);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-primary);
  opacity: 0;
  transform: translateX(24px);
  transition: none;
}

.toast--enter {
  animation: toastIn 0.3s var(--ease-premium) forwards;
}

.toast--exit {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px) scale(0.95); }
}

.toast__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: 1px;
}

.toast__msg {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.toast__close:hover { opacity: 1; }

.toast--success { border-left: 3px solid var(--color-success); }
.toast--success .toast__icon { color: var(--color-success); }

.toast--error { border-left: 3px solid var(--color-error); }
.toast--error .toast__icon { color: var(--color-error); }

.toast--warning { border-left: 3px solid var(--color-warning); }
.toast--warning .toast__icon { color: var(--color-warning); }

.toast--info { border-left: 3px solid var(--color-primary); }
.toast--info .toast__icon { color: var(--color-primary); }

/* Confirm 确认弹窗 */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
}

.confirm-overlay--enter {
  animation: confirmFadeIn 0.2s ease forwards;
}

.confirm-overlay--exit {
  animation: confirmFadeOut 0.2s ease forwards;
}

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

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

.confirm-dialog {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 440px;
  animation: confirmSlideIn 0.25s var(--ease-spring) forwards;
}

.confirm-overlay--exit .confirm-dialog {
  animation: confirmSlideOut 0.2s ease forwards;
}

@keyframes confirmSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes confirmSlideOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.97); }
}

.confirm-dialog__header {
  padding: 20px 24px 0;
}

.confirm-dialog__title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.confirm-dialog__body {
  padding: 12px 24px 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.confirm-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 20px;
}

.confirm-btn {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.confirm-btn--cancel {
  background: var(--bg-secondary);
  color: var(--color-text-secondary);
}

.confirm-btn--cancel:hover {
  background: var(--bg-primary);
  color: var(--color-text-primary);
}

.confirm-btn--ok.confirm-btn--primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.confirm-btn--ok.confirm-btn--primary:hover {
  background: var(--color-primary-hover);
}

.confirm-btn--ok.confirm-btn--danger {
  background: var(--color-error);
  color: white;
  border-color: var(--color-error);
}

.confirm-btn--ok.confirm-btn--danger:hover {
  background: #b91c1c;
}

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

  .input-card:hover,
  .tree-step-card:hover,
  .article-item:hover,
  .btn-primary:hover,
  .btn-new-task:hover,
  .btn-action.primary:hover,
  .stage-card:hover {
    transform: none !important;
  }
}

