:root {
      /* 设计规范色板 */
      --color-sidebar-bg: #1c508c;
      --color-sidebar-active-bg: #2d69a8;
      --color-primary: #1c508c;
      --color-primary-hover: #153c66;
      --color-btn-text: #ffffff;
      --color-topbar-bg: #f0f4f8;
      --color-main-bg: #f8fafc;
      --color-card: #ffffff;
      --color-upload-bg: #f1f5f9;
      --color-sidebar-text: #e2e8f0;
      --color-sidebar-text-active: #ffffff;
      --color-text: #1e293b;
      --color-text-muted: #64748b;
      --color-border: #e2e8f0;
      --cscec-blue: var(--color-primary);
      --cscec-blue-hover: var(--color-primary-hover);
      --cscec-rgb: 28, 80, 140;
      --surface: var(--color-card);
      --surface-strong: var(--color-card);
      --border: var(--color-border);
      --text: var(--color-text);
      --text-muted: var(--color-text-muted);
      --accent: var(--color-primary);
      --accent-hover: var(--color-primary-hover);
      --danger: #dc2626;
      --danger-hover: #b91c1c;
      --success: #059669;
      --toast-auth-bg: var(--color-sidebar-bg);
      --toast-auth-text: var(--color-sidebar-text-active);
      --toast-ok-bg: linear-gradient(
        135deg,
        var(--color-sidebar-bg) 0%,
        var(--color-sidebar-active-bg) 100%
      );
      --toast-ok-text: #ffffff;
      --toast-ok-border: rgba(255, 255, 255, 0.22);
      --toast-err-bg: linear-gradient(
        135deg,
        var(--danger) 0%,
        var(--danger-hover) 100%
      );
      --toast-err-text: #ffffff;
      --toast-err-border: rgba(255, 255, 255, 0.25);
      --toast-login-info-bg: rgba(var(--cscec-rgb), 0.08);
      --toast-login-info-text: var(--color-primary);
      --toast-login-info-border: rgba(var(--cscec-rgb), 0.35);
      --shadow: 0 12px 32px rgba(15, 52, 96, 0.08), 0 2px 8px rgba(15, 52, 96, 0.04);
      --radius-lg: 18px;
      --radius-md: 12px;
      --blur: blur(10px);
      --workspace-bottom-gap: 18px;
      --workspace-topbar-h: 52px;
      --workspace-panel-min-h: calc(100vh - var(--workspace-topbar-h) - var(--workspace-bottom-gap));
      --workspace-plate: var(--color-main-bg);
      --gen-kb-more-popover-w: min(306px, 78vw);
      --sidebar-width: 168px;
    }

    * {
      box-sizing: border-box;
    }

    html, body {
      height: 100%;
    }

    body {
      margin: 0;
      font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", system-ui, -apple-system, sans-serif;
      color: var(--text);
      background-color: var(--color-main-bg);
      background-image: none;
      min-height: 100%;
      -webkit-font-smoothing: antialiased;
    }

    body:not(.is-authenticated) {
      background-color: #153c66;
      background-image:
        linear-gradient(
          155deg,
          rgba(21, 60, 102, 0.92) 0%,
          rgba(28, 80, 140, 0.86) 45%,
          rgba(45, 105, 168, 0.8) 100%
        ),
        url("https://images.unsplash.com/photo-1503387762-592deb58ef4e?auto=format&fit=crop&w=1920&q=80");
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      background-attachment: fixed;
    }

    body.is-auth-checking:not(.is-authenticated) {
      background-color: #153c66;
      background-image:
        linear-gradient(
          155deg,
          rgba(21, 60, 102, 0.92) 0%,
          rgba(28, 80, 140, 0.86) 45%,
          rgba(45, 105, 168, 0.8) 100%
        ),
        url("https://images.unsplash.com/photo-1503387762-592deb58ef4e?auto=format&fit=crop&w=1920&q=80");
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      background-attachment: fixed;
    }

    #login-stage {
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px 16px;
      position: relative;
    }

    .login-stage-inner {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 18px;
      width: 100%;
      max-width: 420px;
    }

    .login-platform-tag {
      margin: 0;
      font-size: 0.88rem;
      font-weight: 500;
      color: rgba(255, 255, 255, 0.88);
      text-align: center;
      letter-spacing: 0.04em;
      text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
    }

    body.is-authenticated #login-stage {
      display: none !important;
    }

    body.is-auth-checking #login-stage {
      display: none !important;
    }

    #workspace {
      display: none !important;
      visibility: hidden;
      pointer-events: none;
      position: fixed;
      inset: 0;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      width: 0;
      height: 0;
    }

    body.is-authenticated {
      overflow: hidden;
    }

    body.is-authenticated #workspace {
      display: block !important;
      visibility: visible;
      pointer-events: auto;
      position: static;
      overflow: hidden;
      clip: auto;
      width: auto;
      height: 100vh;
      min-height: 100vh;
      padding: 0;
      background: var(--workspace-plate);
    }

    body.is-auth-checking #workspace {
      display: none !important;
    }

    .workspace-shell {
      display: flex;
      align-items: stretch;
      gap: 0;
      min-height: 100vh;
      height: 100vh;
      max-width: none;
      margin: 0;
      background: var(--workspace-plate);
    }

    .app-sidebar {
      flex: 0 0 var(--sidebar-width);
      width: var(--sidebar-width);
      display: flex;
      flex-direction: column;
      gap: 0;
      padding: 0 8px 12px;
      border-radius: 0;
      border: none;
      border-right: 1px solid rgba(255, 255, 255, 0.12);
      min-height: 0;
      height: 100%;
      align-self: stretch;
      background: var(--color-sidebar-bg);
      box-shadow: none;
    }

    .app-sidebar.glass {
      border-radius: 0;
      background: var(--color-sidebar-bg);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      box-shadow: none;
    }

    .app-brand {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: var(--workspace-topbar-h);
      min-height: var(--workspace-topbar-h);
      margin: 0;
      padding: 0 8px;
      box-sizing: border-box;
      font-family: inherit;
      font-size: 1.28rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      color: var(--color-sidebar-text-active);
      text-align: center;
      background: transparent;
      border: none;
      border-bottom: 1px solid rgba(255, 255, 255, 0.18);
      cursor: pointer;
      flex-shrink: 0;
      transition: color 0.15s, background 0.15s;
    }

    .app-brand:hover {
      color: var(--color-sidebar-text-active);
      background: rgba(255, 255, 255, 0.1);
    }

    .app-sidebar-tabs {
      display: flex;
      flex-direction: column;
      gap: 6px;
      flex: 1 1 auto;
      padding-top: 12px;
    }

    .app-main {
      flex: 1 1 0;
      min-width: 0;
      min-height: 0;
      height: 100%;
      display: flex;
      flex-direction: column;
      padding: 0;
      position: relative;
      background: transparent;
    }

    .app-main-topbar {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 60;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      padding: 0 16px;
      margin: 0;
      height: var(--workspace-topbar-h);
      min-height: var(--workspace-topbar-h);
      max-height: var(--workspace-topbar-h);
      box-sizing: border-box;
      background: var(--color-topbar-bg);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      border-bottom: 1px solid var(--border);
      pointer-events: none;
    }

    .app-main-topbar .user-menu {
      pointer-events: auto;
    }

    .app-main-content {
      flex: 1 1 0;
      min-height: 0;
      height: 100%;
      display: flex;
      flex-direction: column;
      padding-top: var(--workspace-topbar-h);
      background: var(--workspace-plate);
    }

    .app-main-content > .tab-panel {
      flex: 1 1 0;
      min-height: 0;
      height: 100%;
      overflow-y: auto;
      box-sizing: border-box;
      padding-bottom: var(--workspace-bottom-gap);
      background: var(--workspace-plate);
    }

    .app-main-content > .tab-panel > .detect-layout,
    .app-main-content > .tab-panel > .panel {
      margin: 0;
      min-height: var(--workspace-panel-min-h);
      height: auto;
      max-height: none;
      border-radius: 0;
      box-sizing: border-box;
    }

    .glass {
      background: var(--color-card);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
    }

    .glass-strong {
      background: var(--color-card);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
    }

    .login-card {
      width: 100%;
      max-width: 400px;
      padding: 36px 32px 32px;
      text-align: center;
      background: var(--color-card);
    }

    .avatar {
      width: 72px;
      height: 72px;
      margin: 0 auto 20px;
      border-radius: 50%;
      background: linear-gradient(145deg, rgba(var(--cscec-rgb), 0.14), rgba(15, 23, 42, 0.06));
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--accent);
    }

    .avatar svg {
      width: 38px;
      height: 38px;
      opacity: 0.92;
    }

    .login-card h1 {
      margin: 0 0 6px;
      font-size: 1.35rem;
      font-weight: 700;
      letter-spacing: -0.02em;
    }

    .login-card .subtitle {
      margin: 0 0 28px;
      font-size: 0.875rem;
      color: var(--text-muted);
      font-weight: 400;
    }

    .field {
      text-align: left;
      margin-bottom: 16px;
    }

    .field label {
      display: block;
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    .field input,
    .field textarea,
    .field select {
      width: 100%;
      padding: 11px 14px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      background: var(--color-card);
      font-size: 0.95rem;
      color: var(--text);
      outline: none;
      transition: border-color 0.15s, box-shadow 0.15s;
      font-family: inherit;
    }

    .field textarea {
      min-height: 120px;
      resize: vertical;
    }

    .field input:focus,
    .field textarea:focus,
    .field select:focus {
      border-color: rgba(var(--cscec-rgb), 0.45);
      box-shadow: 0 0 0 3px rgba(var(--cscec-rgb), 0.12);
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      font-family: inherit;
      font-size: 0.95rem;
      font-weight: 600;
      border: none;
      border-radius: var(--radius-md);
      padding: 11px 20px;
      cursor: pointer;
      transition: background 0.15s, transform 0.1s, opacity 0.15s;
    }

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

    .btn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .btn-primary {
      width: 100%;
      margin-top: 8px;
      background: var(--accent);
      color: var(--color-btn-text);
    }

    .login-card .btn-primary {
      margin-top: 8px;
    }

    .btn-primary:hover:not(:disabled) {
      background: var(--accent-hover);
    }

    .btn-primary--inline {
      width: auto;
      margin-top: 0;
    }

    .btn-ghost {
      background: var(--color-card);
      color: var(--text);
      border: 1px solid var(--border);
    }

    .btn-ghost:hover:not(:disabled) {
      background: var(--color-main-bg);
    }

    .btn-danger {
      background: rgba(220, 38, 38, 0.12);
      color: var(--danger);
      border: 1px solid rgba(220, 38, 38, 0.25);
    }

    .btn-danger:hover:not(:disabled) {
      background: rgba(220, 38, 38, 0.2);
      color: var(--danger-hover);
    }

    .btn-sm {
      padding: 7px 14px;
      font-size: 0.82rem;
    }

    .toast {
      margin-top: 14px;
      padding: 10px 12px;
      border-radius: var(--radius-md);
      font-size: 0.85rem;
      display: none;
      text-align: left;
    }

    .toast.show {
      display: block;
    }

    .toast.ok {
      background: var(--toast-login-info-bg);
      color: var(--toast-login-info-text);
      border: 1px solid var(--toast-login-info-border);
    }

    .toast.err {
      background: var(--toast-login-info-bg);
      color: var(--toast-login-info-text);
      border: 1px solid var(--toast-login-info-border);
    }

    #toast-work,
    #toast-gen,
    #toast-knowledge,
    #toast-detect {
      position: fixed;
      top: 72px;
      right: 16px;
      z-index: 10050;
      margin: 0;
      min-width: 168px;
      max-width: min(400px, calc(100vw - 32px));
      padding: 14px 20px;
      font-size: 0.9rem;
      line-height: 1.5;
      box-shadow: var(--shadow);
      pointer-events: none;
    }

    #toast-work.show,
    #toast-gen.show,
    #toast-knowledge.show,
    #toast-detect.show {
      pointer-events: auto;
    }

    #toast-work.ok,
    #toast-gen.ok,
    #toast-knowledge.ok,
    #toast-detect.ok {
      background: var(--toast-ok-bg);
      color: var(--toast-ok-text);
      border: 1px solid var(--toast-ok-border);
    }

    #toast-work.err,
    #toast-gen.err,
    #toast-knowledge.err,
    #toast-detect.err {
      background: var(--toast-err-bg);
      color: var(--toast-err-text);
      border: 1px solid var(--toast-err-border);
    }

    .toast.toast--sticky {
      box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
    }

    #toast-global {
      position: fixed;
      top: 16px;
      right: 16px;
      z-index: 10050;
      margin: 0;
      min-width: 168px;
      max-width: min(400px, calc(100vw - 32px));
      padding: 14px 20px;
      font-size: 0.95rem;
      line-height: 1.5;
      border-radius: var(--radius-md);
      box-shadow: var(--shadow);
      text-align: center;
    }

    #toast-global.ok {
      background: var(--toast-auth-bg);
      color: var(--toast-auth-text);
      border: 1px solid var(--toast-ok-border);
    }

    #toast-global.err {
      background: var(--toast-err-bg);
      color: var(--toast-err-text);
      border: 1px solid var(--toast-err-border);
    }

    .user-menu {
      position: relative;
      flex-shrink: 0;
      z-index: 50;
    }

    .user-menu-trigger {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 10px 14px;
      font-family: inherit;
      font-size: 0.92rem;
      font-weight: 700;
      color: var(--accent);
      background: rgba(255, 255, 255, 0.35);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      cursor: pointer;
      transition: background 0.15s, box-shadow 0.15s;
    }

    .user-menu-trigger:hover {
      background: rgba(255, 255, 255, 0.55);
    }

    .user-menu-trigger::after {
      content: "";
      width: 0;
      height: 0;
      border-left: 4px solid transparent;
      border-right: 4px solid transparent;
      border-top: 5px solid currentColor;
      opacity: 0.65;
    }

    .user-menu-dropdown {
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      z-index: 60;
      min-width: 148px;
      padding: 6px;
      background: var(--surface-strong);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      box-shadow: var(--shadow);
    }

    .user-menu-dropdown .btn {
      width: 100%;
      justify-content: center;
    }

    .tab-btn {
      width: 100%;
      text-align: left;
      padding: 12px 14px;
      font-family: inherit;
      font-size: 0.9rem;
      font-weight: 600;
      border: none;
      border-radius: var(--radius-md);
      cursor: pointer;
      background: transparent;
      color: var(--color-sidebar-text);
      transition: background 0.15s, color 0.15s;
    }

    .tab-btn:hover {
      color: var(--color-sidebar-text-active);
      background: rgba(255, 255, 255, 0.12);
    }

    .tab-btn.is-active {
      background: var(--color-sidebar-active-bg);
      color: var(--color-sidebar-text-active);
      box-shadow: 0 2px 8px rgba(15, 52, 96, 0.15);
    }

    .tab-panel {
      display: none;
    }

    .tab-panel.is-active {
      display: block;
    }

    .tab-panel.is-active[hidden] {
      display: block !important;
    }

    .tab-panel[hidden]:not(.is-active) {
      display: none !important;
    }

    /* 智能检测（标书检测 Tab：左右 50%，与拆解栏宽一致；功能区块保持原样） */
    .detect-layout {
      padding: 22px 22px 20px;
      margin-bottom: 0;
    }

    #tab-panel-detect > .detect-layout {
      display: grid;
      grid-template-columns: 1fr 1fr;
      align-items: stretch;
      gap: 18px;
      min-height: var(--workspace-panel-min-h);
      max-height: none;
    }

    #tab-panel-detect .detect-col--left,
    #tab-panel-detect .detect-col--right {
      min-width: 0;
      max-width: 100%;
    }

    #tab-panel-detect .detect-col--left {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    #tab-panel-detect .detect-col--right {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    #tab-panel-detect .detect-section[aria-label="上传招标文件"],
    #tab-panel-detect .detect-section[aria-label="上传投标文件"] {
      padding-bottom: 0;
      margin-bottom: 0;
      border-bottom: none;
    }

    #tab-panel-detect .detect-section[aria-label="上传投标文件"] {
      padding-top: 0;
      margin-top: 0;
    }

    #tab-panel-detect .detect-section[aria-label="上传招标文件"] h3,
    #tab-panel-detect .detect-section[aria-label="上传投标文件"] h3 {
      margin-bottom: 6px;
    }

    #tab-panel-detect .detect-section[aria-label="上传招标文件"] .detect-mini-hint,
    #tab-panel-detect .detect-section[aria-label="上传投标文件"] .detect-mini-hint {
      margin-bottom: 4px;
    }

    #tab-panel-detect #detect-extract-wrap,
    #tab-panel-detect #detect-extract-status {
      display: none !important;
    }

    #tab-panel-detect .detect-extract-summary {
      flex: 1 1 0;
      min-height: 72px;
      max-height: none;
      overflow-y: auto;
    }

    /* 选填说明区：标书生成·格式要求、标书检测·检测要求 */
    .workspace-notes-block {
      flex: 0 0 auto;
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px dashed rgba(15, 23, 42, 0.12);
    }

    .workspace-notes-block__title,
    .workspace-notes-block > label {
      display: block;
      margin: 0 0 8px;
      font-family: inherit;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-muted);
    }

    #tab-panel-detect .workspace-notes-block__title {
      font-size: 0.92rem;
      font-weight: 700;
      color: var(--text);
    }

    .workspace-notes-block__hint {
      margin: 0 0 8px;
      font-family: inherit;
      font-size: 0.78rem;
      line-height: 1.45;
      color: var(--text-muted);
    }

    .workspace-notes-block__panel {
      padding: 12px 14px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      background: var(--color-upload-bg);
    }

    .workspace-notes-block__textarea {
      display: block;
      width: 100%;
      box-sizing: border-box;
      min-height: 72px;
      resize: vertical;
      border: none;
      border-radius: 8px;
      background: var(--color-card);
      padding: 8px 10px;
      font-family: inherit;
      font-size: 0.88rem;
      line-height: 1.5;
      color: var(--text);
    }

    .workspace-notes-block__textarea::placeholder {
      color: var(--text-muted);
    }

    .workspace-notes-block__textarea:focus {
      outline: 2px solid rgba(28, 80, 140, 0.28);
      outline-offset: 1px;
    }

    #tab-panel-detect .detect-section.detect-section--notes {
      flex: 1 1 0;
      display: flex;
      flex-direction: column;
      min-height: 0;
      margin-top: auto;
      margin-bottom: 0;
      padding: 0;
      border: none;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    #tab-panel-detect .detect-section.detect-section--notes .workspace-notes-block {
      flex: 1 1 0;
      display: flex;
      flex-direction: column;
      min-height: 0;
      margin-top: 12px;
      padding-top: 16px;
      border-top: 1px solid var(--border);
    }

    #tab-panel-detect .detect-section.detect-section--notes .workspace-notes-block__panel {
      flex: 1 1 0;
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    #tab-panel-detect .detect-section.detect-section--notes .workspace-notes-block__textarea {
      flex: 1 1 0;
      min-height: min(20vh, 180px);
      max-height: none;
    }

    #tab-panel-detect .detect-run-btn {
      flex-shrink: 0;
      width: 100%;
      margin-top: 12px;
      padding: 11px 20px;
      font-size: 0.95rem;
      font-weight: 600;
      border-radius: var(--radius-md);
    }

    @media (max-width: 900px) {
      #tab-panel-detect > .detect-layout {
        grid-template-columns: 1fr;
      }
    }

    .detect-section {
      padding: 0 0 18px;
      margin-bottom: 14px;
      border-bottom: 1px solid var(--border);
    }

    .detect-section:last-of-type {
      border-bottom: none;
      margin-bottom: 0;
      padding-bottom: 0;
    }

    .detect-section h3 {
      margin: 0 0 10px;
      font-size: 0.92rem;
      font-weight: 700;
      color: var(--text);
    }

    .detect-mini-hint {
      margin: 0 0 8px;
      font-size: 0.78rem;
      color: var(--text-muted);
    }

    .detect-extract-summary {
      margin-top: 12px;
      padding: 12px 14px;
      border-radius: var(--radius-md);
      background: rgba(255, 255, 255, 0.45);
      border: 1px solid var(--border);
      font-size: 0.82rem;
      line-height: 1.5;
    }

    .detect-extract-summary h4 {
      margin: 0 0 8px;
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--accent);
    }

    /* 标书拆解：左上传 + 摘要白卡；右要点白卡顶边与上传区对齐 */
    .upload-split.detect-layout {
      display: grid;
      grid-template-columns: 1fr 1fr;
      grid-template-rows: auto auto 1fr auto;
      align-items: stretch;
      column-gap: 18px;
      row-gap: 0;
      min-height: var(--workspace-panel-min-h);
    }

    .upload-split .upload-top-block {
      grid-column: 1;
      grid-row: 1;
      min-width: 0;
    }

    .upload-split .upload-summary-card {
      grid-column: 1;
      grid-row: 2 / 5;
      display: flex;
      flex-direction: column;
      min-height: 0;
      min-width: 0;
      margin-bottom: 0;
      padding: 22px 22px 20px;
    }

    .upload-split .upload-summary-card .upload-panel-title {
      flex-shrink: 0;
    }

    .upload-split .upload-summary-card .upload-summary-scroll {
      flex: 1 1 0;
      min-height: 0;
      margin-top: 0;
    }

    .upload-split .upload-summary-card .upload-col-footer {
      flex-shrink: 0;
    }

    .upload-split .upload-points-card {
      grid-column: 2;
      grid-row: 1 / 5;
      display: flex;
      flex-direction: column;
      min-height: 0;
      min-width: 0;
      margin-bottom: 0;
      padding: 22px 22px 20px;
    }

    .upload-split .upload-points-card .upload-panel-title {
      flex-shrink: 0;
    }

    .upload-split .upload-points-card .upload-points-preview {
      flex: 1 1 0;
      min-height: 0;
    }

    .upload-split .upload-points-card .upload-col-footer {
      flex-shrink: 0;
    }

    .upload-split .upload-section-label {
      margin: 0 0 14px;
      font-size: 1rem;
      font-weight: 700;
      color: var(--text);
    }

    .upload-split .upload-panel-title {
      margin: 0 0 16px;
      font-size: 1rem;
      font-weight: 700;
      color: var(--text);
    }

    .upload-split #dropzone {
      flex-shrink: 0;
    }

    .upload-split .upload-summary-scroll:has(.upload-summary-body.visible) #upload-summary-placeholder {
      display: none;
    }

    .upload-split .upload-scroll-panel {
      overflow-y: auto;
      padding: 12px 14px;
      border-radius: var(--radius-md);
      background: var(--color-upload-bg);
      border: 1px solid var(--border);
    }

    .upload-split .upload-summary-text,
    .upload-split .upload-requirements-text {
      margin: 0;
      font-size: 0.88rem;
      line-height: 1.6;
      color: var(--text);
      white-space: pre-wrap;
      word-break: break-word;
    }

    .upload-requirements-view {
      margin: 0;
    }

    .upload-scoring-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.82rem;
      line-height: 1.5;
      color: var(--text);
      table-layout: fixed;
    }

    .upload-scoring-table th,
    .upload-scoring-table td {
      border: 1px solid var(--border);
      padding: 8px 10px;
      vertical-align: top;
      word-break: break-word;
    }

    .upload-scoring-table th {
      background: rgba(15, 23, 42, 0.04);
      font-weight: 600;
      color: var(--text-muted);
      text-align: left;
    }

    .upload-scoring-table th.col-idx,
    .upload-scoring-table th.col-cat,
    .upload-scoring-table th.col-item {
      text-align: center;
    }

    .upload-scoring-table .col-idx {
      width: 44px;
      text-align: center;
      vertical-align: middle;
      white-space: nowrap;
    }

    .upload-scoring-table .col-cat {
      width: 72px;
      text-align: center;
      vertical-align: middle;
      white-space: nowrap;
      font-weight: 600;
    }

    .upload-scoring-table .col-item {
      width: 26%;
      text-align: center;
      vertical-align: middle;
    }

    .upload-scoring-table .col-rule {
      text-align: left;
      vertical-align: top;
      word-break: break-word;
      overflow-wrap: anywhere;
    }

    .upload-scoring-cat--tech {
      color: #1d4ed8;
    }

    .upload-scoring-cat--biz {
      color: #b45309;
    }

    .upload-scoring-cat--price {
      color: #047857;
    }

    .upload-scoring-cat--unknown {
      color: #6b7280;
      font-style: italic;
    }

    .upload-requirements-footer {
      margin: 12px 0 0;
      padding: 10px 12px;
      font-size: 0.8rem;
      line-height: 1.55;
      color: var(--text-muted);
      background: rgba(15, 23, 42, 0.03);
      border: 1px dashed rgba(15, 23, 42, 0.12);
      border-radius: var(--radius-md);
      word-break: break-word;
    }

    .upload-requirements-footer-label {
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    .upload-requirements-footer-body {
      color: var(--text);
    }

    .upload-split .upload-summary-body.visible {
      display: block;
    }

    .upload-split .upload-summary-body {
      display: none;
    }

    .upload-split .upload-col-footer {
      padding-top: 16px;
    }

    .upload-split .upload-col-footer .row-actions {
      margin-top: 0;
    }

    .upload-split .upload-col-footer .row-actions + .row-actions {
      margin-top: 10px;
    }

    .upload-split .upload-footer-extract .btn-primary {
      width: 100%;
    }

    .upload-split .upload-points-preview .para-list {
      max-height: none;
      overflow: visible;
    }

    .upload-split .upload-points-preview .result-body.visible + .result-placeholder,
    .upload-split .upload-points-preview:has(.result-body.visible) > .result-placeholder {
      display: none;
    }

    @media (max-width: 900px) {
      .upload-split.detect-layout {
        grid-template-columns: 1fr;
        min-height: var(--workspace-panel-min-h);
        grid-template-rows: auto auto 1fr 1fr;
      }

      .upload-split .upload-top-block,
      .upload-split .upload-summary-card,
      .upload-split .upload-points-card {
        grid-column: 1;
        grid-row: auto;
      }

      .upload-split .upload-top-block {
        grid-row: 1;
      }

      .upload-split .upload-summary-card {
        grid-row: 2;
        min-height: 0;
      }

      .upload-split .upload-points-card {
        grid-row: 3;
        min-height: 0;
      }

      .upload-split .upload-summary-card .upload-summary-scroll {
        flex: 1 1 0;
        min-height: min(22vh, 200px);
      }

      .upload-split .upload-points-card .upload-points-preview {
        flex: 1 1 0;
        min-height: min(22vh, 200px);
      }
    }

    .gen-split .gen-left-card {
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    .gen-split .gen-left-card:has(.gen-kb-dropdown-trigger.is-open) {
      overflow: visible;
      z-index: 30;
    }

    .gen-split .gen-left-card > .upload-panel-title {
      flex-shrink: 0;
    }

    .gen-split .gen-chapters-block {
      flex: 1 1 0;
      min-height: 140px;
      max-height: none;
      display: flex;
      flex-direction: column;
      min-width: 0;
      overflow: hidden;
      margin-bottom: 0;
    }

    .gen-split .gen-chapters-block .upload-panel-title {
      flex-shrink: 0;
    }

    .gen-split .gen-chapters-block .gen-chapters-scroll {
      flex: 1 1 0;
      min-height: 100px;
    }

    .gen-split .gen-chapters-footer {
      flex-shrink: 0;
      padding-top: 10px;
    }

    .upload-split.gen-split.gen-split--body-only #gen-chapters-block {
      display: none !important;
    }

    .gen-split .gen-col-footer {
      flex-shrink: 0;
      margin-top: auto;
    }

    .gen-split .gen-kb-block {
      flex: 0 0 auto;
      display: flex;
      flex-direction: column;
      min-height: 0;
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px dashed rgba(15, 23, 42, 0.12);
      overflow: visible;
      position: relative;
      z-index: 2;
    }

    .gen-split .gen-kb-block > label {
      display: block;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    .gen-split .gen-kb-picker-row {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      min-width: 0;
    }

    .gen-split .gen-kb-dropdown-wrap {
      position: relative;
      flex: 0 0 min(52%, 220px);
      min-width: 140px;
      z-index: 50;
    }

    .gen-split .gen-kb-dropdown-trigger {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 9px 12px;
      font-family: inherit;
      font-size: 0.85rem;
      font-weight: 500;
      color: var(--text);
      text-align: left;
      background: var(--color-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      cursor: pointer;
      transition: border-color 0.15s, box-shadow 0.15s;
    }

    .gen-split .gen-kb-dropdown-trigger:hover {
      border-color: rgba(var(--cscec-rgb), 0.35);
    }

    .gen-split .gen-kb-dropdown-trigger.is-open {
      border-color: rgba(var(--cscec-rgb), 0.45);
      box-shadow: 0 0 0 3px rgba(var(--cscec-rgb), 0.1);
    }

    .gen-split .gen-kb-dropdown-trigger::after {
      content: "";
      flex-shrink: 0;
      width: 0;
      height: 0;
      border-left: 4px solid transparent;
      border-right: 4px solid transparent;
      border-top: 5px solid var(--text-muted);
    }

    .gen-split .gen-kb-dropdown-panel {
      position: absolute;
      left: 0;
      right: 0;
      top: calc(100% + 6px);
      z-index: 120;
      max-height: min(280px, 42vh);
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      padding: 8px 10px;
      border-radius: var(--radius-md);
      background: var(--surface-strong);
      backdrop-filter: var(--blur);
      -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
    }

    .gen-split .gen-kb-dropdown-panel[hidden],
    .gen-kb-dropdown-panel[hidden] {
      display: none !important;
    }

    /* 挂到 body 后不在 .gen-split 内，需独立选择器 */
    .gen-kb-dropdown-panel.is-portal {
      position: fixed;
      z-index: 500;
      max-height: min(280px, 42vh);
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      padding: 8px 10px;
      border-radius: var(--radius-md);
      background: #fff;
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
      font-family: inherit;
      font-size: 0.85rem;
      line-height: 1.45;
      color: var(--text);
    }

    .gen-kb-dropdown-panel .hint {
      margin: 0;
      font-size: 0.82rem;
      line-height: 1.45;
      color: var(--text-muted);
    }

    .gen-kb-dropdown-panel .gen-kb-dropdown-item {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      width: 100%;
      margin: 0 0 8px;
      padding: 0;
      cursor: pointer;
      line-height: 1.45;
      font-size: 0.85rem;
      font-family: inherit;
      color: var(--text);
    }

    .gen-kb-dropdown-panel .gen-kb-dropdown-item:last-child {
      margin-bottom: 0;
    }

    .gen-kb-dropdown-panel .gen-kb-dropdown-item input {
      margin-top: 3px;
      flex-shrink: 0;
    }

    .gen-kb-dropdown-panel .gen-kb-dropdown-item span {
      display: block;
      flex: 1 1 0;
      min-width: 0;
      word-break: break-word;
    }

    .gen-split .gen-kb-selected-display {
      flex: 1 1 0;
      min-width: 0;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 6px;
      font-size: 0.8rem;
      line-height: 1.45;
      color: var(--text);
      padding-top: 2px;
    }

    .gen-split .gen-kb-selected-display .hint {
      margin: 0;
      color: var(--text-muted);
      font-size: 0.78rem;
    }

    .gen-split .gen-kb-selected-name {
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .gen-split .gen-kb-selected-more {
      flex-shrink: 0;
      padding: 0 4px;
      font-family: inherit;
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--accent);
      background: none;
      border: none;
      cursor: pointer;
      text-decoration: underline;
      text-underline-offset: 2px;
    }

    .gen-split .gen-kb-selected-more:hover {
      color: var(--accent-hover);
    }

    .gen-kb-more-popover {
      margin: 0;
      border: 1px solid var(--border);
      padding: 14px 16px;
      width: max-content;
      max-width: var(--gen-kb-more-popover-w);
      max-height: min(280px, 50vh);
      overflow-y: auto;
      inset: unset;
    }

    .gen-kb-more-popover__title {
      margin: 0 0 10px;
      font-size: 0.9rem;
      font-weight: 700;
    }

    .gen-kb-more-popover__list {
      margin: 0;
      padding: 0 0 0 18px;
      font-size: 0.85rem;
      line-height: 1.55;
      color: var(--text);
    }

    .gen-kb-more-popover__list li {
      margin-bottom: 6px;
      word-break: break-word;
    }

    .gen-kb-more-popover__list li:last-child {
      margin-bottom: 0;
    }

    .upload-split.gen-split .gen-preview-card {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .gen-typography-toolbar {
      flex-shrink: 0;
      padding: 10px 12px;
      margin-bottom: 10px;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      background: rgba(255, 255, 255, 0.45);
    }

    .gen-typography-grid--toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      gap: 10px 14px;
    }

    .gen-typography-grid--toolbar > div {
      flex: 0 1 auto;
      min-width: 86px;
    }

    .gen-typography-grid--toolbar label {
      display: block;
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 4px;
    }

    .gen-typography-grid--toolbar select {
      min-width: 86px;
      font-size: 0.8rem;
      padding: 5px 8px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      background: var(--surface);
    }

    .upload-split.gen-split .gen-preview-card .gen-body-preview-block {
      flex: 1 1 0;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .upload-split.gen-split .gen-preview-card .gen-a4-viewport {
      flex: 1 1 0;
      min-height: 0;
      display: flex;
      justify-content: center;
      align-items: flex-start;
      overflow: hidden;
      padding: 4px 0 8px;
    }

    .upload-split.gen-split .gen-preview-card .gen-body-preview-text {
      flex: none;
      margin: 0;
      width: min(794px, 92%);
      height: min(100%, calc(min(794px, 92vw) * 297 / 210));
      max-height: min(calc(var(--workspace-panel-min-h) - 120px), calc(min(794px, 92vw) * 297 / 210));
      aspect-ratio: 210 / 297;
      font-size: var(--gen-font-size, 0.875rem);
      line-height: var(--gen-line-height, 1.75);
      color: var(--text-muted);
      white-space: pre-wrap;
      overflow-y: auto;
      overflow-x: hidden;
      background: #fff;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
      padding: 28px 32px;
      box-sizing: border-box;
    }

    .upload-split.gen-split .gen-preview-card .gen-body-preview-text.has-content {
      color: var(--text);
      white-space: normal;
    }

    .gen-body-preview-text.gen-body-preview-text--streaming {
      white-space: pre-wrap;
      color: var(--text);
    }

    .detect-report-preview.detect-report-preview--streaming {
      white-space: pre-wrap;
      font-size: 0.88rem;
      line-height: 1.65;
      color: var(--text);
    }

    .upload-split.gen-split .gen-preview-card.gen-preview-card--body-only .gen-body-preview-block {
      flex: 1 1 auto;
    }

    .upload-split.gen-split .gen-preview-card.gen-preview-card--body-only .gen-a4-viewport {
      padding-top: 8px;
    }

    .upload-split.gen-split .gen-preview-card .gen-body-export-tools {
      flex-shrink: 0;
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px solid var(--border);
    }

    .upload-split.gen-split .gen-preview-card .gen-body-export-tools .row-actions {
      margin-top: 0;
      gap: 8px;
    }

    .gen-typography-panel {
      flex-shrink: 0;
      padding: 10px 0 0;
      margin-top: 10px;
      border-top: 1px solid var(--border);
    }

    .gen-typography-panel label {
      display: block;
      font-size: 0.78rem;
      color: var(--text-muted);
      margin-bottom: 4px;
    }

    .gen-typography-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
      gap: 10px 8px;
    }

    .gen-typography-grid > div {
      min-width: 0;
    }

    .gen-typography-grid select {
      width: 100%;
      max-width: 100%;
      min-width: 0;
      font-size: 0.8rem;
      padding: 4px 6px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      background: var(--surface);
      box-sizing: border-box;
    }

    .gen-body-preview-text.has-content {
      font-family: var(--gen-font-family, "SimSun", "Songti SC", serif);
      font-size: var(--gen-font-size, 0.875rem);
      line-height: var(--gen-line-height, 1.5);
    }

    .gen-body-preview-text.has-content p,
    .gen-body-preview-text.has-content .gen-body-subline {
      font-family: var(--gen-font-family, "SimSun", "Songti SC", serif);
      font-size: var(--gen-font-size, 0.875rem);
    }

    .gen-body-preview-text .gen-chapter-heading,
    .gen-body-preview-text h2.gen-chapter-heading,
    .gen-body-preview-text h3.gen-chapter-heading,
    .gen-body-preview-text h4.gen-chapter-heading {
      font-family: var(--gen-heading-font-family, "SimHei", "Heiti SC", sans-serif);
      font-size: var(--gen-heading-size, 1.0625rem);
      font-weight: var(--gen-heading-weight, 600);
      color: var(--text);
    }

    .gen-body-preview-text.gen-preview--unified-heading .gen-chapter-heading {
      --gen-heading-weight: 500;
    }

    .gen-body-preview-text.gen-body-preview-text--editing {
      outline: 2px solid rgba(0, 82, 163, 0.35);
      outline-offset: 2px;
      cursor: text;
    }

    .gen-body-preview-text.gen-body-preview-text--editing .gen-chart-fig,
    .gen-body-preview-text.gen-body-preview-text--editing .gen-md-table {
      cursor: default;
      user-select: none;
    }

    .gen-body-preview-text.gen-body-preview-text--table-editing {
      outline: 2px solid rgba(5, 150, 105, 0.38);
      outline-offset: 2px;
      cursor: default;
    }

    .gen-body-preview-text.gen-body-preview-text--table-editing .gen-md-table th,
    .gen-body-preview-text.gen-body-preview-text--table-editing .gen-md-table td {
      cursor: text;
    }

    .gen-table-cell--editing {
      outline: 1px dashed rgba(5, 150, 105, 0.42);
      outline-offset: -1px;
    }

    .gen-body-preview-text.gen-body-preview-text--table-editing .gen-chart-fig {
      user-select: none;
      pointer-events: none;
    }

    .gen-body-export-tools .row-actions {
      flex-wrap: wrap;
    }

    .upload-split.gen-split .gen-preview-card .upload-col-footer {
      flex-shrink: 0;
    }

    .gen-split #gen-charts-out {
      white-space: pre-wrap;
      font-size: 0.85rem;
      line-height: 1.55;
      max-height: min(20vh, 200px);
      margin-top: 10px;
      overflow-y: auto;
    }

    .gen-body-preview-text .gen-chapter-heading {
      margin: 1em 0 0.5em;
    }

    .gen-body-preview-text p {
      margin: 0 0 var(--gen-para-gap, 0.65em);
      text-align: justify;
      text-indent: 2em;
    }

    .gen-body-preview-text .gen-body-subline {
      margin: 0.65em 0 0.35em;
      font-weight: 500;
      text-align: justify;
      text-indent: 2em;
    }

    .gen-body-preview-text .gen-body-clause {
      margin: 0 0 var(--gen-para-gap, 0.65em);
      font-weight: normal;
      text-align: justify;
      text-indent: 2em;
    }

    .gen-chart-fig {
      margin: 12px 0 16px;
      padding: 10px;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      background: var(--color-card);
      text-align: center;
    }

    .gen-chart-svg-wrap {
      overflow-x: auto;
      overflow-y: hidden;
    }

    .gen-chart-svg-wrap svg {
      display: block;
      max-width: 100%;
      width: auto;
      height: auto;
      margin: 0 auto;
    }

    .gen-chart-svg-wrap--flowchart svg {
      max-height: min(520px, 72vh);
      min-height: 180px;
    }

    .gen-chart-svg-wrap--gantt svg {
      max-height: min(440px, 58vh);
      min-height: 220px;
    }

    .gen-chart-svg-wrap--sequence svg {
      max-height: min(480px, 68vh);
      min-height: 200px;
    }

    .gen-chart-svg-wrap--pie svg {
      max-height: min(360px, 48vh);
      min-height: 160px;
    }

    .gen-chart-svg-wrap--fallback svg {
      max-height: 240px;
      min-height: 140px;
    }

    .gen-chart-fig--fallback .gen-chart-cap::after {
      content: "（示意）";
      margin-left: 4px;
      color: var(--text-muted);
      font-size: 0.75rem;
    }

    .gen-chart-cap {
      margin: 8px 0 0;
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .gen-chart-fig--err .gen-chart-err {
      color: var(--danger);
      font-size: 0.82rem;
    }

    .gen-chart-code {
      margin-top: 8px;
      padding: 8px;
      font-size: 0.75rem;
      text-align: left;
      white-space: pre-wrap;
      background: rgba(15, 23, 42, 0.04);
      border-radius: 8px;
      max-height: 120px;
      overflow: auto;
    }

    .gen-md-table {
      width: 100%;
      border-collapse: collapse;
      table-layout: fixed;
      font-family: var(--gen-font-family, "SimSun", "Songti SC", serif);
      font-size: var(--gen-font-size, 0.875rem);
      line-height: 1.45;
      margin: 4px 0 18px;
      background: #ffffff;
    }

    .gen-md-table th,
    .gen-md-table td {
      border: 1px solid #1f2937;
      padding: 7px 9px;
      text-align: left;
      vertical-align: middle;
      word-break: break-word;
      white-space: normal;
    }

    .gen-md-table th {
      background: #f3f4f6;
      font-family: var(--gen-heading-font-family, "SimHei", "Heiti SC", sans-serif);
      font-weight: 700;
      text-align: center;
    }

    .gen-table-caption {
      margin: 12px 0 6px;
      text-align: center;
      text-indent: 0;
      font-family: var(--gen-heading-font-family, "SimHei", "Heiti SC", sans-serif);
      font-size: var(--gen-font-size, 0.875rem);
      font-weight: 600;
      color: var(--text);
    }

    .gen-chart-fig p,
    .gen-md-table p {
      text-indent: 0;
    }

    .gen-body-sec--tables h4,
    .gen-body-sec--charts h4 {
      margin-top: 1.25em;
    }

    .gen-split .gen-preview-card .upload-col-footer {
      display: flex;
      justify-content: flex-end;
    }

    .gen-split .gen-chapters-scroll:has(#gen-chapter-list:not([hidden])) #gen-chapters-placeholder {
      display: none;
    }

    .gen-split .gen-chapter-list {
      list-style: none;
      margin: 0;
      padding: 0;
    }

    .gen-split .gen-chapter-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      margin-bottom: 6px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.45);
      border: 1px solid var(--border);
    }

    .gen-split .gen-chapter-item .gen-chapter-order {
      flex-shrink: 0;
      width: 1.6rem;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-muted);
      text-align: center;
    }

    .gen-split .gen-chapter-title-input {
      flex: 1 1 0;
      min-width: 0;
      padding: 6px 8px;
      font-size: 0.88rem;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: rgba(255, 255, 255, 0.7);
    }

    .gen-split .gen-chapter-actions {
      display: flex;
      flex-shrink: 0;
      gap: 4px;
    }

    .gen-split .gen-chapter-toolbar {
      margin-top: 10px;
    }

    .gen-split .gen-btn-save.is-dirty {
      border-color: rgba(var(--cscec-rgb), 0.45);
      color: var(--accent);
    }

    .detect-extract-block + .detect-extract-block {
      margin-top: 12px;
      padding-top: 12px;
      border-top: 1px dashed rgba(15, 23, 42, 0.1);
    }

    .detect-extract-block strong {
      display: block;
      font-size: 0.74rem;
      color: var(--text-muted);
      margin-bottom: 4px;
    }

    .detect-extract-block p {
      margin: 0;
      color: var(--text);
    }

    .detect-status-line {
      margin-top: 8px;
      font-size: 0.78rem;
      color: var(--text-muted);
    }

    .detect-report-card {
      display: flex;
      flex-direction: column;
      min-height: 0;
      padding: 22px 22px 20px;
    }

    #tab-panel-detect .detect-report-card {
      flex: 1 1 0;
      min-height: 0;
      margin-bottom: 0;
    }

    .detect-report-card h2 {
      margin: 0 0 12px;
    }

    .detect-report-preview {
      flex: 1 1 0;
      min-height: 0;
      overflow: auto;
      padding: 14px 16px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      background: rgba(255, 255, 255, 0.5);
    }

    #tab-panel-detect .detect-report-preview {
      flex: 1 1 0;
      min-height: 0;
      max-height: none;
    }

    .detect-report-head {
      margin-bottom: 16px;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--border);
    }

    .detect-score-row {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 10px 16px;
      font-size: 0.95rem;
    }

    .detect-score-row strong {
      font-size: 1.65rem;
      font-weight: 800;
      color: var(--accent);
      letter-spacing: -0.02em;
    }

    .detect-score-row .muted {
      font-size: 0.88rem;
      color: var(--text-muted);
      font-weight: 600;
    }

    .detect-summary-text {
      margin: 10px 0 0;
      font-size: 0.88rem;
      line-height: 1.6;
      color: var(--text);
    }

    .detect-item-list {
      list-style: none;
      margin: 0;
      padding: 0;
    }

    .detect-item-list li {
      padding: 14px 12px;
      margin-bottom: 10px;
      border-radius: var(--radius-md);
      background: rgba(255, 255, 255, 0.55);
      border: 1px solid var(--border);
    }

    .detect-item-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 8px;
      font-weight: 700;
      font-size: 0.9rem;
    }

    .detect-badge {
      font-size: 0.72rem;
      font-weight: 700;
      padding: 4px 10px;
      border-radius: 999px;
      flex-shrink: 0;
    }

    .detect-badge--ok {
      background: rgba(5, 150, 105, 0.14);
      color: var(--success);
    }

    .detect-badge--no {
      background: rgba(220, 38, 38, 0.12);
      color: var(--danger);
    }

    .detect-badge--mid {
      background: rgba(245, 158, 11, 0.16);
      color: #c2410c;
    }

    .detect-detail {
      margin: 0 0 8px;
      font-size: 0.84rem;
      line-height: 1.55;
      color: var(--text);
    }

    .detect-suggest {
      margin: 0;
      font-size: 0.82rem;
      line-height: 1.5;
      color: var(--text-muted);
    }

    .detect-suggest strong {
      color: var(--text);
    }

    .detect-md-report h1 {
      margin: 0 0 12px;
      font-size: 1.2rem;
    }

    .detect-md-report h2 {
      margin: 18px 0 10px;
      font-size: 1.05rem;
      color: var(--accent);
    }

    .detect-md-report h3 {
      margin: 14px 0 8px;
      font-size: 0.95rem;
    }

    .detect-md-report p,
    .detect-md-report li {
      font-size: 0.86rem;
      line-height: 1.55;
    }

    .detect-md-report ul {
      margin: 0 0 10px;
      padding-left: 1.2em;
    }

    .detect-report-actions {
      margin-top: 16px;
      padding-top: 14px;
      border-top: 1px solid var(--border);
    }

    .panel {
      padding: 22px 22px 24px;
      margin-bottom: 18px;
    }

    .panel h2 {
      margin: 0 0 16px;
      font-size: 1rem;
      font-weight: 700;
      color: var(--text);
    }

    .dropzone {
      border: 1.5px dashed var(--color-border);
      border-radius: var(--radius-md);
      padding: 28px 18px;
      text-align: center;
      background: var(--color-upload-bg);
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s;
    }

    #workspace .dropzone {
      padding: 18px 14px;
    }

    #workspace .dropzone .hint {
      margin-top: 6px;
    }

    #workspace .dropzone .file-line {
      margin-top: 8px;
    }

    .dropzone:hover,
    .dropzone.dragover {
      border-color: rgba(var(--cscec-rgb), 0.45);
      background: rgba(var(--cscec-rgb), 0.07);
    }

    .dropzone .hint {
      margin: 8px 0 0;
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .file-line {
      margin-top: 12px;
      font-size: 0.85rem;
      color: var(--text);
      word-break: break-all;
    }

    .upload-file-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 12px;
      font-size: 0.85rem;
      color: var(--text);
    }

    .upload-file-row[hidden] {
      display: none !important;
    }

    .upload-file-prefix {
      flex-shrink: 0;
      color: var(--text-muted);
    }

    .upload-file-name {
      flex: 1;
      min-width: 0;
      word-break: break-all;
    }

    .upload-file-action {
      flex-shrink: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 28px;
      min-height: 28px;
    }

    .upload-file-trash {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      height: 28px;
      padding: 0;
      border: none;
      border-radius: 8px;
      background: rgba(239, 68, 68, 0.08);
      color: #dc2626;
      cursor: pointer;
      font-size: 0.95rem;
      line-height: 1;
      transition: background 0.15s ease;
    }

    .upload-file-trash:hover {
      background: rgba(239, 68, 68, 0.16);
    }

    .upload-file-row.is-error .upload-file-name {
      color: #dc2626;
    }

    .row-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 16px;
    }

    .row-actions .btn {
      width: auto;
    }

    .result-placeholder {
      margin: 0;
      font-size: 0.9rem;
      color: var(--text-muted);
    }

    .result-body {
      display: none;
    }

    .result-body.visible {
      display: block;
    }

    .meta {
      font-size: 0.78rem;
      color: var(--text-muted);
      margin-bottom: 12px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--border);
      word-break: break-all;
    }

    .para-list {
      list-style: none;
      margin: 0;
      padding: 0;
      max-height: 400px;
      overflow-y: auto;
    }

    .para-list li {
      padding: 10px 12px;
      margin-bottom: 8px;
      border-radius: 10px;
      background: var(--color-main-bg);
      border: 1px solid var(--border);
      font-size: 0.88rem;
      line-height: 1.55;
    }

    .para-list li.empty {
      color: var(--text-muted);
      font-style: italic;
    }

    .visually-hidden-file {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      border: 0;
    }

    /* 知识库工具栏 */
    .kb-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      gap: 12px;
      margin-bottom: 18px;
    }

    .kb-toolbar .grow {
      flex: 1;
      min-width: 160px;
    }

    .kb-toolbar label {
      display: block;
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 5px;
    }

    .kb-toolbar input[type="search"],
    .kb-toolbar select {
      width: 100%;
      padding: 9px 12px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: rgba(255, 255, 255, 0.55);
      font-size: 0.9rem;
      font-family: inherit;
      color: var(--text);
      outline: none;
    }

    .kb-toolbar input:focus,
    .kb-toolbar select:focus {
      border-color: rgba(var(--cscec-rgb), 0.45);
    }

    #tab-panel-knowledge > .panel.glass-strong {
      display: flex;
      flex-direction: column;
      min-height: var(--workspace-panel-min-h);
      margin-bottom: 0;
      padding-bottom: 20px;
    }

    #tab-panel-knowledge .kb-cards {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 14px;
      flex: 1 1 0;
      min-height: 0;
      overflow-y: auto;
      align-content: start;
    }

    .kb-cards {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 14px;
    }

    .kb-card {
      border-radius: var(--radius-md);
      border: 1px solid var(--border);
      background: var(--color-card);
      padding: 14px 16px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      min-height: 140px;
    }

    .kb-card-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
    }

    .kb-card-title {
      margin: 0;
      font-size: 0.98rem;
      font-weight: 700;
      color: var(--text);
      line-height: 1.35;
      flex: 1;
    }

    .kb-badge {
      flex-shrink: 0;
      font-size: 0.68rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 4px 8px;
      border-radius: 6px;
      background: rgba(var(--cscec-rgb), 0.12);
      color: var(--accent);
    }

    .kb-preview {
      margin: 0;
      font-size: 0.82rem;
      color: var(--text-muted);
      line-height: 1.5;
      flex: 1;
      display: -webkit-box;
      -webkit-line-clamp: 4;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .kb-card-actions {
      display: flex;
      gap: 8px;
      margin-top: auto;
      padding-top: 4px;
    }

    .kb-empty {
      text-align: center;
      padding: 36px 16px;
      color: var(--text-muted);
      font-size: 0.9rem;
    }

    .kb-upload-block {
      margin-bottom: 18px;
    }

    .kb-upload-block .kb-upload-meta {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      gap: 12px;
      margin-bottom: 10px;
    }

    .kb-upload-block .kb-upload-meta label {
      display: block;
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 5px;
    }

    .kb-upload-block .kb-upload-meta select {
      min-width: 140px;
      padding: 9px 12px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: rgba(255, 255, 255, 0.55);
      font-size: 0.9rem;
      font-family: inherit;
    }

    #kb-dropzone {
      min-height: 88px;
    }

    .kb-parse-modal .modal-dialog {
      text-align: center;
      max-width: 380px;
    }

    .kb-parse-spinner {
      width: 40px;
      height: 40px;
      margin: 8px auto 16px;
      border: 3px solid rgba(var(--cscec-rgb), 0.15);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: kb-spin 0.85s linear infinite;
    }

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

    .kb-parse-modal p {
      margin: 0;
      font-size: 0.9rem;
      color: var(--text-muted);
      line-height: 1.55;
    }

    /* 弹窗 */
    .modal-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 1000;
      background: rgba(15, 23, 42, 0.45);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      align-items: center;
      justify-content: center;
      padding: 20px;
    }

    .modal-backdrop.is-open {
      display: flex;
    }

    .modal-dialog {
      width: 100%;
      max-width: 440px;
      max-height: 90vh;
      overflow-y: auto;
      padding: 24px 22px 22px;
      border-radius: var(--radius-lg);
    }

    .modal-dialog h3 {
      margin: 0 0 18px;
      font-size: 1.1rem;
      font-weight: 700;
    }

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

    .modal-actions .btn {
      flex: 1;
      margin-top: 0;
    }

    footer {
      text-align: center;
      margin-top: 24px;
      font-size: 0.75rem;
      color: rgba(255, 255, 255, 0.72);
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    }

    /* IP 立体小对话窗 */
    #ip-chat-widget {
      position: fixed;
      right: 14px;
      bottom: 14px;
      z-index: 1100;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 12px;
      pointer-events: none;
    }

    body:not(.is-authenticated) #ip-chat-widget {
      display: none !important;
    }

    #ip-chat-widget > * {
      pointer-events: auto;
    }

    .ip-chat-panel {
      width: 300px;
      height: 380px;
      display: none;
      flex-direction: column;
      background: linear-gradient(165deg, #ffffff 0%, #f4f8fc 100%);
      border: 1px solid rgba(var(--cscec-rgb), 0.18);
      border-radius: 16px;
      box-shadow:
        0 22px 48px rgba(0, 40, 90, 0.22),
        0 4px 14px rgba(0, 82, 163, 0.12);
      overflow: hidden;
    }

    .ip-chat-panel.is-open {
      display: flex;
    }

    .ip-chat-panel-header {
      flex-shrink: 0;
      padding: 14px 16px;
      background: var(--color-primary);
      color: var(--color-btn-text);
    }

    .ip-chat-panel-header h4 {
      margin: 0;
      font-size: 0.95rem;
      font-weight: 700;
    }

    .ip-chat-panel-header p {
      margin: 4px 0 0;
      font-size: 0.72rem;
      opacity: 0.88;
    }

    .ip-chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 14px 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      background: var(--color-main-bg);
    }

    .ip-chat-msg {
      max-width: 88%;
      padding: 9px 12px;
      border-radius: 12px;
      font-size: 0.82rem;
      line-height: 1.55;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .ip-chat-msg--user {
      align-self: flex-end;
      background: var(--color-primary);
      color: var(--color-btn-text);
      border-bottom-right-radius: 4px;
    }

    .ip-chat-msg--bot {
      align-self: flex-start;
      background: var(--color-upload-bg);
      color: var(--color-text);
      border-bottom-left-radius: 4px;
    }

    .ip-chat-msg--typing {
      opacity: 0.7;
      font-style: italic;
    }

    .ip-chat-input-row {
      flex-shrink: 0;
      display: flex;
      gap: 8px;
      padding: 10px 12px 12px;
      border-top: 1px solid rgba(15, 23, 42, 0.08);
      background: #fff;
    }

    .ip-chat-input-row input {
      flex: 1;
      border: 1px solid rgba(var(--cscec-rgb), 0.22);
      border-radius: 10px;
      padding: 9px 12px;
      font-size: 0.84rem;
      font-family: inherit;
      outline: none;
    }

    .ip-chat-input-row input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(var(--cscec-rgb), 0.12);
    }

    .ip-chat-send {
      flex-shrink: 0;
      border: none;
      border-radius: 10px;
      padding: 0 14px;
      font-size: 0.82rem;
      font-weight: 600;
      font-family: inherit;
      cursor: pointer;
      background: var(--color-primary);
      color: var(--color-btn-text);
    }

    .ip-chat-send:hover:not(:disabled) {
      background: var(--color-primary-hover);
    }

    .ip-chat-send:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    .ip-chat-avatar-wrap {
      position: relative;
      width: 100px;
      height: 110px;
      cursor: pointer;
      user-select: none;
    }

    .ip-chat-avatar-shadow {
      position: absolute;
      left: 50%;
      bottom: 2px;
      width: 72px;
      height: 14px;
      margin-left: -50px;
      background: radial-gradient(ellipse, rgba(0, 40, 90, 0.38) 0%, transparent 72%);
      border-radius: 50%;
      pointer-events: none;
    }

    .ip-chat-avatar {
      position: relative;
      z-index: 1;
      width: 100px;
      height: auto;
      display: block;
      filter: drop-shadow(0 10px 18px rgba(0, 50, 110, 0.35));
      transform-origin: center bottom;
      animation: ip-chat-breathe 3.2s ease-in-out infinite;
    }

    @keyframes ip-chat-breathe {
      0%, 100% { transform: scale(1); }
      50% { transform: scale(1.03); }
    }

    .ip-chat-avatar-wrap:focus-visible {
      outline: 2px solid #fff;
      outline-offset: 4px;
      border-radius: 12px;
    }

    footer code {
      color: rgba(186, 220, 255, 0.95);
      background: rgba(0, 0, 0, 0.15);
      padding: 0.1em 0.35em;
      border-radius: 4px;
      font-size: 0.72rem;
    }
