/* ===== LLM 配置弹窗 ===== */
.llm-cfg-wrap {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.llm-cfg-overlay {
  position: absolute; inset: 0;
  background: rgba(20, 16, 10, 0.55);
  backdrop-filter: blur(4px);
}
.llm-cfg-modal {
  position: relative;
  width: min(92vw, 480px);
  max-height: 88vh;
  overflow: hidden;
  background: #FAF7F0;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(20, 16, 10, 0.35);
  display: flex; flex-direction: column;
  font-family: 'Noto Sans SC', 'PingFang SC', system-ui, sans-serif;
}
.llm-cfg-head {
  padding: 22px 24px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(20, 16, 10, 0.08);
}
.llm-cfg-head h3 {
  margin: 0;
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 700;
  color: #1A1714;
  letter-spacing: 2px;
}
.llm-cfg-x {
  width: 32px; height: 32px;
  border: none; background: transparent;
  font-size: 22px; line-height: 1;
  cursor: pointer; color: #5C544A;
  border-radius: 50%;
  transition: background 0.15s;
}
.llm-cfg-x:hover { background: rgba(0,0,0,0.06); }
.llm-cfg-body {
  padding: 18px 24px;
  overflow-y: auto;
  flex: 1;
}
.llm-cfg-row {
  margin-bottom: 18px;
}
.llm-cfg-label {
  display: block;
  font-size: 13px;
  color: #5C544A;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.llm-cfg-static {
  font-size: 14px;
  color: #1A1714;
  padding: 8px 0;
}
.llm-cfg-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: 'SF Mono', 'Menlo', monospace;
  border: 1px solid rgba(20, 16, 10, 0.15);
  border-radius: 10px;
  background: #fff;
  color: #1A1714;
  outline: none;
  transition: all 0.15s;
  box-sizing: border-box;
}
.llm-cfg-input:focus {
  border-color: #C89B40;
  box-shadow: 0 0 0 3px rgba(200, 155, 64, 0.12);
}
select.llm-cfg-input {
  font-family: inherit;
  cursor: pointer;
}
.llm-cfg-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #8A8278;
  line-height: 1.5;
}
.llm-cfg-hint code {
  font-family: 'SF Mono', monospace;
  background: rgba(200, 155, 64, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  color: #A07725;
}
.llm-cfg-hint a {
  color: #C89B40;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 开关 */
.llm-cfg-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.llm-cfg-toggle .llm-cfg-label {
  margin-bottom: 0;
}
.llm-cfg-toggle .llm-cfg-hint {
  flex-basis: 100%;
  margin-top: 4px;
}
.llm-cfg-switch {
  position: relative;
  width: 44px; height: 24px;
  display: inline-block;
}
.llm-cfg-switch input {
  position: absolute;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
  z-index: 2;
}
.llm-cfg-switch-slider {
  position: absolute; inset: 0;
  background: #D4CDC0;
  border-radius: 999px;
  transition: background 0.2s;
}
.llm-cfg-switch-slider::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.llm-cfg-switch input:checked + .llm-cfg-switch-slider {
  background: #C89B40;
}
.llm-cfg-switch input:checked + .llm-cfg-switch-slider::before {
  transform: translateX(20px);
}

/* 警告 */
.llm-cfg-warn {
  margin-top: 18px;
  padding: 12px 14px;
  background: rgba(200, 155, 64, 0.08);
  border-left: 3px solid rgba(200, 155, 64, 0.7);
  border-radius: 6px;
  font-size: 12px;
  color: #5C544A;
  line-height: 1.7;
}
.llm-cfg-warn b { color: #1A1714; }

/* 底部按钮 */
.llm-cfg-foot {
  padding: 14px 24px 20px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid rgba(20, 16, 10, 0.06);
}
.llm-cfg-btn {
  padding: 10px 22px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 1px;
}
.llm-cfg-btn-ghost {
  background: transparent;
  color: #5C544A;
  border-color: rgba(20, 16, 10, 0.15);
}
.llm-cfg-btn-ghost:hover { background: rgba(0,0,0,0.04); }
.llm-cfg-btn-primary {
  background: linear-gradient(135deg, #C89B40, #A07725);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(200, 155, 64, 0.3);
}
.llm-cfg-btn-primary:hover { transform: translateY(-1px); }

/* Toast */
.llm-toast {
  position: fixed;
  left: 50%; bottom: 80px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 16, 10, 0.92);
  color: #FAF7F0;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  letter-spacing: 0.5px;
}
.llm-toast.is-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 顶栏齿轮按钮 */
.llm-cfg-trigger {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #5C544A;
  cursor: pointer;
  transition: all 0.15s;
}
.llm-cfg-trigger:hover {
  background: rgba(0,0,0,0.06);
  color: #1A1714;
}
.llm-cfg-trigger svg {
  width: 18px; height: 18px;
}
.llm-cfg-trigger.has-key::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  background: #4CAF50;
  border-radius: 50%;
  margin-top: -10px;
  margin-left: 8px;
}

/* 深色 */
[data-theme="dark"] .llm-cfg-modal { background: #14110C; }
[data-theme="dark"] .llm-cfg-head h3 { color: #EDE8DC; }
[data-theme="dark"] .llm-cfg-head { border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .llm-cfg-x { color: #B5AFA0; }
[data-theme="dark"] .llm-cfg-x:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .llm-cfg-label { color: #B5AFA0; }
[data-theme="dark"] .llm-cfg-static { color: #EDE8DC; }
[data-theme="dark"] .llm-cfg-input {
  background: #1F1B12;
  border-color: rgba(255,255,255,0.1);
  color: #EDE8DC;
}
[data-theme="dark"] .llm-cfg-hint { color: #6E6759; }
[data-theme="dark"] .llm-cfg-hint code { background: rgba(229, 193, 106, 0.15); color: #E5C16A; }
[data-theme="dark"] .llm-cfg-foot { border-top-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .llm-cfg-btn-ghost { color: #B5AFA0; border-color: rgba(255,255,255,0.15); }
[data-theme="dark"] .llm-cfg-btn-ghost:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .llm-cfg-warn {
  background: rgba(229, 193, 106, 0.08);
  color: #B5AFA0;
}
[data-theme="dark"] .llm-cfg-warn b { color: #EDE8DC; }
[data-theme="dark"] .llm-cfg-trigger { color: #B5AFA0; }
[data-theme="dark"] .llm-cfg-trigger:hover { color: #EDE8DC; background: rgba(255,255,255,0.06); }
