/* Skills —— 高级简约深色主题
   设计语言：Linear / Notion / Apple 风格融合
   核心：少即是多，留白呼吸，精致细节
*/

:root {
  /* 高级深色调色板 - 中性灰偏冷调 */
  --bg: #0B0D12;
  --bg-elev-1: #111318;
  --bg-elev-2: #161922;
  --bg-elev-3: #1C202B;

  /* 边框 - 极细高透明度 */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* 文字层次 */
  --text-primary: rgba(255, 255, 255, 0.96);
  --text-secondary: rgba(255, 255, 255, 0.72);
  --text-tertiary: rgba(255, 255, 255, 0.48);
  --text-quaternary: rgba(255, 255, 255, 0.28);

  /* 品牌主色 - 蓝绿渐变（高级感） */
  --accent: #7DD3FC;
  --accent-2: #86EFAC;
  --accent-gradient: linear-gradient(135deg, #60A5FA 0%, #7DD3FC 45%, #86EFAC 100%);
  --accent-gradient-soft: linear-gradient(135deg, rgba(96, 165, 250, 0.18) 0%, rgba(134, 239, 172, 0.14) 100%);
  --accent-glow: 0 0 40px rgba(96, 165, 250, 0.22);

  /* 气泡 */
  --bubble-user: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  --bubble-bot: rgba(255, 255, 255, 0.04);

  /* 语义色 */
  --danger: #F87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --success: #4ADE80;
  --success-bg: rgba(74, 222, 128, 0.1);
  --warn: #FBBF24;

  /* 安全区 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* 圆角系统 - 四档 */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* 阴影 - 多层柔和 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 32px 80px -20px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 背景微妙纹理 - 高级感 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(96, 165, 250, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(134, 239, 172, 0.08), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  position: relative;
}

body > * {
  position: relative;
  z-index: 1;
}

/* ====================================================
   顶栏 Header
   ==================================================== */
.header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 20px 14px;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 5;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.title-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.title-wrap h1 {
  font-size: 17px;
  font-weight: 600;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 3px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
  background: var(--bg-elev-2);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.94);
}

/* 快速模型提供商切换器 */
.quick-prov-switch {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 28px 5px 10px;
  border-radius: 10px;
  margin-right: 4px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 14px 14px;
  transition: all 0.18s;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-prov-switch:hover {
  background-color: var(--bg-elev-2);
  border-color: var(--primary-soft);
  color: var(--primary);
}
.quick-prov-switch:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.quick-prov-switch option {
  background: var(--bg-elev-2);
  color: var(--text-primary);
  font-size: 13px;
}

/* 中继状态 */
.relay-status {
  font-size: 10px;
  margin-right: 8px;
  cursor: default;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all 0.25s;
}

.relay-status.online {
  color: var(--success);
  background: var(--success-bg);
}

.relay-status.offline {
  color: var(--text-tertiary);
  background: var(--bg-elev-2);
  border: 1px solid var(--border-subtle);
}

.relay-box {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
}

.relay-cmd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
}

.relay-cmd code {
  flex: 1;
  font-family: "SF Mono", "JetBrains Mono", Consolas, monospace;
  font-size: 12.5px;
  color: var(--accent);
  user-select: all;
}

.relay-cmd .ghost-btn {
  font-size: 12px;
  padding: 5px 12px;
  white-space: nowrap;
}

/* ====================================================
   消息区 Messages
   ==================================================== */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.messages::-webkit-scrollbar {
  width: 4px;
}
.messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

/* 欢迎页 */
.welcome {
  margin: auto;
  text-align: center;
  padding: 40px 24px;
  max-width: 520px;
  animation: welcomeFade 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes welcomeFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.welcome-icon {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-weight: 600;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent-gradient-soft);
  border: 1px solid var(--border-default);
  border-radius: 999px;
}

.welcome-text {
  color: var(--text-tertiary);
  font-size: 14.5px;
  margin-bottom: 32px;
  line-height: 1.7;
}

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

@media (min-width: 480px) {
  .suggest { grid-template-columns: 1fr 1fr; }
}

.chip {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}

.chip:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.chip:hover::after { opacity: 1; }

.chip:active {
  transform: scale(0.98);
  transition: transform 0.1s;
}

/* 消息气泡 */
.msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: msgFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg.bot {
  align-self: flex-start;
}

@keyframes msgFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.msg .bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  position: relative;
}

.msg.user .bubble {
  background: var(--bubble-user);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
  font-weight: 500;
}

.msg.bot .bubble {
  background: var(--bubble-bot);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 6px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.msg.bot .bubble.streaming::after {
  content: '▌';
  color: var(--accent);
  animation: caretBlink 0.9s steps(2) infinite;
  margin-left: 2px;
  font-weight: 300;
}

@keyframes caretBlink {
  50% { opacity: 0; }
}

.msg .avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  flex: 0 0 28px;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg.bot .avatar-mini {
  background: var(--bg-elev-2);
  color: var(--accent);
  border: 1px solid var(--border-default);
}

.msg.user .avatar-mini {
  background: rgba(37, 99, 235, 0.2);
  color: #BFDBFE;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.msg.error .bubble {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, 0.3);
  color: #FECACA;
}

/* ====================================================
   输入栏 Input Bar
   ==================================================== */
.input-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px calc(var(--safe-bottom) + 12px);
  background: rgba(11, 13, 18, 0.9);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--border-subtle);
}

.img-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-elev-1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-elev-2);
}

.img-btn:active { transform: scale(0.94); }

#input {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  line-height: 1.55;
  transition: all 0.18s;
  scrollbar-width: thin;
}

#input::placeholder {
  color: var(--text-quaternary);
}

#input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.4);
  background: var(--bg-elev-2);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.send-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent-gradient);
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(96, 165, 250, 0.3);
}

.send-btn:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(96, 165, 250, 0.42);
  transform: translateY(-1px);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.send-btn:disabled {
  opacity: 0.35;
  box-shadow: none;
}

/* ====================================================
   登录页 Login Gate
   ==================================================== */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(96, 165, 250, 0.15), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(134, 239, 172, 0.10), transparent 60%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-gate[hidden] { display: none; }

.login-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 48px 32px 28px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-modal);
  animation: loginFade 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loginFade {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 8px 32px rgba(96, 165, 250, 0.3), var(--accent-glow);
}

.login-title {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

.login-sub {
  color: var(--text-tertiary);
  font-size: 13.5px;
  margin: 0 0 32px;
  font-weight: 500;
}

.login-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.login-input-wrap input {
  width: 100%;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}

.login-input-wrap input::placeholder {
  color: var(--text-quaternary);
  letter-spacing: 0.01em;
}

.login-input-wrap input:focus {
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.login-btn {
  background: var(--accent-gradient);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 20px rgba(96, 165, 250, 0.35);
  letter-spacing: 0.03em;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(96, 165, 250, 0.45);
}

.login-btn:active { transform: scale(0.97); }
.login-btn:disabled { opacity: 0.55; box-shadow: none; transform: none; }

.login-err {
  color: var(--danger);
  font-size: 13px;
  margin: 0 0 10px;
  animation: shakeErr 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.login-err[hidden] { display: none; }

@keyframes shakeErr {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.login-foot {
  color: var(--text-quaternary);
  font-size: 11.5px;
  margin: 24px 0 0;
  letter-spacing: 0.03em;
}

/* ====================================================
   设置模态框 Modal
   ==================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal[hidden] { display: none; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: maskFade 0.3s;
}

@keyframes maskFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 640px) {
  .modal { align-items: center; padding: 40px 20px; }
  .modal-body { border-radius: var(--radius-xl) !important; }
}

.modal-body {
  position: relative;
  background: var(--bg-elev-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  animation: modalUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
}

@keyframes modalUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  background: var(--bg-elev-1);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.modal-head h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* 设置面板通用 */
.field {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.field:last-child { border-bottom: none; }

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field input[type="text"],
.field input[type="password"],
.field select {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: all 0.18s;
  appearance: none;
}

.field select {
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='0.5' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.field input::placeholder {
  color: var(--text-quaternary);
}

.field input:focus,
.field select:focus {
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.hint {
  display: block;
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-top: 10px;
  line-height: 1.6;
  text-decoration: none;
  word-break: break-word;
}

.hint:hover { color: var(--accent); }

.hint-tip {
  color: var(--text-quaternary);
  margin-top: 8px;
  line-height: 1.6;
}

.field-row {
  display: flex;
  gap: 10px;
  padding: 18px 22px 22px;
}

.ghost-btn {
  flex: 1;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}

.ghost-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-elev-3);
}

.ghost-btn:active { transform: scale(0.97); }

.primary-btn {
  flex: 1.5;
  background: var(--accent-gradient);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: 0 4px 14px rgba(96, 165, 250, 0.32);
}

.primary-btn:hover {
  box-shadow: 0 6px 20px rgba(96, 165, 250, 0.44);
  transform: translateY(-1px);
}

.primary-btn:active { transform: scale(0.97); }

.footnote {
  padding: 0 22px 22px;
  font-size: 11.5px;
  color: var(--text-quaternary);
  line-height: 1.6;
}

/* Provider guide */
.provider-guide {
  padding: 0 22px 16px;
}

.guide-card {
  background: var(--accent-gradient-soft);
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.guide-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.guide-card ul { padding-left: 16px; margin: 4px 0; }
.guide-card li { margin: 3px 0; }
.guide-card b { color: var(--text-primary); font-weight: 600; }

.guide-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-tertiary);
}

.empty-tip {
  padding: 18px 16px;
  color: var(--text-quaternary);
  font-size: 13.5px;
  text-align: center;
  background: var(--bg-elev-2);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
}

/* 女生档案列表 */
.girls-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.girl-chip {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.girl-chip:hover { border-color: var(--border-strong); background: var(--bg-elev-3); }
.girl-chip.active {
  background: var(--accent-gradient-soft);
  border-color: rgba(96, 165, 250, 0.35);
  color: var(--accent);
}

.girl-chip span.del {
  color: var(--text-quaternary);
  font-size: 15px;
  padding: 0 2px;
  cursor: pointer;
}
.girl-chip span.del:hover { color: var(--danger); }

/* Key 列表 */
.key-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.key-item {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  transition: all 0.15s;
}

.key-item.key-disabled {
  opacity: 0.6;
}

.key-item:hover { border-color: var(--border-strong); }

.key-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.key-val {
  font-size: 12px;
  font-family: "SF Mono", Consolas, monospace;
  color: var(--text-tertiary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-model-sel, .model-select {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 5px 24px 5px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-opacity='0.5' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 7px center;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.tag-ok { background: var(--success-bg); color: var(--success); }
.tag-warn { background: rgba(251, 191, 36, 0.1); color: var(--warn); }
.tag-bad { background: var(--danger-bg); color: var(--danger); }
.tag-plan { background: var(--accent-gradient-soft); color: var(--accent); }

.key-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.key-add-row > * { min-height: 40px; }

.key-add-row input { flex: 1; min-width: 120px; }
.key-add-row .model-select { flex: 0 0 auto; min-width: 110px; }

.add-key-btn {
  background: var(--accent-gradient);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-xs);
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  flex: 0 0 auto;
}

.add-key-btn:hover { box-shadow: 0 4px 14px rgba(96, 165, 250, 0.35); }
.add-key-btn:active { transform: scale(0.96); }

.key-del, .key-probe, .key-session, .key-reset {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.key-del:hover { color: var(--danger); background: var(--danger-bg); }
.key-probe:hover, .key-session:hover, .key-reset:hover {
  color: var(--accent); background: var(--accent-gradient-soft);
}

/* 仪表盘 */
.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dash-head > label { margin: 0; }

.dash-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 600px;
}

.dash-table th, .dash-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.dash-table th {
  background: var(--bg-elev-2);
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dash-table tr:last-child td { border-bottom: none; }

.dash-table td { color: var(--text-secondary); }

/* 智谱余额条 */
.quota-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quota-item {
  background: var(--bg-elev-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
}

.quota-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.quota-name { font-weight: 600; color: var(--text-primary); }
.quota-pct { color: var(--accent); font-weight: 600; font-size: 12px; }

.quota-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.quota-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.quota-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.quota-fill.low { background: linear-gradient(135deg, #F59E0B, #D97706); }
.quota-fill.crit { background: linear-gradient(135deg, var(--danger), #DC2626); }

.quota-foot {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-quaternary);
  display: flex;
  justify-content: space-between;
}

/* 图片预览 */
.img-preview {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.img-preview img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 90px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-elev-3);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  max-width: calc(100vw - 40px);
  word-break: break-word;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 发送中输入框动画 */
.input-bar.busy::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  animation: loadingBar 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes loadingBar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.input-bar { position: relative; }
