/* 科研选题系统 Web UI — 暗色学术风格 */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --border: #30363d;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --success: #3fb950;
  --warn: #d29922;
  --error: #f85149;
  --phase: #a371f7;
  --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  min-width: 400px;
}

/* 自定义滚动条（暗色主题） */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 顶部栏 ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  min-width: 400px;
}

.logo {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.version {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  margin-left: 6px;
  font-family: var(--font-mono);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.user-info .username {
  font-weight: 500;
  color: var(--text-primary);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-text:hover {
  color: var(--error);
  background: rgba(248, 81, 73, 0.1);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

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

.btn-icon.active {
  background: var(--accent-dim);
  color: #fff;
  border-color: var(--accent);
}

/* ── 主布局 ── */
.main-layout {
  display: flex;
  padding-top: 48px;
  height: 100vh;
  overflow: hidden auto;
}

/* ── 侧边栏 ── */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  transition: transform 0.2s;
}

.sidebar.hidden {
  display: none;
}

.panel h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  font-family: var(--font-mono);
  line-height: 1.5;
}

.form-group.actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.status-msg {
  margin-top: 10px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  display: none;
}

.status-msg.show { display: block; }
.status-msg.ok { background: rgba(63, 185, 80, 0.1); color: var(--success); border: 1px solid rgba(63, 185, 80, 0.3); }
.status-msg.err { background: rgba(248, 81, 73, 0.1); color: var(--error); border: 1px solid rgba(248, 81, 73, 0.3); }
.status-msg.warn { background: rgba(210, 153, 34, 0.1); color: var(--warn); border: 1px solid rgba(210, 153, 34, 0.3); }

/* ── 历史记录 ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  position: relative;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

/* 只在支持真正 hover 的设备（鼠标/触控板）上显示 hover 效果，
   避免移动端浏览器把第一次 tap 当成 hover 触发，导致需要点两次 */
@media (hover: hover) {
  .history-item:hover {
    border-color: var(--accent);
  }
}

.history-item .title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  padding-right: 24px;
  line-height: 1.5;
  word-break: break-all;
}

.history-item .meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  line-height: 1.5;
}

.history-item .meta span {
  word-break: break-all;
}

.history-item .status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase;
}

.history-item .mode-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 500;
}

.history-item .mode-tag.mode-agent {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
}

.history-item .mode-tag.mode-agent_plus {
  background: rgba(210, 153, 34, 0.15);
  color: var(--warn);
}

.history-item .mode-tag.mode-prompt {
  background: rgba(139, 148, 158, 0.15);
  color: var(--text-muted);
}

.status.completed { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.status.failed { background: rgba(248, 81, 73, 0.15); color: var(--error); }
.status.running { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.status.pending { background: rgba(139, 148, 158, 0.15); color: var(--text-muted); }

/* ── 版权信息 ── */
.copyright-footer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

/* ── 工作区 ── */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden auto;
  padding: 20px;
  gap: 16px;
}

/* ── 使用说明 ── */
.usage-guide {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  flex-shrink: 0;
}

.usage-guide-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}

.usage-guide-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── 输入区 ── */
.input-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  flex-shrink: 0;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.checkbox-group {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 4px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}

.checkbox input {
  width: auto;
  accent-color: var(--accent);
}

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

/* ── 按钮 ── */
.btn-primary {
  background: var(--accent-dim);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: rgba(248, 81, 73, 0.15);
  color: var(--error);
  border: 1px solid rgba(248, 81, 73, 0.3);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-danger:hover { background: rgba(248, 81, 73, 0.25); }

.btn-large {
  padding: 10px 24px;
  font-size: 14px;
}

.btn-small {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-small:hover {
  background: var(--border);
  color: var(--text-primary);
}

.hidden { display: none !important; }

/* ── 输出区 ── */
.output-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── 日志面板 ── */
.log-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  max-height: 420px;
}

.log-panel.compact {
  max-height: 220px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-actions {
  display: flex;
  gap: 6px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  text-transform: uppercase;
}

.badge.idle { background: var(--bg-tertiary); color: var(--text-muted); }
.badge.running { background: rgba(88, 166, 255, 0.15); color: var(--accent); }
.badge.completed { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.badge.failed { background: rgba(248, 81, 73, 0.15); color: var(--error); }

.log-container {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  flex: 1;
  overflow-y: auto;
}

.log-placeholder {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding-top: 40px;
}

.log-entry {
  padding: 1px 0 1px 10px;
  border-left: 2px solid transparent;
  margin-left: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.log-entry .timestamp {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 50px;
  opacity: 0.6;
}

.log-entry .msg {
  flex: 1;
  word-break: break-word;
}

.log-entry.info { border-left-color: rgba(139,148,158,0.3); }
.log-entry.phase { border-left-color: var(--phase); background: rgba(163,113,247,0.05); }
.log-entry.phase .msg { color: #bc8cff; font-weight: 500; }
.log-entry.warn { border-left-color: var(--warn); background: rgba(210,153,34,0.05); }
.log-entry.warn .msg { color: var(--warn); }
.log-entry.error { border-left-color: var(--error); background: rgba(248,81,73,0.05); }
.log-entry.error .msg { color: var(--error); }
.log-entry.success { border-left-color: var(--success); background: rgba(63,185,80,0.05); }
.log-entry.success .msg { color: var(--success); }

/* ── 报告面板 ── */
.report-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.report-content {
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.8;
}

.report-content h1,
.report-content h2,
.report-content h3,
.report-content h4 {
  margin-top: 20px;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

.report-content h1 { font-size: 20px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.report-content h2 { font-size: 16px; color: var(--accent); }
.report-content h3 { font-size: 14px; color: var(--text-secondary); }

.report-content p { margin-bottom: 10px; }

.report-content ul,
.report-content ol {
  margin-bottom: 10px;
  padding-left: 24px;
}

.report-content li { margin-bottom: 4px; }

.report-content code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.report-content pre {
  background: var(--bg-tertiary);
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.report-content pre code {
  background: transparent;
  padding: 0;
}

.report-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-left: 0;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.report-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 12px;
}

.report-content th,
.report-content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.report-content th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

.report-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ── 登录/注册弹窗 ── */
.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-overlay.hidden {
  display: none !important;
}

/* ── 法律告知弹窗 ── */
.legal-notice-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.legal-notice-modal.hidden {
  display: none !important;
}

.legal-notice-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
}

.legal-notice-box {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.legal-notice-box h3 {
  font-size: 16px;
  margin-bottom: 16px;
  text-align: center;
  color: var(--text-primary);
}

.legal-notice-content {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  padding-right: 8px;
  margin-bottom: 20px;
}

.legal-notice-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-shrink: 0;
}

.auth-box {
  width: 380px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.auth-copyright {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-header .version {
  color: var(--text-muted);
  font-size: 12px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form .form-group {
  margin-bottom: 0;
}

.auth-form .form-group input {
  padding: 10px 12px;
  font-size: 14px;
}

.auth-form .actions {
  margin-top: 4px;
}

.auth-form .btn-large {
  width: 100%;
}

.auth-status {
  text-align: center;
  font-size: 12px;
  padding: 8px;
  border-radius: 6px;
  min-height: 32px;
}

.auth-status.ok { background: rgba(63, 185, 80, 0.1); color: var(--success); }
.auth-status.err { background: rgba(248, 81, 73, 0.1); color: var(--error); }
.auth-status.warn { background: rgba(210, 153, 34, 0.1); color: var(--warn); }

/* ── 多配置管理样式 ── */
.config-selector {
  display: flex;
  gap: 8px;
  align-items: center;
}

.config-selector select {
  flex: 1;
}

.btn-icon-small {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-icon-small:hover {
  background: var(--accent-dim);
  color: #fff;
  border-color: var(--accent);
}

.config-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.config-actions-row .btn-danger {
  padding: 6px 12px;
  font-size: 12px;
}

.run-config-row {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.run-config-row .form-group {
  margin-bottom: 0;
  max-width: 300px;
}

/* ── 响应式 ── */

/* 移动端菜单按钮（默认隐藏） */
.btn-menu {
  display: none;
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-right: 8px;
}

.btn-menu:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 48px; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 85;
}

/* ── 平板端 (768px - 1023px) ── */
@media (max-width: 1023px) {
  .sidebar {
    width: 260px;
    min-width: 260px;
    padding: 12px;
  }

  .workspace {
    padding: 16px;
    gap: 14px;
  }

  .input-section {
    padding: 14px 16px;
  }

  .config-actions-row button {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ── 手机端 (< 768px) ── */
@media (max-width: 767px) {
  /* 顶部栏紧凑化 */
  .topbar {
    padding: 0 12px;
  }

  .logo {
    font-size: 13px;
  }

  .logo .version {
    display: none;
  }

  .btn-menu {
    display: flex;
  }

  .topbar-right {
    gap: 8px;
  }

  .user-info .username {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  /* 主布局改为单列 */
  .main-layout {
    flex-direction: column;
    padding-top: 48px;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  /* 侧边栏 - 滑出式抽屉 */
  .sidebar {
    position: fixed;
    left: 0;
    top: 48px;
    bottom: 0;
    width: 85%;
    max-width: 300px;
    min-width: auto;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--border);
    padding: 14px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay.mobile-open {
    display: block;
  }

  /* 工作区占满全宽 */
  .workspace {
    padding: 12px;
    gap: 12px;
    overflow: visible;
    min-height: calc(100vh - 48px);
  }

  /* 使用说明 */
  .usage-guide {
    padding: 10px 12px;
  }

  .usage-guide-title {
    font-size: 13px;
  }

  .usage-guide-content {
    font-size: 12px;
  }

  /* 输入区 */
  .input-section {
    padding: 12px 14px;
    border-radius: 8px;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .form-row .form-group {
    margin-bottom: 0;
    max-width: none;
  }

  .checkbox-group {
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 0;
  }

  .actions {
    margin-top: 12px;
    flex-wrap: wrap;
  }

  .btn-large {
    padding: 10px 18px;
    font-size: 13px;
  }

  /* 运行配置选择 */
  .run-config-row .form-group {
    max-width: none;
  }

  /* 配置按钮行 */
  .config-actions-row {
    gap: 6px;
  }

  .config-actions-row button {
    padding: 6px 10px;
    font-size: 12px;
    flex: 1;
    min-width: 60px;
  }

  /* 输出区 */
  .output-section {
    min-height: 300px;
  }

  .log-panel {
    min-height: 160px;
    max-height: 320px;
  }

  .log-container {
    font-size: 11px;
    padding: 8px 10px;
    line-height: 1.6;
  }

  .log-entry {
    padding-left: 6px;
    margin-left: -8px;
  }

  .log-placeholder {
    padding-top: 24px;
  }

  /* 报告面板 */
  .report-panel {
    min-height: 200px;
  }

  .report-content {
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.7;
  }

  .report-content h1 { font-size: 16px; margin-top: 16px; }
  .report-content h2 { font-size: 14px; margin-top: 14px; }
  .report-content h3 { font-size: 13px; margin-top: 12px; }
  .report-content p { margin-bottom: 8px; }
  .report-content ul,
  .report-content ol {
    padding-left: 18px;
    margin-bottom: 8px;
  }

  .panel-actions {
    gap: 4px;
  }

  /* 登录弹窗 */
  .auth-box {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 20px;
  }
}

/* 历史记录删除按钮 */
.btn-delete-history {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 2;
}

/* 触摸设备：删除按钮始终可见但稍微淡化，避免 hover 拦截第一次点击 */
@media (hover: none) {
  .btn-delete-history {
    opacity: 0.55;
  }
}

/* 支持真正 hover 的设备：hover 时才显示删除按钮 */
@media (hover: hover) {
  .btn-delete-history {
    opacity: 0;
  }
  .history-item:hover .btn-delete-history {
    opacity: 1;
  }
  .btn-delete-history:hover {
    background: rgba(248, 81, 73, 0.15);
    color: var(--error);
  }
}

/* ── Analytics 页面：柱状图 Token 标签 ── */
.token-tag {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #e4ff9f;
  white-space: nowrap;
  line-height: 1;
  background: rgba(228, 255, 159, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(228, 255, 159, 0.3);
}
