
/* ============================================================
   Folder Picker styles
   通过将 composer 改成"只上圆角"，并让 wrap 成为"只下圆角"，
   两者共用同一边框颜色，从视觉上焊接成一张卡片。
   ============================================================ */

/* composer 接上 folder picker 时去掉底部圆角和下方阴影，与 wrap 拼合 */
.planb-composer[data-lingee-folder-picker="true"][data-lingee-enhanced="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: rgba(15, 23, 42, 0.06);
  box-shadow: none;
}
.planb-composer[data-lingee-folder-picker="true"][data-lingee-enhanced="true"]:focus-within {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.05);
}

/* 开发 Tab 输入框（develop-composer）与「本地/云端 文件选择」行焊接成一张卡片 */
.develop-composer[data-lingee-folder-picker="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: #eaeef2;
  box-shadow: none;
}
.develop-composer[data-lingee-folder-picker="true"] + .lfp-wrap {
  border-color: #eaeef2;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
  /* 与输入框同宽（父级为居中 flex 列，需强制铺满并左对齐内容） */
  width: 100%;
  align-self: stretch;
  box-sizing: border-box;
  justify-content: flex-start;
}

/* wrap：作为 composer 的兄弟节点紧贴在下方 */
.lfp-wrap {
  position: relative;
  display: flex;
  align-items: center;
  /* 窄窗口下允许换行：宁可折到第二行，也不要把右侧的授权 chip 挤没 */
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 8px;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-top: 0;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(30, 64, 175, 0.06);
  font-family: inherit;
  color: #1f2328;
  z-index: 1;
}

/* 空间不足时优先压缩「选择文件夹」（文件夹名可省略号），存储位置 chip 保持完整 */
.lfp-wrap > .lfp-trigger:not(.lfp-folderchip) { flex: 0 0 auto; }
.lfp-folderchip { flex: 0 1 auto; min-width: 96px; }

/* ---------- 触发按钮（细描边 chip） ---------- */
.lfp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  max-width: 260px;
  padding: 0 12px 0 11px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #2c2c2b;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.lfp-trigger:hover {
  background: #f5f5f4;
  border-color: rgba(15, 23, 42, 0.18);
}
.lfp-trigger[aria-expanded="true"] {
  background: #f0f0ee;
  border-color: rgba(15, 23, 42, 0.22);
}
.lfp-trigger__icon {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: #8a8a87;
}
.lfp-trigger:hover .lfp-trigger__icon,
.lfp-trigger.is-selected .lfp-trigger__icon {
  color: #5d5d5b;
}
.lfp-trigger__label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 400;
}
.lfp-trigger__caret {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: #b4b4b1;
  transition: transform 140ms ease;
}
.lfp-trigger[aria-expanded="true"] .lfp-trigger__caret {
  transform: rotate(180deg);
}

/* ---------- 下拉面板（向上弹出） ---------- */
.lfp-panel {
  position: absolute;
  left: 12px;
  top: calc(100% + 4px);
  width: 244px;
  max-height: min(60vh, 360px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12),
              0 2px 6px rgba(15, 23, 42, 0.04);
  transform-origin: top left;
  z-index: 80;
}
.lfp-panel.is-open {
  display: flex;
  animation: lfp-pop 140ms ease-out;
}
@keyframes lfp-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 搜索 ---------- */
.lfp-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 6px;
}
.lfp-search__icon {
  display: inline-flex;
  color: #b4b4b1;
  flex: 0 0 auto;
}
.lfp-search__input {
  flex: 1;
  height: 26px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: #1f2328;
  outline: none;
}
.lfp-search__input::placeholder { color: #b4b4b1; }
.lfp-search__clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b4b4b1;
  cursor: pointer;
}
.lfp-search__clear:hover { background: #f3f3f2; color: #5d5d5b; }

/* ---------- 列表 ---------- */
.lfp-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 2px 6px 6px;
}
.lfp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #2c2c2b;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
}
.lfp-item + .lfp-item { margin-top: 1px; }
.lfp-item:hover { background: #f3f3f2; }
.lfp-item.is-selected { background: #ececeb; }
.lfp-item__icon { display: inline-flex; color: #8a8a87; flex: 0 0 auto; }
.lfp-item__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.lfp-item__check { display: none; color: #5d5d5b; flex: 0 0 auto; }
.lfp-item.is-selected .lfp-item__check { display: inline-flex; }

.lfp-empty {
  display: none;
  padding: 14px 12px 18px;
  text-align: center;
  font-size: 12px;
  color: #b4b4b1;
}

/* ---------- 底部 新建文件夹 ---------- */
.lfp-footer { padding: 4px 6px 6px; }
.lfp-create {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: #2c2c2b;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
}
.lfp-create:hover,
.lfp-create.is-active { background: #f3f3f2; }
.lfp-create.is-hidden { display: none; }
.lfp-create__lead { display: inline-flex; align-items: center; gap: 8px; }
.lfp-create__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5d5d5b;
}
.lfp-create__caret { display: inline-flex; color: #b4b4b1; }

/* 子菜单（右侧） */
.lfp-submenu {
  position: absolute;
  left: calc(100% + 6px);
  bottom: -6px;
  width: 180px;
  display: none;
  padding: 6px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12),
              0 2px 6px rgba(15, 23, 42, 0.04);
}
.lfp-submenu.is-open {
  display: block;
  animation: lfp-sub-in 120ms ease-out;
}
@keyframes lfp-sub-in {
  from { opacity: 0; transform: translateX(-3px); }
  to   { opacity: 1; transform: translateX(0); }
}
.lfp-submenu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: #2c2c2b;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
}
.lfp-submenu__item + .lfp-submenu__item { margin-top: 1px; }
.lfp-submenu__item:hover { background: #f3f3f2; }
.lfp-submenu__icon { display: inline-flex; color: #5d5d5b; flex: 0 0 auto; }

/* 内联新建输入 */
.lfp-create-input {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px;
}
.lfp-create-input.is-open { display: flex; }
.lfp-create-input__field {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #e5e5e3;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: #1f2328;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.lfp-create-input__field:focus {
  border-color: #b4b4b1;
  box-shadow: 0 0 0 3px rgba(180, 180, 177, 0.18);
}
.lfp-create-input__btn {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: #2c2c2b;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease;
}
.lfp-create-input__btn:hover { background: #1f1f1e; }
.lfp-create-input__cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8a8a87;
  cursor: pointer;
}
.lfp-create-input__cancel:hover { background: #f3f3f2; color: #2c2c2b; }

/* ---------- 一级菜单：本地 / 云端 ---------- */
.lfp-root {
  display: none;
  flex-direction: column;
  padding: 6px;
}
.lfp-root.is-open { display: flex; }
.lfp-root-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  color: #2c2c2b;
  text-align: left;
  cursor: pointer;
  transition: background 100ms ease;
}
.lfp-root-item + .lfp-root-item { margin-top: 2px; }
.lfp-root-item:hover { background: #f3f3f2; }
.lfp-root-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #f4f4f3;
  color: #5d5d5b;
}
.lfp-root-item:hover .lfp-root-item__icon { background: #ececeb; }
.lfp-root-item__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lfp-root-item__title { font-size: 13px; font-weight: 500; line-height: 1.2; }
.lfp-root-item__sub { font-size: 11px; color: #b4b4b1; line-height: 1.2; }
.lfp-root-item__caret { display: inline-flex; color: #cfcfcc; flex: 0 0 auto; }
/* 选中态：当前存储源（云端/本地）高亮 + 右侧勾选（无箭头），与列表项选中态一致 */
.lfp-root-item__check { display: none; color: var(--green-11); flex: 0 0 auto; }
.lfp-root-item.is-current { background: rgb(var(--gray-12-rgb), 0.05); }
.lfp-root-item.is-current .lfp-root-item__check { display: inline-flex; }

/* ---------- 云端视图 ---------- */
.lfp-cloud {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.lfp-cloud.is-open { display: flex; }
.lfp-back {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 9px 10px 5px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  color: #8a8a87;
  cursor: pointer;
}
.lfp-back:hover { color: #5d5d5b; }
.lfp-back__icon { display: inline-flex; }

/* ============================================================
   Auth Picker —— 「选择文件夹」右侧的授权模式下拉
   与 .lfp-trigger 同款细描边 chip；面板向上弹出，无图标，
   默认选中「请求批准」。
   ============================================================ */
.lap-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  /* 间距由 .lfp-wrap 的 gap 统一控制 */
  margin-left: 0;
  /* 永不被压缩：云端文件夹名较长时也要完整显示「请求批准」 */
  flex: 0 0 auto;
}
/* 存储位置联动：
   · 本地 → 「选择文件夹」+「请求批准」两枚 chip 全部展示
   · 云端 → 两枚 chip 都隐藏（云端不涉及本机文件夹与本机访问授权）
   用 !important 兜底，防止外挂模块把授权 chip display:none 掉
   （整行 .lfp-wrap 被隐藏的场景不受影响，父级隐藏时子级不显示） */
.lfp-wrap:not(.lfp-wrap--cloud) > .lap-wrap { display: inline-flex !important; }
.lfp-wrap.lfp-wrap--cloud > .lap-wrap,
.lfp-wrap.lfp-wrap--cloud > .lfp-folderchip { display: none !important; }
.lap-trigger { flex: 0 0 auto; }

/* 触发按钮（与文件夹 chip 同款 outline chip，无前置图标） */
.lap-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  max-width: 200px;
  padding: 0 9px 0 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #2c2c2b;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.lap-trigger:hover {
  background: #f5f5f4;
  border-color: rgba(15, 23, 42, 0.18);
}
.lap-trigger[aria-expanded="true"] {
  background: #f0f0ee;
  border-color: rgba(15, 23, 42, 0.22);
}
.lap-trigger__icon {
  display: inline-flex;
  align-items: center;
  color: #6b7280;
  flex: 0 0 auto;
}
.lap-trigger.is-full .lap-trigger__icon { color: #2c2c2b; }
.lap-trigger__label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 400;
}
.lap-trigger__caret {
  display: inline-flex;
  align-items: center;
  color: #b4b4b1;
  flex: 0 0 auto;
  transition: transform 140ms ease;
}
.lap-trigger[aria-expanded="true"] .lap-trigger__caret {
  transform: rotate(180deg);
}

/* 下拉面板（向上弹出） */
.lap-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  width: 260px;
  display: none;
  flex-direction: column;
  padding: 14px 14px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14),
              0 2px 6px rgba(15, 23, 42, 0.04);
  transform-origin: bottom left;
  z-index: 90;
}
.lap-panel.is-open {
  display: flex;
  animation: lap-pop 140ms ease-out;
}
@keyframes lap-pop {
  from { opacity: 0; transform: translateY(4px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 授权模式选择面板（三选一） */
/* 字号整体收一档：与触发 chip（13px）对齐，标题 13 / 描述 12，
   面板留白同步收紧，让三个选项更紧凑、层级更轻。 */
.lap-panel--modes {
  width: 328px;
  padding: 10px 10px 8px;
  gap: 1px;
}
.lap-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 6px 6px;
}
.lap-panel__title {
  color: #8a8f98;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}
.lap-panel__more {
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: #6b7280;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.lap-panel__more:hover { color: #1f2328; }

/* 单个模式选项 */
.lap-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #1f2328;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 130ms ease;
}
.lap-option:hover { background: #f5f5f4; }
.lap-option__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 17px;
  margin-top: 1px;
  color: #3f3f46;
}
/* 图标随字号一起收小（覆盖 svg 内联 width/height） */
.lap-option__icon svg { width: 17px; height: 17px; }
.lap-option__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
}
.lap-option__title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2328;
  line-height: 1.45;
}
.lap-option__desc {
  font-size: 12px;
  color: #8a8f98;
  line-height: 1.5;
}
.lap-option__check {
  display: none;
  flex: 0 0 auto;
  margin-top: 2px;
}
.lap-option__check svg { width: 14px; height: 14px; }
/* 选中态参考「模型选择」浮层：灰色细腻底纹 + 绿色对号；危险项保持橙色 */
.lap-option.is-selected { background: rgb(var(--gray-12-rgb), 0.05); }
.lap-option.is-selected:hover { background: rgb(var(--gray-12-rgb), 0.05); }
.lap-option.is-selected .lap-option__check { display: inline-flex; color: var(--green-11); }
.lap-option.is-danger.is-selected .lap-option__check { color: #e2680f; }

/* 危险项（完全访问权限）用橙色强调 */
.lap-option.is-danger .lap-option__icon,
.lap-option.is-danger .lap-option__title,
.lap-option.is-danger .lap-option__desc { color: #e2680f; }
.lap-option.is-danger:hover { background: #fff4ec; }
.lap-option.is-danger.is-selected,
.lap-option.is-danger.is-selected:hover { background: #fff4ec; }

/* 触发 chip：完全访问权限时用橙色警示 */
.lap-trigger.is-full { color: #e2680f; border-color: rgba(226, 104, 15, 0.4); }
.lap-trigger.is-full .lap-trigger__icon { color: #e2680f; }

/* ============================================================
   知识库 chip —— 从输入框迁移到「选择文件夹」行，靠右对齐，
   统一成与文件夹/授权 chip 一致的 outline 外观。
   ============================================================ */
.lfp-wrap .lingee-kb-wrap {
  order: 9;
  margin-left: auto;
}
.lfp-wrap .lingee-kb-wrap .lingee-enhanced-tool {
  height: 28px;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #2c2c2b;
  font-size: 13px;
}
.lfp-wrap .lingee-kb-wrap .lingee-enhanced-tool:hover {
  color: #2c2c2b;
  background: #f5f5f4;
  border-color: rgba(15, 23, 42, 0.18);
}
.lfp-wrap .lingee-kb-wrap .lingee-enhanced-tool[aria-expanded="true"] {
  color: #2c2c2b;
  background: #f0f0ee;
  border-color: rgba(15, 23, 42, 0.22);
}
/* 隐藏「选择文件夹」行右侧的「知识库」chip（保留其逻辑，仅不显示） */
.lfp-wrap .lingee-kb-wrap { display: none !important; }

