
/* ========== W1 多页签工作台：页签栏 ========== */
.tabbar {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  z-index: 4;
  scrollbar-width: thin;
}
.tabbar::-webkit-scrollbar { height: 4px; }
.wb-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px 0 12px;
  max-width: 180px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  transition: all 0.15s ease;
}
.wb-tab:hover {
  background: rgba(0,122,255,0.06);
  color: var(--apple-blue);
}
.wb-tab.active {
  background: rgba(0,122,255,0.1);
  border-color: rgba(0,122,255,0.3);
  color: var(--apple-blue);
  font-weight: 600;
}
.wb-tab .wb-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-tab .wb-tab-close {
  width: 16px;
  height: 16px;
  line-height: 15px;
  text-align: center;
  border-radius: 50%;
  font-size: 13px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.wb-tab .wb-tab-close:hover {
  background: rgba(0,0,0,0.1);
  color: var(--apple-red);
}
/* W7-3：页签内刷新符（↻）。窄页签下默认收窄不占位，仅 hover 页签 / 激活页签时显现，
   × 保持常显，两者并存不挤。点击旋转反馈交互层。 */
.wb-tab .wb-tab-refresh {
  width: 0;
  overflow: hidden;
  height: 16px;
  line-height: 15px;
  text-align: center;
  border-radius: 50%;
  font-size: 13px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease, width 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.wb-tab:hover .wb-tab-refresh,
.wb-tab.active .wb-tab-refresh {
  width: 16px;
  opacity: 1;
}
.wb-tab .wb-tab-refresh:hover {
  background: rgba(0,122,255,0.12);
  color: var(--apple-blue);
}
.wb-tab .wb-tab-refresh:active { transform: rotate(180deg); }
/* W7-3：页签栏最右侧批量操作入口（⋯）——sticky 贴右缘，固定可见不随页签滚动。
   margin-left:auto 把它推到行尾；sticky right:0 让它在横向滚动时钉在右侧。 */
.wb-tab-batch {
  position: sticky;
  right: 0;
  margin-left: auto;
  flex-shrink: 0;
  width: 28px;
  height: 26px;
  line-height: 1;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  /* 盖住滚到其下的页签边缘，视觉分隔 */
  box-shadow: -8px 0 8px -4px rgba(0,0,0,0.06);
}
.wb-tab-batch:hover {
  background: rgba(0,122,255,0.08);
  color: var(--apple-blue);
  border-color: rgba(0,122,255,0.3);
}

/* W1 页签右键菜单 */
.wb-tab-menu {
  position: fixed;
  z-index: 3000;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 132px;
  display: none;
}
.wb-tab-menu.active { display: block; }
.wb-tab-menu .wb-menu-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.wb-tab-menu .wb-menu-item:hover {
  background: rgba(0,122,255,0.08);
  color: var(--apple-blue);
}
.wb-tab-menu .wb-menu-item.disabled {
  color: var(--text-tertiary);
  cursor: default;
}
.wb-tab-menu .wb-menu-item.disabled:hover {
  background: transparent;
  color: var(--text-tertiary);
}

/* 校验失败修正卡片 */
.validation-card {
  background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
  border: 1.5px solid var(--apple-red);
  border-radius: var(--radius-xl);
  padding: 16px;
  margin: 8px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.validation-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--apple-red);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-light);
}
.validation-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  border: 1px solid var(--border-light);
}
.validation-item-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}
.validation-item-raw {
  font-size: 12px;
  color: var(--text-secondary);
}
.validation-item-raw span {
  color: var(--apple-red);
  font-weight: 600;
  text-decoration: line-through;
}
.validation-item input {
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.validation-item input:focus {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}
.validation-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.validation-btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.validation-btn.submit {
  background: var(--apple-blue);
  color: #fff;
}
.validation-btn.submit:hover { background: #0056CC; }
.validation-btn.cancel {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* 快捷指令 */
.ai-quick-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
  background: rgba(255,255,255,0.5);
  align-items: center;
}
.ai-quick-actions .chip {
  padding: 4px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.15s;
  position: relative;
}
.ai-quick-actions .chip:hover {
  background: #eef2ff;
  border-color: var(--apple-blue);
  color: var(--apple-blue);
}
.ai-quick-actions .chip.pinned::before {
  content: '📌';
  font-size: 9px;
  margin-right: 2px;
}
.ai-quick-actions .chip.system {
  background: linear-gradient(135deg, #E0E7FF 0%, #F0E6FF 100%);
  border-color: var(--apple-purple);
  color: var(--apple-purple);
}
.ai-quick-actions .more-btn {
  padding: 4px 10px;
  background: var(--bg-primary);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.ai-quick-actions .more-btn:hover {
  border-color: var(--apple-blue);
  color: var(--apple-blue);
}
.ai-quick-actions .settings-btn {
  margin-left: auto;
  padding: 4px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-tertiary);
}
.ai-quick-actions .settings-btn:hover { color: var(--apple-blue); }


/* 分类下拉菜单 */
.cat-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.cat-dropdown.active { display: block; }
.cat-dropdown .cat-group {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.cat-dropdown .cat-group:last-child { border-bottom: none; }
.cat-dropdown .cat-title {
  padding: 4px 12px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
}
.cat-dropdown .cat-item {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cat-dropdown .cat-item:hover { background: #eef2ff; }
.cat-dropdown .cat-item .cat-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--apple-purple);
  color: #fff;
  margin-left: auto;
}

/* 快捷指令管理弹窗 */
.quick-settings-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 1002;
  display: none;
  align-items: center;
  justify-content: center;
}
.quick-settings-overlay.active { display: flex; }
.quick-settings-panel {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}
.quick-settings-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.quick-settings-header h4 { font-size: 16px; font-weight: 600; margin: 0; }
.quick-settings-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

/* 快捷指令卡片 */
.qa-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.15s;
}
.qa-card:hover { border-color: var(--apple-blue); }
.qa-card.pinned { border-left: 3px solid var(--apple-blue); }
.qa-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.qa-card-header input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
}
.qa-card-header .qa-pin {
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.qa-card-header .qa-del {
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--apple-red);
}
.qa-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.qa-card-meta .meta-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.qa-card-meta .meta-tag.query { background: #E8F4FD; color: #007AFF; }
.qa-card-meta .meta-tag.create { background: #FFF3E0; color: #FF9500; }
.qa-card-params {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 6px 10px;
  background: rgba(0,0,0,0.02);
  border-radius: var(--radius-sm);
}
.qa-card-params label {
  font-size: 11px;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 2px;
}
.qa-card-params input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 4px;
}

/* 系统推荐卡片 */
.qa-card.system-card {
  background: linear-gradient(135deg, #F8F5FF 0%, #F0F4FF 100%);
  border-color: #DDD6FE;
}
.qa-card.system-card .system-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: var(--apple-purple);
  color: #fff;
  border-radius: 10px;
}

/* 添加模板选择器 */
.template-picker {
  background: var(--bg-primary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.template-picker .tp-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.template-picker .tp-group {
  margin-bottom: 10px;
}
.template-picker .tp-group-title {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  font-weight: 600;
}
.template-picker .tp-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.template-picker .tp-option {
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.template-picker .tp-option:hover,
.template-picker .tp-option.selected {
  border-color: var(--apple-blue);
  background: #eef2ff;
  color: var(--apple-blue);
}
.template-picker .tp-preview {
  margin-top: 10px;
  padding: 10px;
  background: #fff;
  border-radius: var(--radius-md);
  font-size: 13px;
}
.template-picker .tp-preview label {
  font-size: 11px;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 4px;
}
.template-picker .tp-preview input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 6px;
}

.quick-settings-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #C7C7CC; }

/* ========== Mobile / PWA ========== */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}
.mobile-menu-btn:active { background: rgba(0,0,0,0.06); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }
  .header {
    padding: 0 16px;
    height: 52px;
  }
  .header h2 { font-size: 16px; }
  #user-info { display: none; }
  .btn-logout {
    padding: 5px 10px;
    font-size: 12px;
  }
  .tabbar { padding: 0 8px; height: 40px; }

}

@media (max-width: 768px) and (display-mode: standalone) {
  .header {

    height: 52px;
  }
}
