:root {
  color-scheme: light;
  --bg: #f5f8fd;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --line: #e4ebf5;
  --soft: #f3f7fd;
  --primary: #2388f2;
  --primary-dark: #126fd0;
  --cyan: #20d5e6;
  --danger: #b42318;
  --success: #14804a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.plain-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.plain-card {
  width: min(100%, 420px);
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
}

.primary-link,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary-button:hover,
.primary-link:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(35, 136, 242, 0.18);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: #334155;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.ghost-button:hover {
  transform: translateY(-1px);
  border-color: #bad7ff;
  background: #f5f9ff;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid #ffd0ca;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff4f2;
  color: var(--danger);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.danger-button:hover {
  transform: translateY(-1px);
  border-color: #f2a79e;
}

.login-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(132deg, rgba(38, 223, 220, 0.84) 0 22%, transparent 22%),
    linear-gradient(90deg, #075bd9 0%, #079cdf 44%, #053bd0 70%, #001d9d 100%);
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  border-radius: 22px;
  opacity: 0.22;
  background: rgba(255, 255, 255, 0.42);
  transform: skewY(-18deg);
}

.login-page::before {
  width: 260px;
  height: 420px;
  left: 6%;
  bottom: -160px;
}

.login-page::after {
  width: 180px;
  height: 310px;
  right: 10%;
  top: 40px;
  background: rgba(49, 209, 232, 0.34);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 1180px);
  min-height: 640px;
  display: grid;
  grid-template-columns: 390px 1fr;
  border: 1px solid rgba(255, 255, 255, 0.56);
  background: #fff;
  box-shadow: 0 24px 50px rgba(0, 32, 120, 0.26);
}

.login-form-panel {
  position: relative;
  padding: 42px 34px 34px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  overflow: hidden;
}

.login-form-panel::before {
  content: "";
  position: absolute;
  width: 80px;
  height: 110px;
  left: 28px;
  bottom: -30px;
  background: linear-gradient(160deg, #68e1ef, #1095e8);
  clip-path: polygon(50% 0, 100% 64%, 60% 64%, 60% 100%, 40% 100%, 40% 64%, 0 64%);
  opacity: 0.85;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 74px;
  font-size: 14px;
  font-weight: 800;
  color: #334155;
  letter-spacing: 0;
}

.brand-mark {
  width: 22px;
  height: 28px;
  border: 2px solid #9b7b3b;
  border-radius: 4px 4px 2px 2px;
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 18px;
  border-radius: 3px;
  background: #9b7b3b;
}

.brand-mark::before { left: 5px; }
.brand-mark::after { right: 5px; }

.login-avatar {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0b65e6, #2fb7ff);
  position: relative;
  box-shadow: 0 8px 20px rgba(35, 136, 242, 0.28);
}

.login-avatar::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 18px;
  width: 28px;
  height: 18px;
  background: #102a73;
  clip-path: polygon(50% 0, 100% 34%, 50% 68%, 0 34%);
}

.login-avatar::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 31px;
  width: 20px;
  height: 18px;
  border-radius: 0 0 9px 9px;
  background: #f6c4a9;
  box-shadow: 0 12px 0 #102a73;
}

.login-title {
  margin: 0 0 54px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #3c4250;
}

.login-field {
  position: relative;
  margin-bottom: 14px;
}

.login-field label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.login-field input,
.login-field select {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid #ecf1f8;
  border-radius: 2px;
  color: #394150;
  background: #fff;
  box-shadow: 0 6px 18px rgba(13, 71, 161, 0.05);
}

.login-field input::placeholder { color: #b4bfce; }

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  opacity: 0.42;
}

.field-icon.user {
  border: 2px solid #9aa8bc;
  border-radius: 50%;
}

.field-icon.user::after {
  content: "";
  position: absolute;
  left: -5px;
  top: 11px;
  width: 21px;
  height: 11px;
  border: 2px solid #9aa8bc;
  border-radius: 12px 12px 0 0;
  border-bottom: 0;
}

.field-icon.lock {
  border: 2px solid #9aa8bc;
  border-radius: 3px;
  height: 12px;
  top: 55%;
}

.field-icon.lock::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -10px;
  width: 7px;
  height: 8px;
  border: 2px solid #9aa8bc;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.field-icon.code {
  border: 2px solid #9aa8bc;
  border-radius: 50%;
}

.field-icon.code::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  background: #9aa8bc;
  transform: rotate(45deg);
}

.captcha-code {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  object-fit: contain;
  font-weight: 800;
  color: #303746;
  font-size: 14px;
}

.login-field input[name="captcha"] { padding-right: 140px; }

.login-bottom {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
}

.login-bottom button {
  width: 160px;
  min-height: 42px;
  border: 0;
  border-radius: 22px;
  background: #2388f2;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(35, 136, 242, 0.28);
}

.login-help {
  color: #8fa1b9;
  text-decoration: none;
  font-size: 14px;
  text-align: right;
}

.login-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.login-error.is-ok {
  color: var(--success);
}

.illustration-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(244, 251, 255, 0.94), rgba(227, 246, 255, 0.96)),
    radial-gradient(circle at 70% 20%, rgba(35, 136, 242, 0.22), transparent 26%);
}

.slideshow {
  position: absolute;
  inset: 0;
}

.slides {
  position: absolute;
  inset: 0;
}

.slide {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.7s ease, transform 0.7s ease;
  pointer-events: none;
}

.slide.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(12, 74, 160, 0.16);
  background: #fff;
}

.slide-dots {
  position: absolute;
  right: 26px;
  bottom: 22px;
  display: flex;
  gap: 10px;
  z-index: 2;
}

.slide-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #cfe4fb;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
}

.slide-dot:hover {
  background: #9cc6f5;
}

.slide-dot.is-active {
  background: #1590f4;
  transform: scale(1.25);
}

@media (prefers-reduced-motion: reduce) {
  .slide {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .slide.is-active {
    transform: none;
  }
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* 顶栏 */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f6faff);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
}

.top-nav-item {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #445068;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.top-nav-item:first-child {
  font-weight: 700;
  color: #1765d8;
}

.top-nav-item:hover {
  background: #edf4ff;
  color: #1765d8;
}

.top-nav-item.is-active {
  background: linear-gradient(90deg, #226df2, #34a7eb);
  color: #fff;
}

.app-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 0 minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
}

.app-shell.has-sidebar .app-body {
  grid-template-columns: 248px minmax(0, 1fr);
}

/* root 端仍使用侧栏下钻布局 */
.app-shell.is-root-layout .app-body {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fd 100%);
  overflow: hidden;
}

.app-body > .sidebar {
  overflow-y: auto;
}

.app-shell:not(.has-sidebar):not(.is-root-layout) .sidebar {
  border-right: 0;
}

.sidebar-tree {
  flex: 1;
  overflow: hidden auto;
  position: relative;
  padding: 8px 10px 14px;
}

.drill-menu {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-height: 100%;
  animation: drillForward 0.2s ease-out both;
}

.drill-menu.is-back {
  animation-name: drillBack;
}

.drill-head {
  min-height: 38px;
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  color: #172033;
}

.drill-head strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}

.drill-back,
.drill-back-placeholder {
  min-width: 54px;
}

.drill-back {
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: #edf4ff;
  color: #1765d8;
  font-weight: 700;
}

.drill-back:hover {
  background: #dfeeff;
}

.drill-list {
  display: grid;
  align-content: start;
  gap: 6px;
}

.cascade-menu {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 100%;
}

.cascade-column {
  flex: 0 0 196px;
  width: 196px;
  display: grid;
  gap: 6px;
}

.cascade-column.is-root {
  position: relative;
  flex-basis: 200px;
  width: 200px;
}

.cascade-column.is-flyout {
  position: relative;
  padding: 10px;
  border: 1px solid rgba(207, 224, 246, 0.92);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(15, 78, 150, 0.16);
  backdrop-filter: blur(10px);
  animation: cascadeIn 0.18s ease-out both;
}

.cascade-item {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 12px 1fr 16px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  padding: 0 10px;
  text-align: left;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.cascade-item:hover,
.cascade-item.is-active {
  background: linear-gradient(90deg, #edf4ff, #f7fbff);
  color: #1765d8;
  transform: translateX(2px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.cascade-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c3d3e8;
}

.cascade-item.is-active .cascade-dot,
.cascade-item:hover .cascade-dot {
  background: var(--primary);
}

.cascade-arrow {
  color: #91a0b4;
  font-size: 18px;
  line-height: 1;
}

.cascade-item.has-children .cascade-arrow {
  color: #6e89aa;
}

.tree-count {
  color: #93a3b8;
  font-size: 12px;
}

.account-zone {
  position: relative;
  flex: 0 0 auto;
}

.account-button {
  min-height: 40px;
  display: grid;
  grid-template-columns: 32px auto auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  text-align: left;
  cursor: pointer;
}

.account-button:hover {
  background: #edf4fd;
}

.account-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef5ff;
  color: #2563eb;
  font-weight: 800;
}

.account-menu {
  position: absolute;
  right: 0;
  top: 46px;
  min-width: 160px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  z-index: 40;
}

.account-menu button,
.account-menu a {
  display: block;
  width: 100%;
  min-height: 36px;
  line-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  text-align: left;
  padding: 0 10px;
  text-decoration: none;
  cursor: pointer;
}

.account-menu button:hover,
.account-menu a:hover {
  background: #edf4ff;
}

.main-area {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 74px 1fr;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 6%, rgba(33, 213, 230, 0.12), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.main-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}

.main-topbar h1 {
  margin: 0 0 4px;
  font-size: 22px;
  color: #172033;
}

.main-topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.view-panel {
  min-height: 0;
  overflow: auto;
  padding: 28px 32px 40px;
}

.view-panel > * {
  animation: fadeUp 0.22s ease-out both;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.panel:hover {
  transform: translateY(-2px);
  border-color: #cfe1f7;
  box-shadow: 0 16px 34px rgba(15, 78, 150, 0.08);
}

.panel h2,
.panel h3 {
  margin: 0 0 10px;
}

.muted {
  color: var(--muted);
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.knowledge-doc-scroll {
  max-width: 100%;
}

.knowledge-doc-table {
  min-width: 920px;
}

.knowledge-chunk-table {
  min-width: 980px;
}

.knowledge-doc-table th,
.knowledge-doc-table td,
.knowledge-chunk-table th,
.knowledge-chunk-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.knowledge-doc-actions {
  min-width: 118px;
  align-items: flex-start;
}

.knowledge-doc-actions .ghost-button {
  width: 88px;
  padding: 0 8px;
  line-height: 1.25;
  text-align: center;
}

.user-admin-table {
  min-width: 1120px;
}

.user-actions {
  flex-wrap: nowrap;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.table tr:last-child td {
  border-bottom: 0;
}

.chat-layout {
  position: relative;
  height: calc(100vh - 142px);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
}

.chat-messages {
  position: relative;
  z-index: 1;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 18px;
}

/* ===== 形象舞台：对话开始前居中，开始后虚化为背景 ===== */
.avatar-stage {
  position: absolute;
  inset: 0 0 auto 0;
  top: 0;
  bottom: 74px;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
  transition: opacity 0.4s ease, filter 0.4s ease;
}

/* 已有消息（普通文字对话）：形象淡化虚化作为背景 */
.chat-layout[data-empty="0"]:not(.is-voice-mode) .avatar-stage {
  opacity: 0.1;
  filter: blur(3px) grayscale(0.2);
}
.chat-layout[data-empty="0"]:not(.is-voice-mode) .avatar-hint,
.chat-layout[data-empty="0"]:not(.is-voice-mode) .voice-live-status {
  display: none;
}

.avatar-orb {
  position: relative;
  display: grid;
  place-items: center;
}

.avatar-hint {
  margin: 0;
  font-size: 15px;
  color: #52627a;
}

.voice-live-status {
  margin: 0;
  max-width: 460px;
  text-align: center;
  min-height: 20px;
}

/* 语音模式下形象下方同步显示的回答文字 */
.voice-answer-text {
  pointer-events: auto;
  width: min(680px, 86%);
  max-height: 30vh;
  overflow: auto;
  margin-top: 4px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: #223047;
  line-height: 1.7;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}
/* 仅在语音模式显示该文字块 */
.chat-layout:not(.is-voice-mode) .voice-answer-text { display: none; }

/* ===== 圆形形象 ===== */
.agent-face {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: #eef3fb;
  flex: none;
}
.agent-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.agent-face-sm { width: 34px; height: 34px; }
.agent-face-md { width: 46px; height: 46px; }
.agent-face-lg {
  width: 168px;
  height: 168px;
  border: 4px solid #fff;
  box-shadow: 0 18px 40px rgba(23, 101, 216, 0.28);
}

/* 说话时形象轻微呼吸 */
.chat-layout.is-speaking .agent-face-lg {
  animation: avatar-breathe 1.4s ease-in-out infinite;
}
@keyframes avatar-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

/* ===== 语音波浪 ===== */
.voice-wave {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.voice-wave.is-active { opacity: 1; }
.voice-wave i {
  width: 5px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--cyan));
}
.voice-wave.is-active i {
  animation: voice-bar 0.9s ease-in-out infinite;
}
.voice-wave i:nth-child(2) { animation-delay: 0.1s; }
.voice-wave i:nth-child(3) { animation-delay: 0.2s; }
.voice-wave i:nth-child(4) { animation-delay: 0.3s; }
.voice-wave i:nth-child(5) { animation-delay: 0.2s; }
.voice-wave i:nth-child(6) { animation-delay: 0.1s; }
@keyframes voice-bar {
  0%, 100% { height: 8px; }
  50% { height: 26px; }
}

/* ===== 语音对话模式：形象居中，隐藏输入框 ===== */
.chat-layout.is-voice-mode .chat-messages { display: none; }
.chat-layout.is-voice-mode .avatar-stage {
  bottom: 88px;
  opacity: 1;
  filter: none;
}
.chat-layout.is-voice-mode .chat-input { display: none; }
/* 语音模式下形象可点击（用于手动打断） */
.chat-layout.is-voice-mode .avatar-orb {
  pointer-events: auto;
  cursor: pointer;
}
/* 智能体思考/朗读时，形象有可打断的高亮提示 */
.chat-layout.is-voice-mode.is-speaking .avatar-face-lg,
.chat-layout.is-voice-mode.is-speaking .agent-face-lg {
  box-shadow: 0 0 0 6px rgba(23, 101, 216, 0.18), 0 18px 40px rgba(23, 101, 216, 0.28);
}

/* ===== 显眼的语音对话按钮 ===== */
.voice-mode-btn {
  position: absolute;
  right: 18px;
  bottom: 92px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  box-shadow: 0 12px 26px rgba(23, 101, 216, 0.32);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.voice-mode-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 32px rgba(23, 101, 216, 0.4); }
.voice-mode-btn .voice-mode-icon { font-size: 18px; }
.chat-layout.is-voice-mode .voice-mode-btn {
  right: 50%;
  transform: translateX(50%);
  bottom: 28px;
  background: linear-gradient(90deg, #ef4444, #f97316);
  box-shadow: 0 12px 26px rgba(239, 68, 68, 0.34);
}
.chat-layout.is-voice-mode .voice-mode-btn:hover { transform: translateX(50%) translateY(-1px); }

/* ===== 创建 Agent：形象选择网格 ===== */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.avatar-option {
  aspect-ratio: 1;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: #f2f7ff;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.avatar-option:hover { transform: scale(1.06); }
.avatar-option img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.avatar-option.is-selected { border-color: var(--primary); }
.avatar-upload {
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
  color: #1765d8;
}
.avatar-upload.has-image .avatar-plus { display: none; }
.avatar-plus { font-size: 26px; font-weight: 300; }

.message {
  width: fit-content;
  max-width: min(760px, 86%);
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.6;
}

.message.user {
  margin-left: auto;
  color: #fff;
  background: var(--primary);
}

.message.assistant {
  background: #f0f6ff;
  color: #223047;
}

.message-body > :first-child {
  margin-top: 0;
}

.message-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p {
  margin: 0 0 8px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 8px 20px;
  padding: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(20, 48, 84, 0.08);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  max-width: 100%;
  overflow: auto;
  margin: 8px 0;
  padding: 10px;
  border-radius: 8px;
  background: #152033;
  color: #f6f8fb;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}

.markdown-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.markdown-table th,
.markdown-table td {
  border: 1px solid rgba(20, 48, 84, 0.16);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}

.markdown-table th {
  background: rgba(23, 101, 216, 0.08);
  font-weight: 600;
}

.markdown-table tr:nth-child(even) td {
  background: rgba(20, 48, 84, 0.03);
}

.markdown-body blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 3px solid rgba(23, 101, 216, 0.4);
  color: #5b6b80;
}

.markdown-body .math-inline {
  padding: 0 2px;
  font-family: "Cambria Math", Georgia, serif;
  font-style: italic;
}

.markdown-body .math-block {
  margin: 10px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(23, 101, 216, 0.06);
  text-align: center;
  font-family: "Cambria Math", Georgia, serif;
  font-style: italic;
  font-size: 15px;
  overflow-x: auto;
}

.message-image {
  display: block;
  width: min(220px, 100%);
  max-height: 160px;
  object-fit: cover;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.38);
}

.message.assistant .message-image {
  border-color: #cfe1f7;
}

.thinking-message {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #1765d8;
  animation: thinking-dot 0.9s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes thinking-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.thinking-message {
  display: block;
}

.thinking-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reasoning-panel {
  margin: 0 0 8px;
  border-left: 2px solid rgba(23, 101, 216, 0.28);
  padding-left: 10px;
}

.reasoning-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: #6b7a90;
  font-size: 12px;
  cursor: pointer;
}

.reasoning-toggle:hover {
  color: #1765d8;
}

.reasoning-toggle-icon {
  transition: transform 0.28s ease;
}

.reasoning-panel.is-collapsed .reasoning-toggle-icon {
  transform: rotate(-90deg);
}

.reasoning-content {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.32s ease, opacity 0.28s ease;
  opacity: 1;
}

.reasoning-panel.is-collapsed .reasoning-content {
  grid-template-rows: 0fr;
  opacity: 0;
}

.reasoning-inner {
  overflow: hidden;
  min-height: 0;
  color: #7a8698;
  font-size: 12.5px;
  line-height: 1.55;
  padding: 4px 0;
}

.reasoning-inner p {
  margin: 0 0 5px;
}

@media (prefers-reduced-motion: reduce) {
  .reasoning-content,
  .reasoning-toggle-icon {
    transition: none;
  }
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
}

.chat-input.is-voice-mode {
  grid-template-columns: 1fr;
}

/* Voice workspace */
.chat-layout { grid-template-rows: minmax(160px, 1fr) auto auto; }
.chat-layout.has-back-bar { grid-template-rows: auto minmax(160px, 1fr) auto auto; }
.chat-layout.has-back-bar > .chat-back-bar { grid-row: 1; margin-bottom: 0; }
.voice-console { position: relative; z-index: 2; border: 1px solid #d9e5f4; border-radius: 14px; padding: 12px 14px; background: #fff; box-shadow: 0 4px 16px rgba(34, 65, 110, .04); }
.voice-toolbar, .voice-transport, .recording-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.voice-toolbar { margin-bottom: 9px; }
.voice-transport .ghost-button, .voice-toolbar .ghost-button, .message-actions .ghost-button { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.voice-console .voice-mode-btn, .chat-layout.is-voice-mode .voice-console .voice-mode-btn { position: static; transform: none; padding: 8px 12px; box-shadow: none; font-size: 13px; }
.voice-console .voice-mode-btn:hover, .chat-layout.is-voice-mode .voice-console .voice-mode-btn:hover { transform: none; box-shadow: none; }
.voice-console button:disabled { opacity: .45; cursor: not-allowed; }
.voice-mode-btn.is-on { background: #dc4c4c; }
.voice-service-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 11px; color: #52647c; background: #eef3f9; white-space: nowrap; }
.voice-service-badge.is-ready { color: #147654; background: #e7f7ef; }
.voice-clock { font: 12px ui-monospace, monospace; color: #b93b49; }
.voice-toolbar .is-recording { color: #b92e46; border-color: #eab8c1; background: #fff0f3; }
.voice-status { min-height: 18px; margin: 9px 0 0; color: #52647c; font-size: 12px; line-height: 1.5; }
.voice-settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; padding: 12px 0; margin: 8px 0; border-top: 1px solid #edf1f6; border-bottom: 1px solid #edf1f6; }
.voice-settings-grid label, .speech-admin-grid > label { display: grid; gap: 7px; color: #52647c; font-size: 12px; }
.voice-settings-grid select, .speech-admin-grid select, .speech-admin-grid input:not([type="checkbox"]) { width: 100%; min-width: 0; height: 36px; padding: 6px 9px; border: 1px solid #d8e2f0; border-radius: 8px; background: #fbfdff; color: #283e58; }
.voice-settings-grid input[type="range"] { width: 100%; accent-color: #2273d9; }
.voice-settings-grid output { color: #1765d8; font-size: 11px; }
.voice-settings-grid .voice-check, .speech-admin-grid .voice-check { display: flex; align-items: center; gap: 8px; }
.voice-check input { accent-color: #2273d9; }
.voice-settings-note { grid-column: 1 / -1; margin: 0; font-size: 11px; line-height: 1.6; }
.recording-preview { margin-top: 10px; padding: 10px; border-radius: 10px; background: #f3f7fc; }
.recording-preview audio { width: min(260px, 100%); height: 35px; }
.recording-preview .ghost-button, .recording-preview .primary-button { padding: 7px 10px; font-size: 12px; }
.message-actions { display: flex; margin-top: 10px; }
.chat-layout.is-voice-mode .chat-input { display: grid; grid-template-columns: 1fr auto; }
.chat-layout.is-voice-mode .avatar-stage { position: relative; inset: auto; grid-row: 1; min-height: 160px; gap: 8px; overflow: auto; }
.chat-layout.is-voice-mode .agent-face-lg { width: 110px; height: 110px; }
.chat-layout.is-voice-mode .voice-answer-text { max-height: 18vh; font-size: 13px; }
.chat-layout.is-voice-mode .avatar-hint { font-size: 12px; }
.chat-layout.is-voice-mode .voice-console { grid-row: 2; }
.chat-layout.is-voice-mode .chat-input { grid-row: 3; }
.chat-layout.has-back-bar.is-voice-mode .avatar-stage { grid-row: 2; }
.chat-layout.has-back-bar.is-voice-mode .voice-console { grid-row: 3; }
.chat-layout.has-back-bar.is-voice-mode .chat-input { grid-row: 4; }
.speech-admin-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.speech-admin-heading h2 { margin: 0 0 8px; }
.speech-admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 850px; }
.speech-admin-grid .speech-wide { grid-column: 1 / -1; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .voice-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voice-console { padding: 10px; }
  .voice-service-badge { margin-left: 0; }
  .voice-toolbar, .voice-transport { gap: 6px; }
  .speech-admin-grid { grid-template-columns: minmax(0, 1fr); }
  .speech-admin-heading { flex-direction: column; }
  .chat-layout { height: auto; min-height: calc(100dvh - 150px); grid-template-rows: minmax(180px, 1fr) auto auto; }
  .chat-messages { min-height: 200px; max-height: 50dvh; }
}

.chat-compose {
  display: grid;
  gap: 10px;
}

.preview-tray {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 8px;
  border: 1px solid #cfe1f7;
  border-radius: 10px;
  background: #f8fbff;
  color: #52627a;
  font-size: 13px;
}

.preview-tray img {
  width: 72px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
}

.chat-input textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 0;
  outline: 0;
  color: #223047;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid #cfe1f7;
  border-radius: 999px;
  padding: 0 12px;
  color: #1765d8;
  background: #f2f7ff;
  font-size: 13px;
  overflow: hidden;
}

.file-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.voice-toggle.is-on {
  border-color: #1765d8;
  color: #fff;
  background: #1765d8;
}

.thinking-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  color: #52627a;
  font-size: 13px;
}

.thinking-select select {
  min-height: 30px;
  border: 1px solid #cfe1f7;
  border-radius: 999px;
  padding: 0 10px;
  color: #1765d8;
  background: #f2f7ff;
  outline: 0;
}

.upload-form {
  display: grid;
  gap: 12px;
  max-width: 560px;
}

.upload-form input[type="text"],
.upload-form input[type="url"],
.upload-form input[type="date"],
.upload-form input[type="file"],
.upload-form textarea,
.comment-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.upload-form textarea {
  min-height: 96px;
  resize: vertical;
}

.compact-input {
  width: min(100%, 150px);
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
}

.is-deleted {
  opacity: 0.58;
}

.report-box {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px 12px;
}

.report-box summary {
  cursor: pointer;
  color: #1765d8;
}

.report-box pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  color: #263244;
  line-height: 1.6;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #e8eef7;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}

/* 带百分比/文字标签的进度条（上传、入库、批改） */
.progress-track {
  position: relative;
  height: 20px;
  margin: 10px 0 4px;
  border-radius: 999px;
  background: #e8eef7;
  overflow: hidden;
}

.progress-track > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  transition: width 0.3s ease;
}

.progress-track .progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-style: normal;
  color: #1c3a5e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  text-align: center;
  color: var(--muted);
}

.task-comment {
  border-left: 3px solid #cfe4ff;
  padding-left: 10px;
  color: #475569;
  margin: 8px 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.checkbox-grid label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.home-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 20px;
  min-height: 210px;
  padding: 26px;
  border: 1px solid #cfe5ff;
  border-radius: 14px;
  background:
    radial-gradient(circle at 86% 22%, rgba(32, 213, 230, 0.26), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #edf7ff 54%, #e8fcff 100%);
  box-shadow: 0 22px 46px rgba(15, 78, 150, 0.1);
}

.home-hero h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.home-hero p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.8;
}

.home-visual {
  position: relative;
  min-height: 160px;
}

.home-tower,
.home-block,
.home-ring {
  position: absolute;
  border-radius: 14px;
  background: linear-gradient(145deg, #59dff0, #2379ee);
  box-shadow: 0 18px 34px rgba(35, 136, 242, 0.22);
}

.home-tower {
  right: 46px;
  bottom: 16px;
  width: 72px;
  height: 138px;
}

.home-block {
  right: 112px;
  bottom: 24px;
  width: 88px;
  height: 82px;
  transform: skewY(-10deg);
}

.home-ring {
  right: 8px;
  bottom: 28px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #effcff 0 38%, #2aa5ef 39% 100%);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.dashboard-card {
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-card:hover {
  transform: translateY(-3px);
  border-color: #cfe1f7;
  box-shadow: 0 18px 38px rgba(15, 78, 150, 0.1);
}

.dashboard-card strong {
  display: block;
  margin-bottom: 8px;
  color: #172033;
  font-size: 16px;
}

.dashboard-number {
  display: block;
  margin-top: 10px;
  color: var(--primary);
  font-size: 30px;
  font-weight: 800;
}

@keyframes cascadeIn {
  from {
    opacity: 0;
    transform: translateX(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

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

@keyframes drillBack {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

@media (max-width: 900px) {
  .login-card {
    min-height: auto;
    grid-template-columns: 1fr;
    width: min(100%, 440px);
  }

  .illustration-panel { display: none; }
  .brand { margin-bottom: 52px; }
  .login-form-panel { padding: 32px 24px 40px; }

  .app-body,
  .app-shell.has-sidebar .app-body,
  .app-shell.is-root-layout .app-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-tree {
    max-height: 360px;
    overflow: auto;
  }

  .drill-menu {
    min-height: auto;
  }

  .cascade-menu {
    display: block;
  }

  .cascade-column,
  .cascade-column.is-root {
    width: 100%;
    flex-basis: auto;
  }

  .cascade-column.is-flyout {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .main-area {
    grid-template-rows: auto 1fr;
  }

  .main-topbar,
  .view-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .home-hero {
    grid-template-columns: 1fr;
  }

  .home-visual {
    display: none;
  }
}

@media (max-width: 420px) {
  .login-page { padding: 16px; }
  .login-bottom {
    grid-template-columns: 1fr;
  }
  .login-bottom button {
    width: 100%;
  }
  .login-help {
    text-align: center;
  }
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 30, 60, 0.42);
}

.modal-card {
  width: min(100%, 420px);
  padding: 22px 22px 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(12, 40, 90, 0.28);
  animation: modal-pop 0.2s ease;
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #172033;
}

.modal-field {
  display: block;
  margin: 14px 0 0;
  font-size: 13px;
  color: #5b6b80;
}

.modal-field select,
.modal-field input {
  width: 100%;
  height: 40px;
  margin-top: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  background: #fff;
}

.modal-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: #d23b3b;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.course-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.course-pick-item {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #26364c;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.course-pick-item:hover {
  background: #edf4ff;
  border-color: #b9d4ff;
}

/* ---------- Agent 侧栏 ---------- */
.agent-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px;
}

.create-agent-btn {
  width: 100%;
  min-height: 42px;
  border: 1px dashed #9cc2f5;
  border-radius: 10px;
  background: #f2f8ff;
  color: #1765d8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease;
}

.create-agent-btn:hover {
  background: #e4f0ff;
}

.agent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-list-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 8px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.16s ease;
}

.agent-list-item:hover {
  background: #eef5ff;
}

.agent-list-item.is-active {
  background: linear-gradient(90deg, #e7f1ff, #f5faff);
  box-shadow: inset 3px 0 0 #1765d8;
}

.agent-open {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  min-width: 0;
  text-align: left;
}

.agent-avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #226df2, #34d7eb);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.agent-name {
  font-size: 14px;
  color: #26364c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-meta {
  position: absolute;
  left: 8px;
  right: 34px;
  top: 100%;
  z-index: 5;
  margin-top: 2px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #172033;
  color: #dce6f5;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.agent-list-item:hover .agent-meta {
  opacity: 1;
}

.agent-delete {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #97a4b8;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.agent-list-item:hover .agent-delete {
  opacity: 1;
}

.agent-delete:hover {
  background: #ffe6e6;
  color: #d23b3b;
}

.agent-empty {
  padding: 8px 6px;
  font-size: 13px;
}

/* ---------- Agent 欢迎首屏 ---------- */
.agent-hero {
  max-width: 680px;
  margin: 8vh auto 0;
  padding: 0 20px;
  text-align: center;
}

.agent-hero-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(145deg, #226df2, #34d7eb);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  box-shadow: 0 16px 34px rgba(35, 136, 242, 0.28);
}

.agent-hero-title {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.4;
  color: #172033;
}

.agent-hero-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.chat-back-bar {
  margin-bottom: 10px;
}

/* ---------- 批改报告 ---------- */
.report-card {
  margin: 10px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.report-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.score-badge {
  display: inline-flex;
  align-items: baseline;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(145deg, #226df2, #34a7eb);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
}

.review-tag {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.review-tag.is-flag {
  background: #fff2e3;
  color: #b5651d;
}

.review-tag.is-requested {
  background: #ffe6e6;
  color: #d23b3b;
}

.review-tag.is-done {
  background: #e6f6ec;
  color: #2f9e5f;
}

.report-summary {
  margin: 4px 0 10px;
  color: #26364c;
}

.report-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-q {
  padding: 8px 10px;
  border-radius: 8px;
  border-left: 3px solid #c3d3e8;
  background: #f7fafe;
}

.report-q.is-correct { border-left-color: #2f9e5f; }
.report-q.is-wrong { border-left-color: #d23b3b; }

.report-q-head {
  font-weight: 600;
  color: #26364c;
  margin-bottom: 4px;
}

.report-q-line {
  font-size: 13px;
  line-height: 1.55;
  color: #3a4a5f;
}

.report-risks {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff6ed;
  color: #7a5326;
  font-size: 13px;
}

.report-risks ul {
  margin: 4px 0 0 18px;
  padding: 0;
}

.report-full {
  margin-top: 10px;
}

.report-full summary {
  cursor: pointer;
  color: #1765d8;
  font-size: 13px;
}

.grade-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.submission-files {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
}

.submission-file {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7fafe;
  color: #1765d8;
  font-size: 13px;
  text-decoration: none;
}

.submission-file:hover {
  background: #e9f2ff;
  border-color: #b9d4ff;
}

.grade-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fafe;
}

.grade-check-all,
.grade-strictness {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #26364c;
}

.grade-strictness select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.grade-sub-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-sub-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

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

.grade-sub-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.grade-sub-empty {
  margin: 8px 0 0;
}

.grade-reports {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-report-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.grade-report-student {
  font-weight: 600;
  color: #26364c;
  padding-top: 18px;
}

@media (max-width: 720px) {
  .grade-report-row {
    grid-template-columns: 1fr;
  }
  .grade-report-student {
    padding-top: 0;
  }
}

/* Knowledge inspection and reviewed grading workflow */
.workflow-steps { display: flex; flex-wrap: wrap; gap: 12px 30px; padding: 18px 18px 18px 36px; background: #f4f7fc; border-radius: 12px; line-height: 1.7; }
.workflow-toolbar, .workflow-heading, .workflow-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 18px 0; }
.workflow-heading { justify-content: space-between; }
.workflow-heading h2 { margin: 0; }
.workflow-toolbar label, .workflow-settings label { display: flex; align-items: center; gap: 8px; }
.workflow-settings input { width: 120px; }
.workflow-label, .workflow-question label { display: grid; gap: 7px; margin: 12px 0; }
.workflow-label textarea, .workflow-question textarea, .workflow-question input { width: 100%; box-sizing: border-box; }
.workflow-job { border: 1px solid #dae2ed; border-radius: 12px; padding: 16px; margin: 14px 0; overflow-wrap: anywhere; }
.workflow-job progress { width: 100%; height: 12px; accent-color: #3767d6; }
.workflow-job li { margin: 8px 0; }
.workflow-job details, .knowledge-chunk { margin: 12px 0; }
.workflow-job summary, .knowledge-chunk summary { cursor: pointer; }
.workflow-warning { color: #8a4b08; background: #fff8ea; padding: 10px 14px; border-radius: 8px; overflow-wrap: anywhere; }
ul.workflow-warning { padding-left: 32px; }
.knowledge-full-text, .knowledge-chunk pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font: 14px/1.9 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 18px; background: #f6f8fb; border: 1px solid #dce3ee; border-radius: 10px; }
.knowledge-full-text { max-height: 640px; overflow-y: auto; }
.knowledge-full-text mark { background: #ffe071; }
.knowledge-source, .workflow-source { padding: 14px 0; border-bottom: 1px solid #e7ebf2; }
.knowledge-original-image { max-width: 100%; height: auto; }
.knowledge-chunk { border-bottom: 1px solid #e7ebf2; padding: 10px 0; }
.workflow-config { margin-top: 24px; }
.workflow-dialog { width: min(780px, calc(100vw - 32px)); max-height: 88vh; box-sizing: border-box; overflow-y: auto; padding: 24px; border: 1px solid #dce3ee; border-radius: 16px; color: inherit; }
.workflow-dialog::backdrop { background: #17213799; }
.workflow-question { border: 1px solid #dce3ee; border-radius: 10px; margin: 16px 0; padding: 14px; min-width: 0; }
.workflow-question .workflow-settings input { width: 110px; }
.grade-sub-report summary { cursor: pointer; padding: 8px 0; }
@media (max-width: 700px) {
  .workflow-steps { display: block; }
  .workflow-steps li { margin: 8px 0; }
  .workflow-toolbar { align-items: stretch; }
  .workflow-toolbar input[type="search"] { min-width: 0; width: 100%; }
  .workflow-dialog { padding: 16px; }
  .grade-sub-head { flex-wrap: wrap; }
  .grade-sub-head a { max-width: 100%; overflow-wrap: anywhere; }
}
.knowledge-material-table { min-width: 680px; }
.knowledge-material-table th:first-child { width: 55px; }
.knowledge-material-table td:last-child .ghost-button { white-space: nowrap; }
.knowledge-material-table td:nth-child(2) { min-width: 140px; }
.knowledge-material-table td:nth-child(3) { min-width: 230px; }
.workflow-settings input, .workflow-settings select, .workflow-toolbar input[type="search"], .workflow-question input, .workflow-label textarea, .workflow-question textarea { border: 1px solid #cfd9e7; border-radius: 8px; padding: 9px 10px; color: #253754; background: #fff; font: inherit; }
.workflow-label textarea { resize: vertical; }
.report-q.is-partial { border-left-color: #d49a25; }
.knowledge-pdf-page { display: block; width: 100%; border: 1px solid #dce3ee; border-radius: 8px; background: #fff; }
.knowledge-pdf-page[hidden] { display: none; }
#pdfPageNumber { width: 90px; padding: 8px; }
