:root {
  --bg: #f2f5f9;
  --sidebar: #001b31;
  --sidebar-deep: #001426;
  --sidebar-text: #aebdcc;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #202a3a;
  --muted: #6b7687;
  --subtle: #96a0ae;
  --line: #e6ebf2;
  --line-strong: #d3dbe8;
  --primary: #2667f5;
  --primary-dark: #1e55d6;
  --primary-soft: #eef4ff;
  --green: #0e8f68;
  --amber: #9a6700;
  --danger: #ff3028;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
}

.loginPage {
  min-height: 100vh;
  background: linear-gradient(180deg, #f7faff 0%, #eef3f9 100%);
  display: flex;
  flex-direction: column;
}

.loginShell {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.loginCard .brandRow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}


.loginCard .brandRow strong,
.loginCard .brandRow span {
  display: block;
}

.loginCard .brandRow strong {
  font-size: 17px;
  font-weight: 900;
  color: #0f2746;
}

.loginCard .brandRow span {
  color: var(--muted);
  margin-top: 4px;
}

.loginCard h1 {
  font-size: 26px;
  line-height: 1.2;
  margin-bottom: 10px;
}

.loginCard p {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 22px;
}

.loginCard form {
  display: grid;
  gap: 14px;
}

.loginCard button {
  height: 42px;
}

.loginMessage {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 226px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #092b49;
  z-index: 10;
}

.brand {
  height: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 20px;
  background: var(--sidebar-deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}


.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: #fff;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 800;
}

.brand span {
  color: #b5c5d5;
  font-size: 13px;
  margin-top: 4px;
}

.sideNav {
  display: grid;
  gap: 0;
  padding: 0;
}

.sideNav a {
  position: relative;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--sidebar-text);
  font-weight: 700;
  padding: 0 18px 0 42px;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sideNav a::before {
  content: "";
  position: absolute;
  left: 18px;
  width: 11px;
  height: 11px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
  opacity: 0.9;
}

.sideNav a::after {
  content: "";
  position: absolute;
  right: 18px;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.55;
}

.sideNav a:hover {
  background: rgba(38, 103, 245, 0.16);
  color: #fff;
}

.sideNav a.active {
  background: var(--primary);
  border-left-color: #83adff;
  color: #fff;
}

.adminSubNav {
  display: none;
  gap: 4px;
  padding: 8px 14px 14px 34px;
  background: rgba(0, 20, 38, 0.34);
}

body.admin-active .adminSubNav {
  display: grid;
}

.adminSubNav button {
  position: relative;
  min-height: 34px;
  justify-content: flex-start;
  border-radius: 3px;
  background: transparent;
  color: #b8c8d8;
  padding: 0 10px 0 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.adminSubNav button:hover {
  background: rgba(38, 103, 245, 0.18);
  color: #fff;
}

.adminSubNav button.active {
  background: rgba(38, 103, 245, 0.28);
  color: #fff;
}

.adminSubNav button.active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: #83adff;
}

.sideFooter {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.13);
}

.sideAdminLogin {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(174, 189, 204, 0.3);
  border-radius: 6px;
  color: #d5e1ed;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
}

.sideAdminLogin:hover {
  color: #fff;
  border-color: rgba(131, 173, 255, 0.56);
  background: rgba(38, 103, 245, 0.18);
}

body.admin-active .sideAdminLogin,
body.admin-user .sideAdminLogin {
  display: none;
}

.sideStatus {
  color: #a9b8c9;
  font-size: 12px;
  line-height: 1.55;
  padding: 0 2px;
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 226px;
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px 0 22px;
  z-index: 8;
}

.crumb {
  height: 40px;
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 800;
  border-radius: 2px;
  background: #eef4ff;
}

.topTools {
  display: flex;
  align-items: center;
  gap: 22px;
  color: #8a8f99;
  font-size: 13px;
}

.topTools strong {
  color: #2c3442;
  font-size: 14px;
}

.topAccount {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
}

.topAccount[hidden] {
  display: none;
}

.topAccount strong {
  color: #12335d;
  font-size: 13px;
  white-space: nowrap;
}

.topAccount .small {
  min-height: 30px;
  padding: 0 10px;
}

.mainShell {
  margin-left: 226px;
  min-height: 100vh;
  padding: 88px 22px 24px;
  display: flex;
  flex-direction: column;
}

.siteFooter {
  margin-top: auto;
  padding: 28px 16px 4px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.siteFooter a {
  color: inherit;
  text-decoration: none;
}

.siteFooter a:hover,
.siteFooter a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.loginFooter {
  flex: 0 0 auto;
  width: 100%;
  padding: 0 16px 20px;
}

.page {
  display: none;
  max-width: none;
}

.page.active {
  display: block;
}

.pageHeader {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  padding: 0 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pageHeader h1 {
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
  font-weight: 800;
}

.pageHeader p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

body.portal-active .topbar {
  height: 56px;
  padding-right: 22px;
}

body.portal-active .crumb {
  display: flex;
  min-width: 0;
  height: auto;
  padding: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  color: #162f51;
  background: transparent;
  border-radius: 0;
}

body.portal-active #crumbTitle {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}

body.portal-active .mainShell {
  padding-top: 72px;
}

body.portal-active .pageHeader {
  display: none;
}

body.admin-active .adminLayout {
  padding: 12px;
}

body.admin-active #admin-pool > .sectionHeader {
  margin-bottom: 8px;
}

body.admin-active #admin-pool > .sectionHeader h2 {
  font-size: 20px;
}

body.admin-active .poolToolbar {
  padding: 8px;
  margin-bottom: 8px;
}

body.admin-active .poolNotice {
  padding: 8px 10px;
  margin-bottom: 8px;
}

.page-entry.active {
  display: grid;
  min-height: calc(100vh - 112px);
  align-items: center;
}

.entryShell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 10px;
}

.entryHeader {
  margin-bottom: 22px;
}

.entryKicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #cdd9ea;
  border-radius: 4px;
  color: #264c7f;
  background: #f8fbff;
  font-size: 13px;
  font-weight: 800;
}

.entryHeader h1 {
  margin-top: 14px;
  color: #142033;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0;
}

.entryHeader p {
  width: min(620px, 100%);
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

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

.entryCard {
  position: relative;
  min-height: 226px;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.entryCard:hover {
  transform: translateY(-2px);
  border-color: #9bb4d9;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.entryCard:focus-visible {
  outline: 3px solid rgba(38, 103, 245, 0.26);
  outline-offset: 3px;
}

.entryRole {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 900;
}

.teacherEntry .entryRole {
  color: #115c68;
  background: #e9f8f8;
}

.consultantEntry .entryRole {
  color: #73510b;
  background: #fff4d8;
}

.entryCard strong {
  color: #17243a;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 900;
}

.entryCard p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.entryCard em {
  margin-top: auto;
  color: var(--primary);
  font-style: normal;
  font-weight: 900;
}

.entryAdminLink {
  width: fit-content;
  display: inline-flex;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.entryAdminLink:hover {
  color: var(--primary);
}

.chips span,
.itemHead span {
  border: 1px solid #dce5f4;
  border-radius: 4px;
  color: var(--primary);
  font-size: 12px;
  padding: 5px 9px;
  white-space: nowrap;
  background: #f8fbff;
}

.panel,
.adminLayout {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.panel {
  padding: 22px;
}

.generatorCard {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(330px, 0.9fr) minmax(360px, 1fr);
  grid-template-areas:
    "board input result";
  gap: 18px 24px;
  align-items: start;
}

.generatorCard .categoryBoard {
  grid-area: board;
}

.generatorCard .inputBoard {
  grid-area: input;
}

.generatorCard .result {
  grid-area: result;
  min-height: 536px;
}

.categoryBoard,
.inputBoard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 536px;
  padding: 14px;
}

.boardHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.boardHead strong {
  display: block;
  font-size: 15px;
}

.boardHead span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.categoryBoardList {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.categoryGroup {
  display: grid;
  gap: 6px;
}

.categoryGroup.expanded {
  padding-bottom: 4px;
}

.categoryPill {
  min-height: 38px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
  color: #334155;
  padding: 0 10px;
  text-align: left;
  font-weight: 800;
}

.categoryPill:hover {
  background: #eef4ff;
  border-color: #c8d8fb;
  color: var(--primary);
}

.categoryPill em {
  min-width: 24px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-style: normal;
  font-size: 12px;
  border: 1px solid #dce5f4;
}

.categoryGroup.expanded .categoryPill {
  background: #eef4ff;
  border-color: #c8d8fb;
  color: var(--primary);
}

.categoryGroup.selected:not(.expanded) .categoryPill {
  background: #f5f8ff;
  border-color: #d8e4fb;
  color: var(--primary);
}

.subCategoryList {
  display: grid;
  gap: 6px;
  padding-left: 10px;
  border-left: 2px solid #dce7ff;
}

.subCategoryPill {
  min-height: 32px;
  width: 100%;
  justify-content: flex-start;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #fff;
  color: #526070;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.subCategoryPill:hover {
  background: #f4f7fb;
  color: var(--primary);
}

.subCategoryPill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  min-height: 38px;
  padding: 0 16px;
}

a.small {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

button:hover {
  background: var(--primary-dark);
}

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

button.isLoading {
  cursor: wait;
  opacity: 0.78;
}

button.isLoading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: buttonLoadingSpin 0.75s linear infinite;
}

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

.ghost {
  background: #edf3ff;
  color: var(--primary);
}

.ghost:hover {
  background: #dfeaff;
}

.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

label {
  display: block;
  font-weight: 800;
  color: #263348;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
  margin-top: 8px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.75;
}

.questionInput {
  min-height: 170px;
  font-size: 15px;
}

.similarVoices {
  margin-top: 14px;
  border: 1px solid #d9e4f2;
  border-radius: 6px;
  background: #f8fbff;
  overflow: hidden;
}

.similarVoiceHead {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid #e2eaf5;
}

.similarVoiceHead strong {
  color: #263348;
  font-size: 14px;
  font-weight: 900;
}

.similarVoiceHead span {
  min-width: 42px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  border: 1px solid #d8e3f0;
  font-size: 12px;
  font-weight: 800;
}

.similarVoiceEmpty {
  min-height: 72px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 12px;
}

.similarVoiceList {
  margin: 0;
  padding: 10px 16px 12px 32px;
  color: #34445a;
  font-size: 13px;
  line-height: 1.65;
}

.similarVoiceList li + li {
  margin-top: 6px;
}

input,
select {
  height: 40px;
}

textarea::placeholder,
input::placeholder {
  color: var(--subtle);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(38, 103, 245, 0.11);
}

.formGrid {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(220px, 1fr);
  gap: 14px;
}

.selectionStatus {
  display: grid;
  gap: 5px;
  border: 1px solid #cfe0ff;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  background: linear-gradient(180deg, #fff 0%, #f7faff 100%);
  padding: 12px 14px;
  margin-top: 14px;
}

.selectionStatus span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.selectionStatus strong {
  color: #12335d;
  font-size: 17px;
  line-height: 1.45;
}

.selectionStatus p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.generatorCard.hasSelectedCategory .selectionStatus {
  border-color: #b9dcff;
  border-left-color: #0f8b5f;
  background: linear-gradient(180deg, #fff 0%, #f3fff9 100%);
}

.generatorCard.hasSelectedCategory .selectionStatus span {
  color: #0f8b5f;
}

.srOnly {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.generateHint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.generateBtn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.generatorCard.readyToGenerate .generateHint {
  color: #0f8b5f;
  font-weight: 800;
}

.result {
  border: 1px solid var(--line);
  border-top: 4px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  padding: 14px 18px 18px;
}

.resultHead {
  margin-bottom: 12px;
}

.resultMeta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.result h3 {
  font-size: 15px;
  margin: 16px 0 8px;
  font-weight: 900;
}

.replyText {
  white-space: pre-wrap;
  line-height: 1.9;
}

.result ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.75;
}

body.feishu-active {
  background: #eef3f7;
}

body.feishu-active .sidebar,
body.feishu-active .topbar {
  display: none;
}

body.feishu-active .mainShell {
  margin-left: 0;
  min-height: 100vh;
  padding: 0;
}

.feishuAppPage.active {
  min-height: calc(100vh - 48px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76) 0%, rgba(238, 243, 247, 0.96) 42%),
    radial-gradient(circle at 14% 0%, rgba(255, 48, 40, 0.1), transparent 32%),
    #eef3f7;
}

.feishuShell {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 16px 14px 28px;
  display: grid;
  gap: 14px;
}

.feishuHeader {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid #e23b32;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.feishuHeader.consultant {
  border-left-color: #0e8f68;
}


.feishuHeader span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.feishuHeader h1 {
  margin-top: 3px;
  color: #142033;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0;
}

.feishuForm,
.feishuResult {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
}

.feishuForm {
  display: grid;
  gap: 13px;
  padding: 14px;
}

.feishuForm label {
  color: #1f2f45;
  font-size: 13px;
}

.feishuForm select,
.feishuForm textarea {
  border-radius: 6px;
  font-size: 15px;
}

.feishuForm select {
  height: 46px;
}

.feishuQuestionInput {
  min-height: 148px;
}

.feishuSimilarVoices {
  border: 1px solid #d9e4f2;
  border-radius: 6px;
  background: #f8fbff;
  overflow: hidden;
}

.feishuSimilarVoiceHead {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid #e2eaf5;
}

.feishuSimilarVoiceHead strong {
  color: #1f2f45;
  font-size: 13px;
  font-weight: 900;
}

.feishuSimilarVoiceHead span {
  min-width: 40px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d8e3f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.feishuSimilarVoiceList {
  margin: 0;
  padding: 10px 16px 12px 30px;
  color: #34445a;
  font-size: 13px;
  line-height: 1.65;
}

.feishuSimilarVoiceList li + li {
  margin-top: 6px;
}

.feishuGenerateBtn {
  width: 100%;
  min-height: 46px;
  border-radius: 6px;
  font-size: 15px;
}

.feishuHint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.feishuResult {
  padding: 14px;
}

.feishuResultHeader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.feishuResultMeta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.feishuResult h2 {
  margin-top: 3px;
  color: #142033;
  font-size: 18px;
  line-height: 1.25;
}

.feishuCopyBtn {
  min-width: 96px;
  min-height: 36px;
  border-radius: 6px;
}

.feishuReplyText {
  white-space: pre-wrap;
  color: #202a3a;
  font-size: 15px;
  line-height: 1.9;
  padding: 14px 0;
}

.feishuDetailGrid {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.feishuDetailGrid h3 {
  color: #1f2f45;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 7px;
}

.feishuDetailGrid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.adminLayout {
  overflow: hidden;
  padding: 18px;
}

.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.sectionHeader.compact {
  align-items: center;
}

.sectionHeader h2 {
  font-size: 18px;
}

.adminPanel {
  display: none;
}

.adminPanel.active {
  display: block;
}

body.admin-active #admin-settings + #admin-permissions {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.knowledgeGrid {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(420px, 1fr);
  gap: 16px;
  align-items: start;
}

.knowledgeList {
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding-right: 4px;
}

.knowledgeGrid.isEmpty {
  grid-template-columns: 1fr;
}

.knowledgeGrid.isEmpty .knowledgeList {
  grid-column: 1;
  max-height: none;
  padding-right: 0;
}

.knowledgeGrid.isEmpty .knowledgeDetail {
  display: none;
}

.knowledgeGrid.isEmpty .emptyAction {
  min-height: 260px;
  align-items: center;
  justify-items: center;
  padding: 42px 24px;
  text-align: center;
}

.knowledgeGrid.isEmpty .emptyAction p {
  max-width: 520px;
}

.knowledgeItem .knowledgeExcerpt {
  color: #334155;
  line-height: 1.7;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
}

#admin-pool.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 190px);
  min-height: 560px;
  overflow: hidden;
}

#admin-pool > .sectionHeader,
#admin-pool > .poolToolbar,
#admin-pool > .poolNotice {
  flex: 0 0 auto;
}

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

.selectedQuestionsPanel {
  margin-bottom: 14px;
}

.selectedEmpty {
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  padding: 12px 14px;
  background: var(--panel-soft);
}

.selectedEmpty.warn {
  color: var(--amber);
  border-color: #e8d29a;
  background: #fffaf0;
}

.selectedHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #cfe0ff;
  border-radius: 6px 6px 0 0;
  background: #eef4ff;
  padding: 10px 12px;
}

.selectedHead strong {
  color: #164d9d;
}

.selectedQuestionList {
  display: grid;
  gap: 0;
  border: 1px solid #cfe0ff;
  border-top: 0;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}

.selectedQuestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: start;
  background: #fff;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.selectedQuestion:first-child {
  border-top: 0;
}

.selectedQuestion p {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.6;
  margin-top: 4px;
}

.poolToolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

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

.filterTabs button {
  min-height: 32px;
  border-radius: 4px;
  background: #edf3ff;
  color: var(--primary);
  padding: 0 12px;
  font-size: 13px;
}

.filterTabs button.active {
  background: var(--primary);
  color: #fff;
}

.poolSelection {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.poolSelection strong {
  color: #12335d;
}

.poolNotice {
  border: 1px solid #b8ccff;
  border-radius: 6px;
  background: #f3f7ff;
  color: #164d9d;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 800;
}

.poolFlow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.poolFlow span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #f5f8fc;
  color: #536174;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.poolCategoryBox {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 1.6fr) minmax(110px, 0.7fr);
  gap: 8px;
  border: 1px solid #cfe0ff;
  border-radius: 6px;
  background: #f7faff;
  padding: 10px;
  margin-top: 10px;
}

.poolCategoryBox div {
  min-width: 0;
}

.poolCategoryBox span,
.poolCategoryBox strong {
  display: block;
}

.poolCategoryBox span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.poolCategoryBox strong {
  color: #12335d;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

@media (max-width: 860px) {
  .poolCategoryBox {
    grid-template-columns: 1fr;
  }

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

  .poolDetailPane {
    position: static;
  }

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

.trainingToolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.mutedCount {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4e5b6c;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.focusBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #b8ccff;
  border-radius: 6px;
  background: #f3f7ff;
  padding: 10px 12px;
}

.focusBar strong {
  color: #164d9d;
}

.list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 248px);
  overflow: auto;
}

#questionPool.list {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.poolSplit {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(620px, 1fr);
  gap: 12px;
  align-items: start;
  height: 100%;
  min-height: 0;
}

.poolListPane {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 6px;
}

.poolDetailPane {
  position: static;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 8px 0 0;
}

.poolDetailPane h3 {
  font-size: 18px;
}

.poolDetailCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.poolClassificationCard {
  border-top: 3px solid #7aa2ff;
}

.existingScriptCard {
  border-top: 3px solid #8bb8a8;
}

.existingScriptCard.mutedCard {
  border-top-color: #cbd5e1;
}

.optimizeNoteCard {
  border-top: 3px solid #dbe7ff;
}

.optimizeNoteCard label {
  display: block;
  color: #12335d;
  font-size: 13px;
  font-weight: 900;
}

.optimizeNoteCard textarea {
  min-height: 78px;
  margin-top: 8px;
  line-height: 1.7;
  resize: vertical;
}

.detailBlock,
.detailGrid > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 12px;
}

.detailBlock {
  margin-top: 12px;
}

.workflowBanner {
  display: grid;
  grid-template-columns: minmax(140px, 0.28fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid #cfe0ff;
  border-radius: 6px;
  background: #f7faff;
  padding: 12px;
  margin-top: 10px;
}

.workflowBanner span,
.workflowBanner strong {
  display: block;
}

.workflowBanner span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.workflowBanner strong {
  color: #12335d;
  font-size: 15px;
}

.workflowBanner p {
  color: #334155;
  font-size: 13px;
  line-height: 1.65;
  margin: 0;
}

.workflowBanner.optimize {
  border-color: #f1c27d;
  background: #fffaf0;
}

.workflowBanner.training {
  border-color: #b8ccff;
  background: #f3f7ff;
}

.workflowBanner.resolved,
.workflowBanner.hit {
  border-color: #b7ead4;
  background: #ecfdf5;
}

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

.detailBlock span,
.detailGrid span,
.detailBlock strong,
.detailGrid strong {
  display: block;
}

.detailBlock span,
.detailGrid span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detailBlock strong,
.detailGrid strong {
  color: #12335d;
  line-height: 1.55;
}

.detailGrid select {
  width: 100%;
  min-height: 38px;
  margin: 0;
}

.detailPrimary {
  margin-top: 14px;
}

.detailActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.detailActions .detailPrimary {
  margin-top: 0;
}

.classificationNotice {
  border-radius: 6px;
  padding: 9px 10px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 800;
}

.classificationNotice.confirmed {
  background: #ecfdf5;
  color: var(--green);
}

.classificationNotice.warn {
  background: #fff7ed;
  color: var(--amber);
}

.aiCategoryBox {
  border: 1px solid #d8e3f5;
  border-radius: 6px;
  background: #f8fafc;
  color: #4e5b6c;
  padding: 10px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.aiCategorySuggestionLine {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.aiCategorySuggestionLine span {
  min-width: 0;
}

.aiCategorySuggestionLine button {
  flex: 0 0 auto;
}

.aiCategoryBox small {
  display: block;
  margin-top: 4px;
  color: var(--subtle);
}

.poolDraftEmpty {
  border: 1px dashed #cfd9ea;
  border-radius: 8px;
  background: #f8fafc;
  margin-top: 0;
  padding: 18px;
}

.poolTrainingDraft {
  border-top: 3px solid var(--primary);
  margin-top: 0;
  padding-top: 16px;
}

.poolTrainingDraft label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 800;
  color: #12335d;
}

.poolTrainingDraft label[hidden] {
  display: none !important;
}

.poolTrainingDraft input,
.poolTrainingDraft textarea {
  margin-top: 6px;
}

.poolTrainingDraft textarea {
  min-height: 118px;
  font-size: 13px;
  line-height: 1.75;
  resize: vertical;
}

.draftMetaGrid {
  display: grid;
  gap: 12px;
}

.draftMetaGrid {
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
}

.draftMetaGridSingle {
  grid-template-columns: 1fr;
}
.draftMetaGrid textarea {
  min-height: 86px;
}

.scriptRoleTabs {
  display: inline-flex;
  gap: 8px;
  margin-top: 12px;
  padding: 4px;
  border-radius: 6px;
  background: #edf3ff;
}

.scriptRoleTabs button {
  min-height: 32px;
  border-radius: 4px;
  padding: 0 14px;
  background: transparent;
  color: var(--primary);
  font-weight: 900;
}

.scriptRoleTabs button.active {
  background: var(--primary);
  color: #fff;
}

.scriptReviewPane textarea {
  min-height: 300px;
  width: 100%;
}

.sourceReview textarea {
  min-height: 86px;
}

.draftSupport {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.draftSupport summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.draftSupport[open] summary {
  margin-bottom: 4px;
}

@media (max-width: 1180px) {
  .draftMetaGrid {
    grid-template-columns: 1fr;
  }

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

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

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

.item:hover {
  border-color: #cdd8ea;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.poolItem {
  cursor: pointer;
}

.poolItem.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(38, 103, 245, 0.18);
}

.item p {
  color: #344054;
  font-size: 13px;
  line-height: 1.65;
  margin-top: 8px;
}

.trainingItem {
  padding: 14px 16px;
}

.trainingItem.needsCategory {
  border-color: #f0c36d;
  background: #fffdf7;
}

.trainingItem .itemHead {
  align-items: flex-start;
}

.trainingItem .itemHead p {
  margin-top: 4px;
  color: var(--muted);
}

.categoryManageLayout {
  display: grid;
  grid-template-columns: minmax(260px, 0.36fr) minmax(520px, 1fr);
  gap: 16px;
}

.categoryManageGroups,
.categoryManageDetail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  min-height: 560px;
}

.categoryGroupList,
.categoryManageRows {
  display: grid;
  gap: 10px;
}

.categoryManageGroup {
  width: 100%;
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
  color: #12335d;
  padding: 10px 12px;
  text-align: left;
}

.categoryManageGroup:hover,
.categoryManageGroup.active {
  border-color: var(--primary);
  background: #eef4ff;
  color: var(--primary);
}

.categoryManageGroup strong,
.categoryManageGroup span {
  display: block;
}

.categoryManageGroup span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.categoryManageGroup em {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #dce5f4;
  color: var(--primary);
  font-style: normal;
  font-size: 12px;
  padding: 4px 8px;
}

.emptyAction {
  min-height: 220px;
  border: 1px dashed #b9c8dd;
  border-radius: 8px;
  background: #f8fbff;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  padding: 28px;
}

.emptyAction h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.emptyAction p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.categoryDetailHead {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.categoryManageRow {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 110px 110px 100px 170px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
}

.categoryManageRow:hover {
  border-color: #cdd8ea;
  background: #f8fbff;
}

.categoryManageRow p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 5px;
}

.poolItemHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.poolStatus {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.poolStatusGroup {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.poolStatus.matched {
  background: #ecfdf5;
  color: var(--green);
}

.poolStatus.unmatched {
  background: #fff7ed;
  color: var(--amber);
}

.poolStatus.pending,
.poolStatus.optimize {
  background: #fff7ed;
  color: #9a6700;
}

.poolStatus.training {
  background: #eef4ff;
  color: var(--primary);
}

.poolStatus.hit {
  background: #ecfdf5;
  color: var(--green);
}

.poolStatus.resolved {
  background: #ecfdf5;
  color: var(--green);
}

.poolStatus.default {
  background: #f1f5f9;
  color: var(--muted);
}

.existingScriptGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

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

.existingScriptMetric {
  border: 1px solid #cfe0ff;
  border-radius: 6px;
  background: #f7faff;
  padding: 12px;
}

.existingScriptMetric span,
.existingScriptMetric strong {
  display: block;
}

.existingScriptMetric span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.existingScriptMetric strong {
  color: #12335d;
  font-size: 16px;
}

.existingScriptMetric.emptyMetric {
  border-color: var(--line);
  background: #f8fafc;
}

.existingScriptDetails {
  margin-top: 12px;
}

.existingScriptDetails summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.existingScriptDetails[open] summary {
  margin-bottom: 10px;
}

.existingScriptBlock {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 12px;
  min-width: 0;
}

.existingScriptBlock strong {
  display: block;
  color: #12335d;
  font-size: 13px;
  margin-bottom: 8px;
}

.existingScriptBlock p {
  color: #344054;
  font-size: 13px;
  line-height: 1.8;
  margin: 0;
  white-space: pre-wrap;
}

.existingScriptText {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}

.existingScriptText:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.existingScriptText b {
  display: block;
  color: #334155;
  font-size: 12px;
  margin-bottom: 6px;
}

.existingScriptText p {
  max-height: 260px;
  overflow: auto;
}

.itemHead,
.checkLine,
.chips {
  display: flex;
  align-items: center;
  gap: 8px;
}

.itemHead {
  justify-content: space-between;
}

.checkLine {
  margin: 0;
}

.checkLine input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.chips {
  flex-wrap: wrap;
  margin-top: 8px;
}

.inlineActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

details {
  margin: 8px 0;
}

summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
}

.revisionInput {
  min-height: 72px;
  margin-top: 10px;
  font-size: 13px;
}

.editGrid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.editGrid label {
  font-size: 13px;
}

.editGrid textarea {
  min-height: 92px;
  font-size: 13px;
}

.stackedForm {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.stackedForm h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.stackedForm input,
.stackedForm select,
.stackedForm textarea {
  margin-bottom: 8px;
}

.stackedForm textarea {
  min-height: 86px;
}

.checkRow {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px 0 4px;
}

.checkRow label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #334155;
}

.checkRow input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.connectorBox {
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: var(--panel-soft);
}

.connectorBox input[readonly] {
  background: #fff;
  color: var(--muted);
}

.aiConfigHeader,
.aiConfigFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.aiConfigHeader {
  margin-bottom: 14px;
}

.aiConfigHeader h3,
.aiConfigHeader .hint {
  margin-bottom: 0;
}

.aiConfigGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 14px;
}

.aiConfigUrlField {
  grid-column: 1 / -1;
}

.aiConfigFooter {
  margin-top: 4px;
}

.aiConfigFooter .hint {
  margin: 0;
}

.aiConfigFooter .actions {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .aiConfigGrid { grid-template-columns: 1fr; }
  .aiConfigUrlField { grid-column: auto; }
  .aiConfigFooter { align-items: flex-start; flex-direction: column; }
}

.dangerZone {
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  background: #fff;
}

.dangerZone summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  color: var(--ink);
  font-weight: 900;
  list-style: none;
}

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

.dangerZone summary::after {
  content: "展开";
  border: 1px solid #ffd2cf;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--danger);
  background: #fff7f6;
  font-size: 12px;
}

.dangerZone[open] summary::after {
  content: "收起";
}

.dangerZone summary small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-right: auto;
}

.dangerZoneBody {
  border-top: 1px solid var(--line);
  padding: 14px;
  background: #fffafa;
}

.dangerZone h3 {
  color: #991b1b;
}

.dangerZone ul {
  margin: 8px 0 12px;
  padding-left: 18px;
  color: #7f1d1d;
  line-height: 1.7;
  font-weight: 700;
}

.userAdminBox {
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  background: #fff;
}

.userListBox {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  margin-top: 16px;
  background: #fff;
}

.dangerGhost {
  border: 1px solid #ffd2cf;
  background: #fff5f4;
  color: var(--danger);
}

.dangerGhost:hover {
  background: #ffe7e4;
  color: var(--danger);
}

.countBadge {
  border: 1px solid #dce5f4;
  border-radius: 999px;
  color: var(--primary);
  background: #f8fbff;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.notice {
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.notice.success {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: var(--green);
}

.notice.error {
  border-color: #fecaca;
  background: #fff5f4;
  color: var(--danger);
}

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

.accountForm label,
.innerForm label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 800;
}

.accountForm input,
.accountForm select,
.innerForm input,
.innerForm select {
  margin-bottom: 0;
}

.accountForm button,
.innerForm button {
  width: max-content;
}

.innerForm.editing {
  border: 1px solid #bfd2ff;
  border-radius: 6px;
  background: #f8fbff;
  padding: 12px;
  box-shadow: 0 0 0 3px rgba(38, 103, 245, 0.08);
}

.modalOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(0, 20, 38, 0.42);
  padding: 24px;
}

.modalOverlay[hidden] {
  display: none;
}

.modalCard {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  padding: 20px;
}

.archivedModalCard {
  width: min(920px, 100%);
}

.libraryImportCard {
  width: min(920px, 100%);
}

.modalHeaderActions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.importFileBox {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.importFileBox strong {
  display: block;
  margin-bottom: 4px;
}

.fileImportButton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #bfd1f3;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.fileImportButton input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.libraryImportText {
  min-height: 180px;
  font-size: 13px;
  line-height: 1.75;
}

.importExample {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
  padding: 12px;
  margin-top: 12px;
}

.importExample p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 6px 0 0;
}

.importExample code {
  color: #263348;
  font-size: 12px;
  font-weight: 800;
}

.archivedPoolList {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.archivedPoolItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 12px 14px;
}

.archivedPoolItem strong {
  display: block;
  color: #0f2745;
  line-height: 1.6;
}

.archivedPoolItem p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.modalCard .innerForm {
  margin-top: 14px;
}

.fieldMuted {
  opacity: 0.45;
}

.fieldMuted input,
.fieldMuted select {
  cursor: not-allowed;
  background: #f1f5f9;
}

.modalActions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.compactList {
  max-height: none;
  overflow: visible;
  margin-top: 12px;
  display: grid;
  gap: 0;
}

.compactItem {
  padding: 12px;
}

.userTableHead {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px 120px 260px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 0 16px 10px;
}

.userTableHead span:not(:first-child) {
  text-align: center;
}

.userTableHead span:last-child {
  text-align: center;
  padding-left: 0;
}

.userRow {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px 120px 260px;
  align-items: center;
  border-radius: 0;
  border-width: 0 0 1px;
  box-shadow: none;
  margin: 0;
  padding: 14px 16px;
}
/* Knowledge documents */
.knowledgeUploadBar {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
}

.knowledgeUploadFields {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(180px, 0.8fr) minmax(240px, 1fr) max-content;
  gap: 10px;
  align-items: end;
}

.knowledgeUploadFields > label:not(.knowledgeFileButton) {
  display: grid;
  gap: 5px;
}

.knowledgeFileButton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #bfd1f3;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

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

.knowledgeFileName {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.knowledgeControls {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 180px;
  align-items: end;
  gap: 16px;
  margin-bottom: 12px;
  max-width: 760px;
}

.knowledgeControls label {
  display: grid;
  gap: 8px;
}

.knowledgeControls input,
.knowledgeControls select {
  margin-top: 0;
  width: 100%;
}

.knowledgeItem {
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.knowledgeItem.isSelected {
  border-color: var(--blue);
  background: #f7faff;
}

.knowledgeItem .knowledgeMeta,
.knowledgeDetail .knowledgeMeta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.knowledgeStatus {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.knowledgeStatus.enabled {
  color: #087451;
  background: #e9fbf2;
}

.knowledgeStatus.disabled {
  color: #8a5a00;
  background: #fff6df;
}

.knowledgeToggleBtn {
  margin-top: 10px;
}

.knowledgeDetail {
  min-height: 420px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.knowledgeDetailHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.knowledgeDetailHeader h3 {
  margin: 4px 0 0;
  color: #162f51;
  font-size: 18px;
}

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

.knowledgeDetailActions {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0;
}

.knowledgeDocumentPreview {
  max-height: calc(100vh - 430px);
  min-height: 220px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #263348;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  line-height: 1.75;
}

.knowledgeNote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .knowledgeUploadFields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .knowledgeUploadFields .knowledgeNoteField {
    grid-column: 1 / -1;
  }

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

  .knowledgeDetail {
    min-height: 300px;
  }
}

@media (max-width: 600px) {
  .knowledgeUploadFields,
  .knowledgeControls {
    grid-template-columns: 1fr;
    display: grid;
  }

  .knowledgeControls select {
    width: 100%;
  }
}

.userRow:hover {
  box-shadow: none;
  background: #f8fbff;
}

.userRow p {
  color: var(--muted);
  margin-top: 4px;
}

.roleBadge,
.statusBadge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.roleBadge {
  background: #eef4ff;
  color: var(--primary);
}

.statusBadge.enabled {
  background: #ecfdf5;
  color: var(--green);
}

.statusBadge.disabled {
  background: #f1f5f9;
  color: var(--muted);
}

.slimActions {
  margin-top: 0;
  justify-content: center;
  gap: 8px;
}

.exportBar {
  display: grid;
  grid-template-columns: 180px max-content max-content;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.exportBar select {
  margin-top: 0;
}

.exportPreview {
  min-height: 180px;
  margin: 0 0 12px;
  font-size: 13px;
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
  background: var(--panel-soft);
}

.empty.warn {
  color: var(--amber);
}

@media (max-width: 1120px) {
  .generatorCard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "board"
      "input"
      "result";
  }

  .generatorCard .result,
  .categoryBoard,
  .inputBoard {
    min-height: auto;
  }

  .categoryManageLayout,
  .categoryManageRow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .sidebar {
    position: static;
    width: 100%;
    border-right: 0;
  }

  .brand {
    height: auto;
  }

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

  .sideNav a {
    min-height: 48px;
  }

  .sideNav a::after {
    display: none;
  }

  .topbar {
    position: static;
    height: 54px;
    padding: 0 16px;
  }

  .topTools {
    display: none;
  }

  .mainShell {
    margin-left: 0;
    padding: 16px;
  }

  body.portal-active .mainShell {
    padding-top: 16px;
  }

  body.admin-active .poolToolbar {
    align-items: stretch;
    flex-direction: column;
  }

  body.admin-active .poolSelection {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }

  body.feishu-active .mainShell {
    padding: 0;
  }

  .pageHeader {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
  }

  .page-entry.active {
    min-height: auto;
  }

  .entryShell {
    padding: 4px 0;
  }

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

  .entryCard {
    min-height: 190px;
    padding: 20px;
  }

  .formGrid,
  .exportBar,
  .importFileBox,
  .accountForm,
  .userTableHead,
  .userRow {
    grid-template-columns: 1fr;
  }

  .list {
    max-height: none;
  }

  #admin-pool.active {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #questionPool.list,
  .poolListPane,
  .poolDetailPane {
    max-height: none;
    overflow: visible;
  }

  .poolSplit {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .poolListPane,
  .poolDetailPane {
    padding-right: 0;
  }
}
.structuredKeyPoints {
  list-style: none;
  margin: 0;
  padding: 0;
}

.structuredKeyPoints li {
  margin: 0 0 12px;
  line-height: 1.75;
}

.structuredKeyPoints li:last-child {
  margin-bottom: 0;
}

.structuredKeyPoints strong {
  color: var(--text);
  margin-right: 8px;
}
.structuredReplyText {
  white-space: normal;
}

.structuredReplyText p {
  margin: 0 0 14px;
}

.structuredReplyText p:last-child {
  margin-bottom: 0;
}
.usageDashboard {
  min-width: 0;
}

.usageHeader {
  margin-bottom: 18px;
}

.usagePeriodTabs {
  flex-shrink: 0;
}

.usageMetricsGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  margin-bottom: 16px;
  overflow: hidden;
}

.usageMetric {
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.usageMetric:last-child {
  border-right: 0;
}

.usageMetric span,
.usageMetric small {
  display: block;
}

.usageMetric span {
  color: var(--muted);
  font-weight: 700;
}

.usageMetric strong {
  display: block;
  min-height: 44px;
  color: #142033;
  font-size: 32px;
  line-height: 44px;
}

.usageMetric small {
  color: var(--subtle);
  font-size: 12px;
}

.usageOverviewGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.usageSection {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 16px;
}

.usageSection .sectionHeader {
  margin-bottom: 10px;
}

.usageSection h3 {
  font-size: 16px;
}

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

.usageTable {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.usageTable th,
.usageTable td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.usageTable th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 700;
}

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

.usagePlaceholderRow td {
  height: 92px;
  color: var(--subtle);
  text-align: center;
}

.usagePeopleTable {
  min-width: 780px;
}

@media (max-width: 1120px) {
  .usageOverviewGrid {
    grid-template-columns: 1fr;
  }

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

  .usageMetric:nth-child(2) {
    border-right: 0;
  }

  .usageMetric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 880px) {
  .usageHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .usagePeriodTabs {
    width: 100%;
  }

  .usagePeriodTabs button {
    flex: 1;
  }

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

  .usageMetric,
  .usageMetric:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .usageMetric:last-child {
    border-bottom: 0;
  }

  .usageRoleTable {
    min-width: 520px;
  }

  .usageCategoryTable {
    min-width: 480px;
  }
}
.usageRoleBadge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.usageRoleBadge.teacher {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.usageRoleBadge.consultant {
  background: #ecfdf5;
  color: var(--green);
}

.usageNumber,
.usageRank,
.usageTime {
  font-variant-numeric: tabular-nums;
}

.usageNumber {
  color: #142033;
  font-weight: 800;
}

.usageRank {
  color: var(--muted);
  font-weight: 800;
}

.usageCategoryName strong,
.usageCategoryName small {
  display: block;
}

.usageCategoryName strong {
  color: #142033;
}

.usageCategoryName small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.usageTime {
  color: #455267;
  white-space: nowrap;
}

.usagePeopleSection .usageTableWrap {
  max-height: 420px;
  overflow: auto;
}

.usagePeopleSection .usageTable th {
  position: sticky;
  top: 0;
  z-index: 1;
}


.feishuHeader h1.feishuWelcome {
  margin-top: 6px;
  color: #142033;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0;
}


.feishuSelectionStatus {
  padding: 10px 12px;
  border: 1px solid #d9e4f2;
  border-left: 4px solid #2f69ef;
  border-radius: 6px;
  background: #f8fbff;
}

.feishuSelectionStatus > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.feishuSelectionStatus strong {
  display: block;
  margin-top: 2px;
  color: #173861;
  font-size: 16px;
  line-height: 1.35;
}

.feishuSelectionStatus p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.feishuSelectionStatus.isSelected {
  border-left-color: #0e8f68;
  background: #f5fcf9;
}

.feishuSelectionStatus.isSelected strong {
  color: #0b7859;
}

/* Compact split welcome treatment */
body.portal-active .crumb {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 280px);
}

body.portal-active #crumbTitle {
  max-width: 100%;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.portal-active #crumbGreeting {
  display: block;
  max-width: 100%;
  color: #162f51;
  font-family: "YouYuan", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feishuHeader {
  min-height: 74px;
  padding: 12px 14px;
}

.feishuHeader > div {
  min-width: 0;
  width: 100%;
}

.feishuHeader h1.feishuWelcome {
  margin-top: 4px;
  max-width: 100%;
  color: #142033;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feishuWelcomeGreeting {
  display: block;
  max-width: 100%;
  margin: 2px 0 0;
  color: #142033;
  font-family: "YouYuan", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Balanced portal welcome hierarchy */
@media (min-width: 721px) {
  body.portal-active .topbar {
    height: 64px;
  }

  body.portal-active .mainShell {
    padding-top: 80px;
  }
}

/* Knowledge area: documents first, upload on demand. */
.knowledgeHeaderActions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.knowledgeUploadCard {
  width: min(680px, 100%);
}

.knowledgeUploadCard .knowledgeUploadBar {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.knowledgeUploadCard .knowledgeUploadFields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.knowledgeUploadCard .knowledgeFileButton,
.knowledgeUploadCard .knowledgeNoteField {
  grid-column: 1 / -1;
}

.knowledgeUploadActions {
  justify-content: flex-end;
  margin-top: 16px;
}

@media (max-width: 600px) {
  .knowledgeHeaderActions {
    align-items: flex-end;
    flex-direction: column;
  }

  .knowledgeUploadCard .knowledgeUploadFields {
    grid-template-columns: 1fr;
  }
}
