/* ============ 教育智能体平台 · 样式 ============ */
:root {
  color-scheme: light;
  --bg: #fffaf5;
  --surface: #ffffff;
  --surface-tint: #fff5ec;
  --paper: #fffdf8;
  --text: #1f1a17;
  --text-soft: #443832;
  --muted: #796b64;
  --line: #ececf0;
  --brand-red: #d7192a;
  --brand-red-deep: #b91624;
  --accent: #ff8128;
  --accent-deep: #c84a1f;
  --accent-soft: #fff0df;
  --sun: #ffd166;
  --danger: #b42318;
  --shadow: 0 18px 40px -26px rgba(91, 45, 24, 0.28);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --max: 1280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 78% 8%, rgba(255, 129, 40, 0.11), transparent 26vw),
    linear-gradient(180deg, #fffdf9 0%, #ffffff 44%);
}

button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 3px solid rgba(239, 68, 35, 0.32);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--brand-red);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 10px 0;
  z-index: 99;
}
.skip-link:focus { left: 0; }

/* 侧边栏已移到 #fitApp 外（固定不缩放），page-shell 不再需要左边距让位，占满即可 */
.page-shell {
  width: 100%;
  min-height: 100vh;
  padding: 0;
  min-width: 0;
}

#mainContent {
  width: 100%;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  /* 底部预留页脚高度，固定页脚不会盖住页面内容 */
  padding-bottom: 64px;
}
.page.active {
  width: 100%;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

/* ---- 左侧边栏（XMind 风格） ---- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 0;
  overflow: visible;
  display: grid;
  place-items: center;
  background: transparent;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand strong { display: block; font-size: 17px; line-height: 1.1; }

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  margin-top: 30px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.side-nav a:hover { background: #f4f6f8; }
.side-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
}
.nav-ic {
  width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.teacher-chip {
  background: var(--surface-tint);
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
}

/* ---- 通用按钮 ---- */
.primary-button {
  background: linear-gradient(135deg, var(--brand-red), var(--accent));
  color: #fff;
  padding: 11px 20px;
  border-radius: 13px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 10px 22px -10px rgba(215, 25, 42, 0.55);
  transition: transform 0.12s, box-shadow 0.12s;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -10px rgba(215, 25, 42, 0.6); }
.primary-button.small { padding: 7px 14px; font-size: 13px; }

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--brand-red-deep);
  padding: 9px 16px;
  border-radius: 12px;
  font-size: 14px;
  transition: background 0.15s;
}
.ghost-button:hover { background: var(--accent-soft); }
.ghost-button.small { padding: 6px 12px; font-size: 13px; }

.quiet-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 9px 16px;
  border-radius: 12px;
  font-size: 14px;
}
.quiet-button:hover { background: var(--surface-tint); }

/* ---- 页面显示 ---- */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- Hero ---- */
.hero-section {
  display: block;
  padding: 34px 40px 28px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 129, 40, 0.14), transparent 26vw),
    linear-gradient(180deg, #fffdf9 0%, #ffffff 100%);
}
.compact-hero {
  min-height: auto;
}
.quick-create-card {
  width: 100%;
  max-width: none;
  justify-self: stretch;
  display: grid;
  grid-template-columns: minmax(380px, 0.82fr) minmax(520px, 1.18fr);
  gap: 28px;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(215, 25, 42, 0.12);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 20px 46px -34px rgba(91, 45, 24, 0.42);
}
.quick-create-copy { max-width: 560px; }
.quick-create-dialog {
  width: 100%;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(180deg, #fffdf9, #fff5ec);
  border: 1px solid rgba(215, 25, 42, 0.12);
  border-radius: 24px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.dialog-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}
.dialog-head span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff8a7a;
}
.dialog-head span:nth-child(2) { background: #ffd166; }
.dialog-head span:nth-child(3) { background: #8fd1a3; }
.dialog-head strong { margin-left: auto; color: var(--accent-deep); }
.dialog-message {
  width: fit-content;
  max-width: 82%;
  margin-bottom: 12px;
  padding: 10px 13px;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}
.quick-create-card h1 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 2.8vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.hero-lead { color: var(--muted); font-size: 15px; line-height: 1.75; margin: 0 0 18px; }
.quick-create-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: stretch;
}
.quick-create-row textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 15px;
  outline: none;
  background: #fff;
}
.quick-create-row textarea:focus { border-color: var(--accent); }
.quick-create-row .primary-button { min-width: 150px; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--accent-deep);
  margin: 0;
}

.major-showcase {
  position: relative;
  padding: 16px 40px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(239, 252, 255, 0.74)),
    repeating-linear-gradient(90deg, rgba(0, 188, 212, 0.06) 0 1px, transparent 1px 82px);
}
.major-showcase::before {
  content: "Emerging Majors";
  position: absolute;
  right: 44px;
  top: 24px;
  color: rgba(47, 128, 237, 0.08);
  font-size: clamp(36px, 5vw, 78px);
  font-weight: 900;
  letter-spacing: -0.06em;
  pointer-events: none;
}
.major-intro {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin-bottom: 10px;
}
.major-intro h2 {
  margin: 6px 0 8px;
  font-size: clamp(24px, 2.1vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.035em;
}
.major-intro p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 14px;
}
.major-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}
.major-card {
  position: relative;
  width: 100%;
  min-height: 135px;
  min-width: 0;
  aspect-ratio: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  outline: 1px solid rgba(29, 56, 92, 0.08);
  color: #fff;
  overflow: hidden;
  background-size: cover;
  background-position: center right;
  box-shadow: 0 22px 44px -30px rgba(28, 58, 92, 0.48);
  cursor: pointer;
  isolation: isolate;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.major-card::before,
.major-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.major-card::before { mix-blend-mode: normal; opacity: 1; }
.major-card::after {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.1) 44%, rgba(255, 255, 255, 0.04) 100%),
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.22), transparent 42%);
}
.major-card.embodied {
  --major-accent: #0b6b45;
  background-image:
    linear-gradient(90deg, rgba(11, 107, 69, 0.98) 0%, rgba(16, 143, 89, 0.88) 48%, rgba(11, 107, 69, 0.34) 100%),
    url("./assets/embodied-robot.png");
}
.major-card.embodied::before { background: linear-gradient(90deg, #0b6b45 0%, rgba(11, 107, 69, 0.78) 48%, rgba(11, 107, 69, 0.06) 100%); }
.major-card.digital {
  --major-accent: #007c89;
  background-image:
    linear-gradient(90deg, rgba(0, 124, 137, 0.98) 0%, rgba(0, 169, 184, 0.88) 48%, rgba(0, 124, 137, 0.32) 100%),
    url("./assets/trade-ship.png");
}
.major-card.digital::before { background: linear-gradient(90deg, #007c89 0%, rgba(0, 124, 137, 0.76) 48%, rgba(0, 124, 137, 0.04) 100%); }
.major-card.circuit {
  --major-accent: #5631a8;
  background-image:
    linear-gradient(90deg, rgba(86, 49, 168, 0.98) 0%, rgba(126, 87, 194, 0.88) 48%, rgba(86, 49, 168, 0.34) 100%),
    url("./assets/circuit-board.png");
}
.major-card.circuit::before { background: linear-gradient(90deg, #5631a8 0%, rgba(86, 49, 168, 0.76) 48%, rgba(86, 49, 168, 0.06) 100%); }
.major-card.low-altitude {
  --major-accent: #1558b0;
  background-image:
    linear-gradient(90deg, rgba(21, 88, 176, 0.98) 0%, rgba(47, 128, 237, 0.88) 48%, rgba(21, 88, 176, 0.32) 100%),
    url("./assets/low-altitude-drone.png");
}
.major-card.low-altitude::before { background: linear-gradient(90deg, #1558b0 0%, rgba(21, 88, 176, 0.76) 48%, rgba(21, 88, 176, 0.04) 100%); }
.major-card:hover {
  transform: translateY(-4px);
  filter: saturate(1.08) brightness(1.04);
  box-shadow: 0 28px 52px -30px rgba(28, 58, 92, 0.58);
}
.major-card h3 {
  margin: 0;
  font-size: clamp(20px, 1.8vw, 27px);
  letter-spacing: -0.04em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.42), 0 0 18px rgba(255, 255, 255, 0.32);
}
.major-desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: 12px;
  line-height: 1.65;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.48), 0 0 14px rgba(255, 255, 255, 0.24);
}
.major-agents {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}
.major-agents button {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.46);
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.36);
}
.major-agents button:hover { background: rgba(255, 255, 255, 0.3); }
.side-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}
.side-card-head strong { margin-left: auto; font-size: 12px; color: var(--brand-red-deep); }
.window-dots { display: inline-flex; gap: 5px; }
.window-dots i { width: 9px; height: 9px; border-radius: 50%; background: #ffb3ab; }
.window-dots i:nth-child(2) { background: #ffd166; }
.window-dots i:nth-child(3) { background: #a8d5a2; }

.side-card-body { padding-top: 12px; }
.side-card-body p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.teacher-workflow {
  position: relative;
  overflow: hidden;
}
.teacher-workflow::before {
  content: "";
  position: absolute;
  inset: 14px auto 80px 27px;
  width: 2px;
  background: linear-gradient(180deg, var(--brand-red), rgba(255, 129, 40, 0.18));
}
.teacher-workflow .workflow-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.teacher-workflow ol {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 10px;
}
.teacher-workflow li {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding-left: 6px;
}
.teacher-workflow li::before {
  content: "";
  position: absolute;
  left: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  z-index: 1;
}
.teacher-workflow li span {
  position: relative;
  z-index: 2;
  margin-left: 24px;
  font-size: 12px;
  color: var(--accent-deep);
  font-weight: 700;
}
.teacher-workflow li strong {
  font-size: 13px;
  line-height: 1.55;
}
.quick-agent {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.quick-agent:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.qa-icon { display: inline-flex; align-items: center; }
.qa-text strong { display: block; font-size: 15px; }
.qa-text small { color: var(--muted); }

/* ---- 区块标题 ---- */
.section-heading { display: block; padding: 20px 40px 8px; margin: 0; }
.section-heading h2 { margin: 4px 0 6px 0; font-size: clamp(24px, 2.1vw, 36px); line-height: 1.12; letter-spacing: -0.035em; }
.section-heading .muted { color: var(--muted); font-size: 13px; }
.section-heading .primary-button { margin-top: 10px; }

/* ---- 图库工具栏 ---- */
.gallery-toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; padding: 0 40px 10px; margin: 0; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  min-width: 260px;
}
.search-box input { border: 0; outline: 0; background: transparent; flex: 1; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.chip:hover { background: var(--surface-tint); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- 智能体卡片 ---- */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  padding: 0 40px 26px;
}
/* 卡片整体更紧凑：留白小一点，让首页在整页缩放时更容易一屏放下 */
.agent-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 13px;
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agent-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.card-icon {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.agent-card h3 { margin: 28px 0 0; font-size: 15.5px; }
/* 专家卡片与普通卡片统一白底边框，颜色保持一致 */
.agent-card.expert { border-color: var(--line); background: var(--surface); }
.agent-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; flex: 1; }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.card-tags span {
  font-size: 10.5px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.cat-badge {
  background: var(--surface-tint);
  padding: 2px 8px;
  border-radius: 999px;
}
.empty-tip { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---- 通用卡片 ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.info-card.dashed { border-style: dashed; }
.info-card h3 { margin: 8px 0 6px; font-size: 16px; }
.info-card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

/* ---- 智能体详情 ---- */
.detail-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
body[data-active-agent-ui="quiz"] .detail-shell,
body[data-active-agent-ui="document"] .detail-shell {
  /* 出题页和教案页需要尽量顶到内容区边缘，减少无效留白。 */
  max-width: none;
  width: 100%;
  padding: 0 8px 8px;
}
body[data-active-agent-ui="quiz"] .agent-detail-top,
body[data-active-agent-ui="document"] .agent-detail-top {
  margin-bottom: 8px;
  padding: 12px 16px;
}
.back-button {
  background: transparent;
  color: var(--muted);
  padding: 8px 0;
  margin-bottom: 12px;
  font-size: 14px;
}
.back-button:hover { color: var(--brand-red-deep); }

.agent-detail-top {
  display: flex;
  gap: 16px;
  align-items: center;
  background: linear-gradient(150deg, var(--surface), var(--surface-tint));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
}
.detail-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 34px -26px rgba(215, 25, 42, 0.6);
}
.detail-meta { flex: 1; min-width: 0; }
.detail-meta h2 { margin: 0 0 6px; font-size: 22px; }
.detail-meta p {
  max-width: 760px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.skill-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.skill-tag {
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 4px 10px;
}
.detail-stat {
  min-width: 92px;
  text-align: center;
  padding: 0 12px;
  border-left: 1px solid var(--line);
}
.detail-stat strong { display: block; font-size: 26px; color: var(--brand-red); }
.detail-stat span { font-size: 12px; color: var(--muted); }

/* ---- 聊天 ---- */
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: calc(100vh - 220px);
}
.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.chat-toolbar small { color: var(--muted); font-size: 12px; }
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4caf50;
  margin-right: 6px;
}
.chat-messages {
  min-height: 0;
  height: auto;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.message { display: flex; }
.message.user { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }
.bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 16px;
  line-height: 1.65;
  font-size: 14px;
  white-space: pre-wrap;
}
.message.user .bubble { background: linear-gradient(135deg, var(--brand-red), var(--accent)); color: #fff; border-bottom-right-radius: 4px; }
.message.assistant .bubble {
  background: var(--surface-tint);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  /* 助手消息按 Markdown 渲染成 HTML，由标签控制换行，不再按纯文本保留换行 */
  white-space: normal;
}
/* 聊天 Markdown 渲染样式 */
.message.assistant .bubble h2,
.message.assistant .bubble h3,
.message.assistant .bubble h4 {
  margin: 10px 0 6px;
  line-height: 1.4;
}
.message.assistant .bubble h2 { font-size: 17px; }
.message.assistant .bubble h3 { font-size: 15px; }
.message.assistant .bubble h4 { font-size: 14px; }
.message.assistant .bubble p { margin: 6px 0; }
.message.assistant .bubble ul { margin: 6px 0; padding-left: 20px; }
.message.assistant .bubble li { margin: 3px 0; }
.message.assistant .bubble blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(43, 224, 196, 0.08);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
}
.message.assistant .bubble .chat-table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
  width: 100%;
}
.message.assistant .bubble .chat-table th,
.message.assistant .bubble .chat-table td {
  border: 1px solid var(--line);
  padding: 5px 8px;
  text-align: left;
}
.message.assistant .bubble .chat-table th { background: var(--accent-soft); }
.message.assistant .bubble .chat-code {
  margin: 8px 0;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  white-space: pre;
  overflow-x: auto;
}
.agent-voice-preview {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(215, 25, 42, 0.14);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf9, #fff5ec);
  color: var(--text-soft);
  font-size: 13px;
}
.voice-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.voice-preview-head strong { color: var(--text); }
.voice-preview-head span { color: var(--accent-deep); font-size: 12px; font-weight: 700; }
.agent-voice-preview p { margin: 6px 0; line-height: 1.6; }
.agent-voice-preview blockquote {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: #fff;
  line-height: 1.7;
}
.agent-voice-preview small { color: var(--muted); font-weight: 700; }
.message.loading .bubble::after {
  content: "…";
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 18px 14px;
}
.chat-suggestions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chat-suggestions button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  padding: 7px 12px;
  font-size: 12px;
}
.chat-suggestions button:hover {
  border-color: var(--accent);
  color: var(--brand-red-deep);
  background: var(--accent-soft);
}

/* 回答下方的"参考资料"折叠标签（DeepSeek 风格）：默认一个小按钮，点击展开来源列表 */
.chat-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
}
.chat-sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(45, 132, 255, 0.3);
  color: #176dff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-sources-toggle:hover { background: #eef5ff; }
.chat-sources-toggle .ic { width: 13px; height: 13px; }
.chat-sources-toggle .chat-sources-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}
.chat-sources-toggle.open .chat-sources-arrow { transform: rotate(180deg); }
.chat-sources-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.chat-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4f8ff;
  border: 1px solid rgba(45, 132, 255, 0.18);
  color: #33415c;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  max-width: 100%;
}
.chat-source-item .ic { width: 13px; height: 13px; color: #176dff; flex: none; }
.chat-source-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-source-item:hover { background: #e8f1ff; border-color: #2d84ff; }

.chat-form { padding: 16px 18px 18px; border-top: 1px solid var(--line); background: #fff; }
.chat-form label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 8px; }
.chat-input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1;
  min-height: 76px;
  max-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.6;
  outline: none;
}
.chat-input-row .primary-button { min-height: 46px; }
.chat-input-row textarea:focus { border-color: var(--accent); }
.form-error { color: var(--danger); font-size: 13px; margin: 8px 0 0; }

/* 对话工具栏下方的模型选择 + 温度滑块 */
.chat-model-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.chat-model-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.chat-model-row select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--text);
  outline: none;
}
.chat-model-row em {
  font-style: normal;
  font-weight: 700;
  color: var(--accent-deep);
  min-width: 26px;
}
.chat-model-row input[type="range"] {
  width: 120px;
  accent-color: var(--accent);
}

/* ---- 教案生成工作区 ---- */
.document-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.75fr);
  gap: 20px;
  min-height: clamp(660px, 82vh, 900px);
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(135deg, #eaf6ff 0%, #d9f5fb 50%, #e9e8ff 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
}
.quiz-workspace {
  /* 出题页左边要看题目和数学符号，所以给预览区更多宽度。 */
  grid-template-columns: minmax(0, 1.9fr) minmax(300px, 0.55fr);
  gap: 10px;
  min-height: calc(100vh - 132px);
  padding: 8px;
  border-radius: 18px;
}
.document-preview-card {
  position: relative;
  min-height: clamp(620px, 78vh, 860px);
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 22px;
  background: rgba(239, 248, 255, 0.64);
  display: flex;
  align-items: center;
  justify-content: center;
  /* 页面内容超高时允许滚动查看，避免内容被裁切看不见。 */
  overflow: auto;
  padding: 68px 30px 74px;
}
.document-empty {
  text-align: center;
  color: #2d3a54;
  font-size: 15px;
}
.document-empty .ic {
  width: 76px;
  height: 76px;
  color: #91a9d8;
  margin-bottom: 18px;
}
.document-preview-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
  z-index: 2;
}
.document-pager {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 2;
}
.document-pager span {
  min-width: 92px;
  text-align: center;
  color: #42526b;
  font-size: 13px;
  font-weight: 700;
}
.document-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.document-output {
  --document-page-scale: 0.52;
  width: 397px;
  height: 562px;
  min-height: 0;
  position: relative;
  overflow: hidden;
  color: #172033;
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.quiz-output {
  width: min(760px, 100%);
  max-height: 520px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  box-shadow: 0 22px 60px -42px rgba(28, 58, 92, 0.55);
  padding: 32px 36px;
  color: #172033;
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.grading-workspace .document-preview-card {
  align-items: flex-start;
  justify-content: center;
}
.document-page {
  position: absolute;
  left: 0;
  top: 0;
  width: 794px;
  height: 1123px !important;
  max-height: 1123px;
  min-height: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 68px 74px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 4px;
  box-shadow: 0 22px 60px -42px rgba(28, 58, 92, 0.55);
  /* 文档页可能包含 ∫、∑、π 这类数学符号，增加数学字体兜底，避免显示成方框。 */
  font-family: "Cambria Math", "Times New Roman", "Microsoft YaHei", serif;
  /* 内容超出页面高度时允许页面内滚动，保证不丢内容。 */
  overflow: auto;
  transform: scale(var(--document-page-scale));
  transform-origin: top left;
}
.quiz-workspace .document-page {
  /* 微积分题里 ∫、∂、x² 等符号偏小，出题页单独放大文字。 */
  font-size: 20px;
  line-height: 2.05;
}
.quiz-workspace .document-preview-card {
  min-height: calc(100vh - 150px);
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 52px 12px 62px;
}
.quiz-workspace .document-form-card {
  max-height: calc(100vh - 150px);
  padding: 18px 16px;
}
body[data-active-agent-ui="document"] .document-workspace {
  /* 教案页和出题页一样，预览区尽量占满，表单区收窄。 */
  grid-template-columns: minmax(0, 1.9fr) minmax(300px, 0.55fr);
  gap: 10px;
  min-height: calc(100vh - 132px);
  padding: 8px;
  border-radius: 18px;
}
body[data-active-agent-ui="document"] .document-preview-card {
  min-height: calc(100vh - 150px);
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 52px 12px 62px;
}
body[data-active-agent-ui="document"] .document-form-card {
  max-height: calc(100vh - 150px);
  padding: 18px 16px;
}
body[data-active-agent-ui="document"] .document-page {
  /* 教案正文：宋体（教案规范习惯），行距接近 Word 的 1.5 倍 */
  font-family: "SimSun", "STSong", "宋体", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.6;
}
/* 文档页里的段落：块间距和长内容换行保留 */
.document-page p {
  margin: 0 0 8px;
  white-space: pre-wrap;
}
body[data-active-agent-ui="document"] .document-page p {
  /* 教案正文段落首行缩进两个字符，像 Word 教案 */
  text-indent: 2em;
}
/* 一级标题（一、）：黑体加粗，比正文大一号 */
.lesson-title {
  font-family: "SimHei", "黑体", "Microsoft YaHei", sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 1.4;
  margin: 16px 0 8px;
  text-indent: 0;
}
/* 二级标题（1.）：加粗，与正文同号 */
.lesson-subtitle {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.5;
  margin: 12px 0 6px;
  text-indent: 0;
}
.quiz-workspace .document-page .lesson-title {
  font-size: 22px;
}
.quiz-workspace .document-page .lesson-subtitle {
  font-size: 20px;
}
.document-page:last-child {
  margin-bottom: 0;
}
.document-page[hidden] {
  display: none;
}
.document-form-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  padding: 26px 24px;
  box-shadow: 0 24px 70px -44px rgba(27, 60, 108, 0.45);
  max-height: clamp(560px, 72vh, 760px);
  overflow-y: auto;
}
.document-assistant-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #19b8d2;
  margin-bottom: 20px;
}
.document-assistant-head strong { font-size: 18px; }
.document-assistant-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.doc-avatar {
  display: inline-flex;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #2de0c4, #2783ff);
}
.doc-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #eef1f6;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
}
.doc-tabs button {
  border-radius: 999px;
  padding: 9px 12px;
  color: #506078;
  background: transparent;
}
.doc-tabs button.active { color: #176dff; background: #fff; box-shadow: 0 8px 18px -16px rgba(20, 80, 180, 0.75); }
.doc-tabs button:disabled { opacity: 0.6; cursor: not-allowed; }
.document-form { display: grid; gap: 18px; }
.document-form label {
  display: grid;
  gap: 9px;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}
.document-form label span { color: var(--danger); }
.inline-doc-input {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border: 2px solid #1f8bff;
  border-left-color: #29d8c2;
  border-radius: 12px;
  padding: 10px 12px;
}
.inline-doc-input em {
  font-style: normal;
  font-weight: 500;
  color: #1f2937;
  white-space: nowrap;
}
.inline-doc-input input,
.document-form textarea,
.document-form select,
.doc-mini-grid input {
  border: 0;
  outline: none;
  background: #f4f6fb;
  border-radius: 8px;
  padding: 10px 12px;
  color: #172033;
}
.document-form textarea { resize: vertical; min-height: 108px; }
.doc-chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.doc-chip {
  border: 1px solid transparent;
  background: #f4f6fb;
  color: #34445d;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
}
.doc-chip.active {
  color: #176dff;
  border-color: #2d84ff;
  background: #eef5ff;
  box-shadow: inset 0 -2px 0 rgba(45, 132, 255, 0.22);
}
.template-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.template-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.template-choice.active {
  border-color: #2d84ff;
  background: #eef5ff;
  box-shadow: inset 0 -2px 0 rgba(45, 132, 255, 0.18);
}
.template-choice strong { font-size: 14px; color: #172033; }
.template-choice span { grid-column: 2; color: var(--muted); font-size: 12px; line-height: 1.5; }
.doc-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.doc-tip { margin: 0; text-align: center; color: #4382e7; font-size: 12px; }
.document-submit { width: 100%; justify-content: center; border-radius: 999px; background: #347df0; }

/* ---- 知识图谱工作区 ---- */
.graph-kb-list {
  display: grid;
  gap: 6px;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.graph-view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.graph-view-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: #506078;
  background: #fff;
}
.graph-view-tabs button.active { color: #176dff; border-color: #176dff; background: #eef5ff; }
.graph-chart {
  width: 100%;
  height: 540px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.graph-table-wrap {
  max-height: 540px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.graph-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.graph-table th, .graph-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #eef1f6; }
.graph-table th { background: #f6f8fb; color: #506078; font-weight: 600; position: sticky; top: 0; }
.graph-table tr:last-child td { border-bottom: none; }
.graph-outline {
  max-height: 540px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 0;
}
.graph-summary {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #eef5ff;
  border-radius: 12px;
  color: #172033;
  font-size: 13px;
  line-height: 1.7;
}
.lesson-history-card {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.lesson-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.lesson-history-head strong { font-size: 15px; }
.lesson-history-head span { color: var(--muted); font-size: 12px; }
.lesson-history-list { display: grid; gap: 10px; }
.lesson-history-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.lesson-history-pager span {
  min-width: 82px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.lesson-history-pager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.lesson-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcff;
}
.lesson-history-item.other-agent {
  background: #fffdf8;
  border-style: dashed;
}
.lesson-history-open {
  min-width: 0;
  display: grid;
  gap: 3px;
  text-align: left;
  color: inherit;
  background: transparent;
}
.lesson-history-open strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.lesson-history-open span { color: var(--muted); font-size: 12px; }
.empty-tip.compact { padding: 14px 0 4px; font-size: 13px; }

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  html,
  body.print-document-mode {
    width: 210mm;
    min-height: 297mm;
    background: #fff !important;
  }
  body.print-document-mode * { visibility: hidden !important; }
  body.print-document-mode #documentOutput,
  body.print-document-mode #documentOutput * { visibility: visible !important; }
  body.print-document-mode .document-pager { display: none !important; }
  body.print-document-mode #documentOutput {
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm;
    height: auto;
    min-height: auto;
    overflow: visible;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    font-size: 12pt;
    line-height: 1.75;
    color: #000;
    background: #fff;
  }
  body.print-document-mode .document-page {
    position: relative;
    left: auto;
    top: auto;
    display: block !important;
    transform: none;
    width: 210mm;
    /* 高度交给浏览器自然分页：内容超过一张 A4 时自动流到下一页，不会裁切 */
    height: auto;
    margin: 0;
    padding: 22mm 24mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
    white-space: pre-wrap;
    overflow: visible;
    background: #fff;
    /* 打印用规范排版：宋体正文、小四字号、接近 1.5 倍行距 */
    font-family: "SimSun", "STSong", "宋体", "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.75;
    color: #000;
  }
  body.print-document-mode .document-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  body.print-document-mode .lesson-title {
    /* 打印时一级标题用黑体三号（16pt），和 Word 教案规范一致 */
    font-family: "SimHei", "黑体", "Microsoft YaHei", sans-serif;
    font-size: 16pt;
    margin: 10pt 0 6pt;
  }
  body.print-document-mode .lesson-subtitle {
    font-size: 12pt;
    margin: 8pt 0 4pt;
  }

  body.print-plain-output-mode * { visibility: hidden !important; }
  body.print-plain-output-mode .print-target,
  body.print-plain-output-mode .print-target * { visibility: visible !important; }
  body.print-plain-output-mode .print-target {
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm;
    max-height: none;
    min-height: 297mm;
    overflow: visible;
    margin: 0;
    padding: 22mm 24mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #000;
    background: #fff;
    font-size: 12pt;
    line-height: 1.75;
    white-space: pre-wrap;
  }
}


/* ---- 创建智能体 ---- */
/* 不限制最大宽度，两栏随屏幕自动缩放铺满内容区 */
.create-shell { width: 100%; margin: 0 auto; }
.create-hero { text-align: center; margin: 10px 0 22px; }
.create-hero h2 { font-size: 26px; margin: 8px 0 8px; }
.create-hero .muted { color: var(--muted); margin: 0; }

/* 左右两栏：左边输入+生成按钮（约 6），右边配置结果区（约 4），按钮都固定在视口内 */
.create-layout {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 4fr);
  gap: 16px;
  align-items: stretch;
}
.create-input-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.create-input-card textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}
.create-input-card textarea:focus { border-color: var(--accent); }
.create-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.create-input-card .create-actions { flex: none; }

.create-result {
  background: linear-gradient(150deg, var(--surface), var(--surface-tint));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  /* 右栏撑满左栏高度，内容多时只在中间区域滚动，按钮固定在底部 */
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 210px);
}
.create-result-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.create-result > .create-actions {
  flex: none;
  margin-top: 16px;
}
.create-result-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.step-badge {
  background: linear-gradient(135deg, var(--brand-red), var(--accent));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
}
.result-head span:last-child { color: var(--muted); font-size: 13px; }
.result-field { margin-bottom: 14px; }
.result-field label { display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.result-field input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  background: var(--surface);
}
.skill-check-list { display: flex; gap: 8px; flex-wrap: wrap; }
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
}

/* ---- 本地知识库 ---- */
.knowledge-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.knowledge-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  padding: 0 40px 40px;
}
.knowledge-directory-card,
.knowledge-list-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow);
}
.knowledge-directory-card {
  align-self: start;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}
.knowledge-directory-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.knowledge-directory-head h3 { margin: 0; font-size: 17px; }
.knowledge-directory-head span { color: var(--muted); font-size: 12px; }
.knowledge-list-head h3 { margin: 0 0 6px; font-size: 18px; }
.knowledge-list-head .muted { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.upload-modal select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.knowledge-upload-entry { width: 100%; justify-content: center; margin: 10px 0 4px; }
.knowledge-file-state {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.knowledge-file-state.error { color: var(--danger); }
.knowledge-folder-row {
  display: grid;
  gap: 8px;
}
.knowledge-directory-head .quiet-button.small {
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}
.knowledge-new-folder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-bottom: 10px;
}
.knowledge-new-folder input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  font-size: 12px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.knowledge-new-folder .primary-button.small { padding: 7px 10px; font-size: 12px; white-space: nowrap; }
.knowledge-new-folder[hidden] { display: none; }
.knowledge-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text-soft);
  padding: 10px 12px;
  font-size: 13px;
  text-align: left;
}
.knowledge-folder.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--brand-red-deep);
}
.knowledge-folder em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}
.knowledge-browser {
  display: grid;
  /* 两列都允许收缩（minmax(0,…)），大框不被内容硬撑变形 */
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: stretch;
}
.knowledge-browser:has(.knowledge-detail-card[hidden]) {
  grid-template-columns: 1fr;
}
.knowledge-browser > div:first-child {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 190px);
  max-height: calc(100vh - 190px);
}
.knowledge-browser .knowledge-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.knowledge-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.search-box.compact { min-width: 0; width: 100%; }
.knowledge-table-head,
.knowledge-table-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 96px 96px 74px 176px;
  gap: 10px;
  align-items: center;
  min-width: 660px;
}
.knowledge-table-head {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.knowledge-grid {
  display: grid;
  overflow-x: auto;
  /* 行从顶部排列，禁止 stretch：否则只有 1 条记录时整行会被拉满整个表格高度 */
  align-content: start;
}
.knowledge-table-row {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
}
.knowledge-table-row:hover { background: var(--surface-tint); }
.knowledge-table-row span { min-width: 0; }
.knowledge-table-row em { color: var(--muted); font-style: normal; }
.knowledge-doc-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.knowledge-doc-main > div {
  min-width: 0;
  flex: 1 1 auto;
}
.knowledge-doc-main strong {
  display: block;
  /* 标题允许换行，长名称也能完整显示 */
  overflow: visible;
  white-space: normal;
  word-break: break-all;
}
.knowledge-doc-main small {
  display: block;
  /* 文件名小字一行显示，太长时省略号截断，避免撑宽表格 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.knowledge-doc-main strong { color: var(--text); font-size: 13px; }
.knowledge-doc-main small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.knowledge-doc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.knowledge-status {
  display: inline-flex;
  border: 1px solid #86efac;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  padding: 2px 7px;
  font-size: 11px;
}
.knowledge-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}
.knowledge-row-actions .quiet-button.small { padding: 5px 6px; font-size: 11px; }
.knowledge-course { color: var(--muted); font-size: 12px; }
.knowledge-course { margin: 7px 0; }
.knowledge-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.knowledge-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.knowledge-detail-card {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  /* 预览大框固定大小、适应窗口高度，内容再长也在框内滚动，不会撑变形 */
  height: calc(100vh - 150px);
  min-height: 0;
  max-height: calc(100vh - 130px);
  overflow: hidden;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  min-width: 0;
}
.knowledge-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.knowledge-detail-head h3 { margin: 4px 0 6px; font-size: 20px; }
.kb-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  flex: none;
}
.kb-close-btn .ic { width: 15px; height: 15px; }
.knowledge-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
  /* 长 URL / 长英文串自动断行，防止把大框撑宽变形 */
  overflow-wrap: break-word;
  word-break: break-word;
  padding-right: 8px;
}
.knowledge-detail-card[hidden] {
  display: none !important;
}
@keyframes kbSlideIn {
  from { transform: translateX(48px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.knowledge-detail-card.slide-in { animation: kbSlideIn 0.3s ease; }
@keyframes kbSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(48px); opacity: 0; }
}
.knowledge-detail-card.slide-out { animation: kbSlideOut 0.25s ease forwards; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
}
.modal-backdrop[hidden] { display: none; }
.upload-modal {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  box-shadow: 0 28px 80px -34px rgba(15, 23, 42, 0.55);
  overflow: hidden;
}
.upload-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.upload-modal-head h3 { margin: 0; font-size: 18px; }
.upload-modal label:not(.upload-drop-zone) {
  display: grid;
  gap: 7px;
  margin: 14px 22px 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}
.upload-modal input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.upload-drop-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 150px;
  margin: 20px 22px 14px;
  border: 1.5px dashed #b8c2d6;
  border-radius: 18px;
  background: #fbfcff;
  color: var(--text-soft);
  cursor: pointer;
}
.upload-drop-zone .ic { width: 34px; height: 34px; color: #7b8ba8; }
.upload-drop-zone strong { color: var(--text); font-size: 15px; }
.upload-drop-zone span { color: var(--muted); font-size: 12px; }
.upload-drop-zone input { display: none; }
.upload-modal .knowledge-file-state { margin: 12px 22px 0; }
.upload-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  background: #fbfcff;
}

/* ---- 开场白设置弹窗 ---- */
.greeting-modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 80vh;
  overflow-y: auto;
}
.greeting-modal label {
  display: grid;
  gap: 8px;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}
.greeting-modal textarea,
.greeting-modal input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  resize: vertical;
  background: #f8fafc;
}
.greeting-modal textarea:focus,
.greeting-modal input:focus { border-color: var(--accent); }
.greeting-question-list {
  display: grid;
  gap: 8px;
}
.greeting-question-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

/* ---- 敏感词拦截弹窗 ---- */
.sensitive-categories {
  display: grid;
  gap: 10px;
}
.sensitive-category {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fafbfc;
}
.sensitive-category-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.sensitive-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.sensitive-toggle input { accent-color: var(--accent); }
.sensitive-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sensitive-word {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #eef5ff;
  border: 1px solid rgba(45, 132, 255, 0.25);
  color: #176dff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}
.sensitive-word button {
  background: transparent;
  border: 0;
  color: #176dff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.sensitive-word button:hover { color: var(--danger); }
.sensitive-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.sensitive-log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.sensitive-log-head span { font-size: 12px; color: var(--muted); font-weight: 400; }
.sensitive-log {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.sensitive-log-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-soft);
  background: #fafbfc;
  border-radius: 8px;
  padding: 6px 10px;
}
.sensitive-log-item em { color: var(--muted); font-style: normal; font-size: 11px; }
.sensitive-log-kind {
  text-align: center;
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 8px;
  font-weight: 700;
}
.sensitive-log-kind.block { background: #fdeaea; color: #c03030; }
.sensitive-log-kind.replace { background: #fff4e0; color: #b0761c; }

/* 回答被替换敏感词后的预警提示 */
.sensitive-warning {
  margin: 8px 0 0;
  font-size: 12px;
  color: #b0761c;
  background: #fff8e8;
  border: 1px solid rgba(176, 118, 28, 0.25);
  border-radius: 8px;
  padding: 6px 10px;
}

/* ---- 页脚：固定贴屏幕底部，跟随左侧导航栏宽度（和导航栏一样不参与整页缩放） ---- */
.site-footer {
  position: fixed;
  left: 240px;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 12px 40px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
}

/* ---- 响应式 ---- */
/* 大屏幕优化 */
@media (min-width: 1400px) {
  .sidebar { width: 260px; }
  .site-footer { left: 260px; }
  /* 大屏下智能体卡片 5 列，卡片更多更紧凑，首页整体更矮、更容易一屏放下 */
  .agent-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .detail-shell { max-width: 1360px; }
  .document-workspace { grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.72fr); }
}

/* 超宽屏（1920 及以上）再加到 6 列，首页 3 行放完，整页缩放时不会在右侧留白 */
@media (min-width: 1680px) {
  .agent-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
  .major-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-shell { max-width: 100%; padding: 0 18px; }
  /* 教案/出题工作区：窄屏改为上下单栏。这里必须连同高优先级选择器一起写，
     否则 body[data-active-agent-ui="document"] 那条双栏规则会把本设置覆盖掉。 */
  .document-workspace,
  .quiz-workspace,
  body[data-active-agent-ui="document"] .document-workspace,
  body[data-active-agent-ui="quiz"] .document-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .document-preview-card,
  body[data-active-agent-ui="document"] .document-preview-card,
  .quiz-workspace .document-preview-card {
    min-height: 560px;
  }
  .document-form-card,
  body[data-active-agent-ui="document"] .document-form-card,
  .quiz-workspace .document-form-card {
    max-height: none;
    padding: 22px 18px;
  }
  /* 中屏时知识库列表和详情预览改上下单列，避免 520px 双列挤压变形 */
  .knowledge-shell { grid-template-columns: 1fr; }
  .knowledge-browser { grid-template-columns: 1fr; }
  .knowledge-browser > div:first-child { min-height: 0; max-height: none; }
  .knowledge-browser .knowledge-grid { overflow-y: visible; }
  .knowledge-detail-card { position: static; height: auto; max-height: 70vh; }
  /* "帮我生成…教学设计"这类一行三段的输入框，窄屏改为上下排列，避免撑破容器 */
  .inline-doc-input { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 18px;
  }
  .site-footer { left: 0; }
  .sidebar .side-nav {
    position: relative;
    order: 3;
    flex: 0 0 100%;
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .side-nav::after {
    content: "";
    position: sticky;
    right: -1px;
    flex: 0 0 34px;
    align-self: stretch;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,0), #ffffff 75%);
  }
  .side-nav a {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
  }
  .sidebar .sidebar-foot {
    margin-left: auto;
    flex-direction: row;
    border-top: none;
    padding-top: 0;
  }
  .page-shell {
    margin-left: 0;
    width: 100%;
    padding: 0;
  }
  .hero-section,
  .major-showcase { padding: 24px 18px; }
  .quick-create-card { grid-template-columns: 1fr; }
  .quick-create-copy { max-width: none; }
  .quick-create-row { grid-template-columns: 1fr; }
  .create-layout { grid-template-columns: 1fr; }
  .create-result { max-height: none; }
  .major-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .major-showcase::before { right: 18px; top: 18px; font-size: 42px; }
  .search-box { min-width: 100%; }
  .agent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading,
  .gallery-toolbar,
  .agent-grid,
  .knowledge-shell {
    padding-left: 18px;
    padding-right: 18px;
  }
  .knowledge-shell { grid-template-columns: 1fr; }
  .knowledge-directory-card { position: static; max-height: none; }
  .knowledge-list-head { grid-template-columns: 1fr; }
  .knowledge-browser { grid-template-columns: 1fr; }
  .knowledge-browser > div:first-child { min-height: 0; max-height: none; }
  .knowledge-browser .knowledge-grid { overflow-y: visible; }
  .knowledge-grid { overflow-x: auto; }
  .knowledge-table-head,
  .knowledge-table-row { min-width: 720px; }
  .knowledge-detail-card { position: static; height: auto; max-height: 70vh; }
  .knowledge-heading { align-items: flex-start; }
  .document-workspace { padding: 12px; border-radius: 20px; }
  .document-preview-card { min-height: 500px; padding: 64px 18px 70px; }
  .doc-mini-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .sidebar-foot .ghost-button { display: none; }
  .teacher-chip { padding: 6px 10px; }
  .hero-actions,
  .create-actions,
  .chat-input-row,
  .site-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .primary-button,
  .quiet-button,
  .ghost-button {
    width: 100%;
    justify-content: center;
  }
  .section-heading {
    display: block;
  }
  .section-heading h2 { margin-top: 4px; }
  .knowledge-heading { flex-direction: column; }
  .major-grid { grid-template-columns: 1fr; }
  .major-card { min-height: 180px; aspect-ratio: auto; }
  .agent-detail-top,
  .wizard-step {
    align-items: flex-start;
    flex-direction: column;
  }
  .detail-avatar { width: 48px; height: 48px; flex-basis: 48px; }
  .detail-stat {
    min-width: 0;
    text-align: left;
    padding: 0;
    border-left: 0;
  }
  .detail-shell { padding: 0 12px; }
  .document-preview-actions {
    left: 14px;
    right: 14px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .document-preview-card { min-height: 460px; }
  .document-form-card { padding: 20px 16px; }
  /* 手机宽度下教案 A4 纸预览再缩小一档，宽度自适应容器，避免横向溢出 */
  .document-output { --document-page-scale: 0.4; width: min(397px, 100%); }
  .bubble { max-width: 94%; }
  .skill-gen-grid { grid-template-columns: 1fr; }
  .agent-grid { grid-template-columns: 1fr; }
  .hero-section,
  .major-showcase { padding: 20px 16px; }
  .section-heading,
  .gallery-toolbar,
  .agent-grid,
  .knowledge-shell {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* 高缩放比例适配 */
@media (min-resolution: 144dpi) and (min-width: 901px) {
  .sidebar { width: 220px; }
  .site-footer { left: 220px; }
}


/* ---- SVG 图标（线性风格） ---- */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
.nav-ic .ic { width: 17px; height: 17px; }
.card-icon .ic { width: 26px; height: 26px; color: var(--brand-red); }
.info-card .card-icon .ic { color: var(--accent-deep); }
.detail-avatar .ic { width: 42px; height: 42px; color: var(--brand-red); }
.qa-icon .ic { width: 24px; height: 24px; color: var(--brand-red); }
.search-box .ic { width: 15px; height: 15px; color: var(--muted); }
.primary-button .ic { color: #fff; margin-right: 6px; }
.ghost-button .ic { color: var(--text-soft); margin-right: 4px; }


/* ---- 技能库 ---- */
#skills { padding-left: 18px; }
.skill-gen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; min-width: 0; }
.skill-gen-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.skill-gen-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.skill-gen-head h3 { margin: 0; font-size: 16px; }
.skill-gen-head .ic { width: 18px; height: 18px; color: var(--brand-red); }
.skill-gen-card p.muted { margin: 0 0 12px; }
.skill-gen-card textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; font: inherit; }
.skill-q { display: block; margin: 10px 0; font-size: 13px; color: var(--text-soft); }
.skill-q input, .skill-q select { width: 100%; margin-top: 5px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; font: inherit; }
.skill-gen-result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 24px; }
.skill-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.skill-toolbar .search-box.compact { flex: 0 1 320px; min-width: 0; }
.skill-toolbar .cat-chips { flex: 1 1 auto; }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.skill-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.skill-card.saved { border-color: rgba(255, 129, 40, 0.38); background: linear-gradient(180deg, #fffdf9, #fff8ef); }
.skill-card-head { display: flex; align-items: center; gap: 8px; }
.skill-card-head h3 { margin: 0; font-size: 16px; flex: 1; }
.skill-card-head .card-icon .ic { width: 22px; height: 22px; }
.skill-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.skill-source { font-size: 11px; color: var(--accent-deep); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.skill-prompt { background: var(--surface-tint); border-radius: 10px; padding: 10px; font-size: 12px; color: var(--text-soft); line-height: 1.6; }
.skill-card-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.skill-card-foot .ghost-button .ic { margin-right: 4px; }
.quiet-button.danger { color: var(--danger); }
.skill-card { cursor: pointer; }
.skill-card button { cursor: pointer; }
.skill-detail-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 56px);
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 72px rgba(31, 26, 23, 0.24);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.skill-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.skill-detail-head h3 { margin: 4px 0 6px; font-size: 22px; }
.skill-detail-head .muted { margin: 0; line-height: 1.5; }
.skill-md-view {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf9;
  padding: 18px 20px;
  color: var(--text-soft);
  line-height: 1.75;
}
.skill-md-view h2,
.skill-md-view h3,
.skill-md-view h4 { color: var(--text); margin: 18px 0 8px; }
.skill-md-view h2:first-child { margin-top: 0; }
.skill-md-view p { margin: 8px 0; }
.skill-md-view ul { margin: 8px 0 12px; padding-left: 20px; }
.skill-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ---- 工作流画布预览：左侧节点库 + 右侧流程画布 ---- */
.workflow-shell {
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.workflow-intro-card,
.workflow-canvas-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 22px;
}
.workflow-intro-card h3,
.workflow-canvas-card h3 { margin: 0; font-size: 18px; }
.workflow-intro-card p { color: var(--muted); line-height: 1.7; margin: 10px 0 0; }
.workflow-node-palette { display: grid; gap: 10px; margin-top: 18px; }
.workflow-palette-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 3px 10px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf9;
  color: var(--text-soft);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.workflow-palette-item:hover,
.workflow-palette-item.active {
  transform: translateY(-1px);
  border-color: rgba(215, 25, 42, 0.28);
  box-shadow: 0 14px 28px -24px rgba(215, 25, 42, 0.75);
}
.workflow-palette-item span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 800;
}
.workflow-palette-item strong { align-self: end; color: var(--text); font-size: 14px; }
.workflow-palette-item small { color: var(--muted); font-size: 12px; }
.workflow-add-palette { display: grid; gap: 8px; margin-top: 18px; }
.workflow-add-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed rgba(215, 25, 42, 0.28);
  border-radius: 14px;
  background: rgba(255, 245, 236, 0.72);
  color: var(--text-soft);
  text-align: left;
  cursor: grab;
}
.workflow-add-node:active { cursor: grabbing; }
.workflow-add-node strong { color: var(--text); font-size: 13px; }
.workflow-add-node small { color: var(--muted); font-size: 12px; }
.workflow-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.workflow-steps span {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.workflow-canvas-card { min-height: 560px; padding: 0; overflow: hidden; }
.workflow-canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf9 0%, #fff8f0 100%);
}
.workflow-toolbar-actions { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.workflow-zoom-val {
  min-width: 44px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-weight: 700;
}
.workflow-toolbar-actions span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 129, 40, 0.12);
  color: var(--accent-deep);
  font-weight: 700;
}
.workflow-board {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background:
    radial-gradient(circle at 16px 16px, rgba(215, 25, 42, 0.08) 1px, transparent 1.5px) 0 0 / 28px 28px,
    linear-gradient(135deg, #fffdf8 0%, #fff7ef 48%, #fff 100%);
  transition: box-shadow 0.15s, outline-color 0.15s;
  touch-action: none;
  cursor: grab;
}
.workflow-board:active { cursor: grabbing; }
/* 视口层：缩放 + 平移都通过 transform 实现，节点/连线坐标始终是布局坐标 */
.workflow-viewport {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}

/* ---- 全屏编辑模式：画布卡片占满整个屏幕，像专业工作流编辑器 ---- */
.workflow-canvas-card.workflow-canvas-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  display: flex;
  flex-direction: column;
}
.workflow-canvas-card.workflow-canvas-fullscreen .workflow-board {
  flex: 1;
  min-height: 0;
  min-height: 60vh;
}
.workflow-canvas-card.workflow-canvas-fullscreen .workflow-toolbar-actions { flex-wrap: wrap; }
.workflow-fullscreen-active { overflow: hidden; }
.workflow-board.is-dropping {
  outline: 2px dashed rgba(215, 25, 42, 0.34);
  outline-offset: -10px;
  box-shadow: inset 0 0 0 999px rgba(255, 129, 40, 0.04);
}
.workflow-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.workflow-line {
  fill: none;
  /* 纯色描边（不依赖 SVG 渐变）：渐变在动态画布里可能渲染失效导致线消失，纯色最稳 */
  stroke: #d7192a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 10px rgba(215, 25, 42, 0.14));
}
.workflow-line-created {
  stroke-width: 3;
  animation: workflowLineIn 0.18s ease-out;
  cursor: pointer;
  transition: stroke-width 0.12s;
  /* 允许点击连线本身（删除连线）；画布平移已排除连线目标 */
  pointer-events: auto;
}
.workflow-line-created:hover {
  stroke-width: 6;
  stroke-dasharray: 10 6;
}
/* 循环（回指）边：绿色虚线，一眼看出"审核不过→返工→再审" */
.workflow-line-feedback {
  stroke: #0b9960;
  stroke-dasharray: 8 6;
  filter: none;
}
.workflow-line-temp {
  fill: none;
  stroke: rgba(215, 25, 42, 0.55);
  stroke-width: 2;
  stroke-dasharray: 6 6;
  stroke-linecap: round;
  pointer-events: none;
}
@keyframes workflowLineIn { from { opacity: 0; } to { opacity: 1; } }
.workflow-canvas-nodes { position: absolute; inset: 0; }
.workflow-drop-hint {
  position: absolute;
  left: 22px;
  bottom: 18px;
  color: rgba(121, 107, 100, 0.78);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(236, 236, 240, 0.9);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  pointer-events: none;
}

/* 工作流节点卡片：改这里会影响画布上每个节点的外观。 */
.workflow-node {
  position: absolute;
  width: 180px;
  min-height: 104px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 26, 23, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 38px -28px rgba(91, 45, 24, 0.48);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
.workflow-node:hover { box-shadow: 0 26px 44px -28px rgba(91, 45, 24, 0.58); }
.workflow-node.dragging {
  z-index: 5;
  cursor: grabbing;
  box-shadow: 0 32px 56px -30px rgba(91, 45, 24, 0.72);
}
.workflow-node.line-pending {
  border-color: rgba(215, 25, 42, 0.48);
  box-shadow: 0 0 0 4px rgba(255, 129, 40, 0.12), 0 26px 44px -28px rgba(91, 45, 24, 0.58);
}
.workflow-node-added { animation: workflowNodeIn 0.18s ease-out; }
@keyframes workflowNodeIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
/* 节点头部：彩色图标 + 标题（Dify 风格） */
.workflow-node-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.workflow-node-icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--node-color, var(--accent-deep));
  box-shadow: 0 8px 16px -10px var(--node-color, var(--accent-deep));
}
.workflow-node-icon .ic { width: 16px; height: 16px; }
.workflow-node-kicker { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.workflow-node h4 { margin: 2px 0 0; font-size: 15px; }
.workflow-node p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
/* 节点选中高亮（Dify 风格蓝色外发光） */
.workflow-node.selected {
  border-color: #2d84ff;
  box-shadow: 0 0 0 3px rgba(45, 132, 255, 0.22), 0 26px 44px -28px rgba(91, 45, 24, 0.58);
  z-index: 3;
}
/* 条件分支：条件描述条 */
.workflow-branch-config {
  margin: 6px 0 8px;
  padding: 6px 10px;
  border: 1px dashed rgba(139, 92, 246, 0.4);
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.06);
  color: #6d28d9;
  font-size: 12px;
  cursor: text;
}
.workflow-branch-config-input {
  width: 100%;
  border: 1px solid #8b5cf6;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
}
/* 人工介入：提示条 */
.workflow-human-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 8px;
  padding: 6px 10px;
  border: 1px solid rgba(14, 116, 144, 0.35);
  border-radius: 8px;
  background: rgba(14, 116, 144, 0.07);
  color: #0e7490;
  font-size: 12px;
}
.workflow-human-note .ic { width: 13px; height: 13px; }

/* 容器框节点（迭代/循环）：虚线大框，内部放循环体子节点（Dify 风格） */
.workflow-node-container {
  border-style: dashed;
  border-width: 2px;
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(239, 246, 255, 0.55);
  min-height: 200px;
}
.workflow-node-loop { border-color: rgba(11, 153, 96, 0.5); background: rgba(236, 253, 245, 0.55); }
.workflow-node-container .workflow-node-head { padding-right: 20px; }
.workflow-container-config {
  margin: 4px 0 10px;
  padding: 5px 10px;
  border: 1px dashed rgba(37, 99, 235, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: #2563eb;
  font-size: 12px;
}
.workflow-container-body {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.workflow-subnode {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid rgba(31, 26, 23, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
}
.workflow-subnode .workflow-node-icon { width: 24px; height: 24px; border-radius: 7px; }
.workflow-subnode .workflow-node-icon .ic { width: 13px; height: 13px; }
.workflow-subnode strong { font-size: 13px; display: block; }
.workflow-subnode small { color: var(--muted); font-size: 11px; display: block; }
.workflow-subnode > div { flex: 1; min-width: 0; }
.workflow-subnode-remove {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
}
.workflow-subnode-remove:hover { color: var(--danger); }
.workflow-subnode-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.workflow-container-tip {
  margin: 10px 0 0 !important;
  font-size: 11px !important;
  color: var(--muted);
}

/* ---- 小地图（Dify 风格：画布右下角缩略图）---- */
.workflow-minimap {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 168px;
  height: 104px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(31, 26, 23, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 28px -16px rgba(31, 26, 23, 0.35);
  cursor: pointer;
  overflow: hidden;
  z-index: 4;
  pointer-events: auto;
}
.workflow-minimap-node {
  position: absolute;
  border-radius: 3px;
  opacity: 0.85;
  min-width: 4px;
  min-height: 4px;
}
.workflow-minimap-viewport {
  position: absolute;
  border: 1.5px solid rgba(45, 132, 255, 0.75);
  border-radius: 4px;
  background: rgba(45, 132, 255, 0.08);
  pointer-events: none;
}
.workflow-node-agent { border-color: rgba(215, 25, 42, 0.26); box-shadow: 0 24px 42px -26px rgba(215, 25, 42, 0.58); }
/* 所有节点统一白底，类型色体现在图标和边框，不单独给类型上米黄/浅色背景 */
.workflow-node-review,
.workflow-node-end,
.workflow-node-start,
.workflow-node-data,
.workflow-node-branch,
.workflow-node-human { background: rgba(255, 255, 255, 0.94); }
.workflow-node-end { border-color: rgba(255, 129, 40, 0.28); }
.workflow-handle {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(215, 25, 42, 0.24);
  cursor: crosshair;
  transform: translateY(-50%);
  z-index: 3;
}
/* 圆点视觉很小，用 ::after 把命中区域扩大到 30px，方便拖拽连线时松手命中 */
.workflow-handle::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
.workflow-handle:hover {
  background: var(--brand-red);
  box-shadow: 0 0 0 6px rgba(255, 129, 40, 0.16);
}
.workflow-handle-in { left: -6px; }
.workflow-handle-out { right: -6px; }
.workflow-node-pos-start { left: 6%; top: 70px; }
.workflow-node-pos-collect { left: 28%; top: 70px; }
.workflow-node-pos-draft { right: 5%; top: 70px; }
.workflow-node-pos-review { left: 38%; bottom: 56px; }
.workflow-node-pos-end { right: 5%; bottom: 56px; }

/* ---- 演示示例卡片：一键加载高级演示工作流 ---- */
.workflow-demo-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(215, 25, 42, 0.2);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, #fff 100%);
}
.workflow-demo-card div { display: grid; gap: 3px; min-width: 0; }
.workflow-demo-card strong { font-size: 13px; color: var(--text); }
.workflow-demo-card small { font-size: 12px; color: var(--muted); }
.workflow-demo-card .primary-button { flex: none; }

/* ---- 已保存工作流列表：左侧节点库下方 ---- */
.workflow-saved-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.workflow-saved-head h3 { margin: 0; font-size: 14px; color: var(--text-soft); }
.workflow-saved-count {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 800;
}
.workflow-saved-list { display: grid; gap: 8px; margin-top: 12px; }
.workflow-saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf9;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.workflow-saved-item:hover {
  border-color: rgba(215, 25, 42, 0.28);
  box-shadow: 0 12px 24px -20px rgba(215, 25, 42, 0.5);
}
.workflow-saved-item-main { display: grid; gap: 3px; min-width: 0; }
.workflow-saved-item-main strong { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workflow-saved-item-main small { font-size: 12px; color: var(--muted); }
.workflow-saved-item-delete {
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  font-size: 12px;
}
.workflow-saved-item-delete:hover { background: rgba(180, 35, 24, 0.06); }
.workflow-saved-empty { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 12px 0 0; }

/* ---- 工作流节点内部：删除按钮 + 智能体下拉框 ---- */
.workflow-node-delete {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(31, 26, 23, 0.06);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.workflow-node:hover .workflow-node-delete { opacity: 1; }
.workflow-node-delete:hover { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.workflow-node-agent-select {
  width: 100%;
  margin: 4px 0 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text-soft);
  font-size: 12px;
  outline: none;
}
.workflow-node-agent-select:focus { border-color: var(--accent); }
.workflow-node-title-input {
  width: 100%;
  margin: 0;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  outline: none;
}

@media (max-width: 960px) {
  .workflow-shell { grid-template-columns: 1fr; padding: 0 24px 40px; }
  .workflow-canvas-toolbar { align-items: flex-start; flex-direction: column; }
  .workflow-board { min-height: 680px; }
  .workflow-lines { display: none; }
  .workflow-node { position: relative; left: auto; right: auto; top: auto; bottom: auto; width: auto; margin: 14px 18px; }
}

@media (max-width: 560px) {
  #skills { padding-left: 0; }
}

/* ---- 整页自适应缩放 ----
   整个网站包在 #fitApp 里，JS 根据屏幕大小自动缩放，
   始终保证任何屏幕都能一屏看全，不用上下/左右滚动。 */

/* 打印时恢复原始大小，避免整页缩放把打印内容也缩小 */
@media print {
  #fitApp {
    transform: none !important;
    width: auto !important;
    height: auto !important;
  }
  html, body { overflow: visible !important; height: auto !important; }
  .site-footer { display: none !important; }
}
