/* ========== 基础变量 ========== */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-dark: #312e81;
  --success: #16a34a;
  --warn: #ea580c;
  --danger: #dc2626;
  --bg: #f8fafc;
  --bg-2: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ========== 顶部 ========== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-mark {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white; padding: 4px 10px; border-radius: 6px;
  font-size: 13px;
}
.brand-name { font-size: 16px; }
.brand-tag { font-size: 11px; color: var(--text-muted); background: var(--bg); padding: 2px 6px; border-radius: 4px; }

.spacer { flex: 1; }

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.api-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.api-status.has-key { background: #d1fae5; color: #065f46; }
.api-status.has-key .dot { background: var(--success); }
.api-status.error { background: #fee2e2; color: #991b1b; }
.api-status.error .dot { background: var(--danger); }

/* ========== 主区 ========== */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 60px);
}

/* 模式选择（商标/软著） */
.mode-switch {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  width: fit-content;
}
.mode-btn {
  background: transparent;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: inherit;
  transition: all 0.15s;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

/* 主两栏布局 */
.workbench {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .workbench { grid-template-columns: 1fr; }
}

/* ========== 卡片 ========== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.card h3 .tag { margin-left: 8px; }
.card .sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 16px;
}

/* ========== Tab 切换 ========== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  font-family: inherit;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* ========== 按钮 ========== */
.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:disabled { background: var(--text-muted); border-color: var(--text-muted); cursor: not-allowed; }
.btn-primary.btn-big { padding: 14px 32px; font-size: 16px; }
.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
}
.btn-ghost:hover { text-decoration: underline; }

/* ========== 表单 ========== */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.field input, .field textarea, .field select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.field textarea { resize: vertical; min-height: 80px; }

textarea.big {
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

/* ========== 上传区 ========== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: all 0.2s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.dropzone .icon { font-size: 36px; margin-bottom: 8px; }
.dropzone .hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.dropzone.preview { padding: 16px; }
.dropzone.preview img { max-width: 100%; max-height: 240px; border-radius: 4px; }

/* ========== 输入框 + 状态 ========== */
.input-with-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.input-status.ok { background: #d1fae5; color: #065f46; }
.input-status.loading { background: #fef3c7; color: #92400e; }
.input-status.error { background: #fee2e2; color: #991b1b; }

/* ========== 字段卡片（结果展示） ========== */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 10px;
}
.result-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.result-card .value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}

/* ========== 标签 ========== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg-2);
  color: var(--text-muted);
  margin-right: 4px;
}
.tag-primary { background: var(--primary-light); color: var(--primary); }
.tag-success { background: #d1fae5; color: #065f46; }
.tag-warn { background: #fef3c7; color: #92400e; }

/* ========== 步骤指引 ========== */
.steps {
  counter-reset: step;
  padding-left: 0;
  list-style: none;
  margin: 0;
}
.steps li {
  position: relative;
  padding: 8px 0 8px 36px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 24px; height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.steps li b { color: var(--primary); }

/* ========== 设置面板 ========== */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 600px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal h2 { margin-top: 0; }
.modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 6px;
  background: var(--text);
  color: white;
  z-index: 2000;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: 80vw;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warn { background: var(--warn); }

/* ========== 加载条 ========== */
.progress {
  position: relative;
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar {
  position: absolute;
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

/* ========== 文件列表 ========== */
.file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 13px;
}
.file-item button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .topbar-inner { padding: 0 12px; }
  .main { padding: 12px; }
  .card { padding: 16px; }
}

strong { font-weight: 600; }
a { color: var(--primary); }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); font-size: 13px; }
.text-center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.gap-12 { gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.flex-1 { flex: 1; }

/* ========== 已选类别 chip ========== */
.selected-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 999px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-chip:hover {
  background: var(--primary);
  color: white;
}
.cat-chip-rm {
  font-size: 10px;
  opacity: 0.7;
}

/* ========== 类别详情卡片 ========== */
.cat-detail {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-top: 10px;
  background: var(--bg);
}
.cat-detail strong { color: var(--primary); }

/* ========== 类似群组 ========== */
.subclass-block {
  margin: 8px 0;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 4px;
}
.subclass-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.subclass-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
}
.subclass-items label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.subclass-items input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

/* ========== 45 类网格（升级版） ========== */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.class-cell {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  transition: all 0.15s;
}
.class-cell:hover {
  border-color: var(--primary);
}
.class-cell.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.class-cell .class-num {
  font-size: 14px;
  font-weight: 700;
  display: block;
}
.class-cell .class-name {
  font-size: 11px;
  margin-top: 2px;
}

/* ========== 错误显示器 ========== */
  position: fixed; top: 60px; left: 0; right: 0;
  z-index: 9999;
  background: var(--danger);
  color: white;
  padding: 12px 16px;
  font-family: monospace;
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 50vh;
  overflow: auto;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.error-banner .err-line {
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding: 4px 0;
}
.error-banner button.close {
  position: absolute; top: 8px; right: 16px;
  background: rgba(255,255,255,0.2); color: white;
  border: none; padding: 2px 8px; border-radius: 3px;
  cursor: pointer; font-family: inherit;
}

/* ========== AI 起名 候选卡片 ========== */
.idea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.idea-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.idea-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.idea-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.idea-meta { margin-bottom: 8px; }
.idea-meaning { font-size: 12px; color: var(--text); margin-bottom: 4px; }
.idea-cta {
  font-size: 11px; color: var(--text-muted); margin-top: 8px; opacity: 0;
  transition: opacity 0.15s;
}
.idea-card:hover .idea-cta { opacity: 1; }

/* ========== ϶ ģ ========== */
.hightech-wrap { display: flex; flex-direction: column; gap: 16px; }
.hightech-wrap .ht-top h2 { margin: 0 0 4px 0; font-size: 20px; color: var(--primary); }
.hightech-wrap .ht-top .sub { color: var(--text-muted); font-size: 13px; margin: 0; }

.ht-card { padding: 16px 20px; }
.ht-card h3 { margin: 0 0 8px 0; font-size: 16px; }
.ht-card .sub { color: var(--text-muted); font-size: 12px; margin: 0 0 12px 0; }

.ht-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ht-badge { padding: 8px 14px; border-radius: 6px; font-weight: 600; font-size: 14px; }
.ht-pass { background: #d1fae5; color: #065f46; }
.ht-fail { background: #fee2e2; color: #991b1b; }
.ht-hard-ok { background: #dbeafe; color: #1e40af; }
.ht-hard-fail { background: #fef3c7; color: #92400e; }

.ht-modules { display: flex; flex-direction: column; gap: 10px; }
.ht-module-bar { display: flex; flex-direction: column; gap: 4px; }
.ht-module-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; }
.ht-module-score { color: var(--text-muted); font-weight: 400; }
.ht-bar-bg { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.ht-bar-fg { height: 100%; border-radius: 5px; transition: width 0.3s; }

.ht-section { margin-top: 12px; padding: 12px; background: var(--bg); border-radius: 6px; }
.ht-section h4 { margin: 0 0 12px 0; font-size: 14px; color: var(--primary); padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.ht-q { padding: 12px; margin-bottom: 10px; background: white; border-radius: 6px; border: 1px solid var(--border); }
.ht-q-title { font-size: 13px; font-weight: 500; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ht-q-module { font-size: 11px; padding: 2px 8px; border-radius: 3px; background: var(--primary-light); color: var(--primary); font-weight: 400; }
.ht-q-body { margin-bottom: 6px; }
.ht-q-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.ht-input { width: 100%; max-width: 320px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; font-family: inherit; }
.ht-input:focus { outline: none; border-color: var(--primary); }

.ht-multicheck { display: flex; flex-direction: column; gap: 6px; }
.ht-check-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg); border-radius: 4px; cursor: pointer; font-size: 13px; }
.ht-check-item input { cursor: pointer; }
.ht-check-score { margin-left: auto; color: var(--primary); font-weight: 600; font-size: 12px; }

.ht-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.ht-recs { margin: 0; padding-left: 20px; }
.ht-recs li { margin-bottom: 6px; font-size: 13px; line-height: 1.6; }

.ht-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ht-row label { font-size: 13px; font-weight: 500; min-width: 140px; }
.ht-hint-line { font-size: 11px; color: var(--text-muted); margin-top: 8px; }

.ht-countdown { padding: 16px; border-radius: 6px; font-size: 18px; font-weight: 600; text-align: center; margin-top: 8px; }
.ht-countdown strong { font-size: 28px; margin: 0 4px; }
.ht-warn { background: #fef3c7; color: #92400e; }
.ht-danger { background: #fee2e2; color: #991b1b; }
.ht-countdown-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.ht-materials { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ht-mat-cat { padding: 12px; background: var(--bg); border-radius: 6px; }
.ht-mat-cat-title { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.ht-mat-cat ul { margin: 0; padding-left: 18px; }
.ht-mat-cat li { font-size: 12px; line-height: 1.7; }

.ht-export-row { display: flex; gap: 10px; margin-top: 8px; justify-content: flex-end; }

@media (max-width: 720px) {
  .ht-materials { grid-template-columns: 1fr; }
  .ht-row { flex-direction: column; align-items: stretch; }
  .ht-row label { min-width: auto; }
  .ht-input { max-width: 100%; }
}

/* ========== ̨ v0.5 ========== */
.ht-mainsubtabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.ht-mainsubtab { padding: 10px 20px; background: transparent; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-muted); font-family: inherit; }
.ht-mainsubtab:hover { color: var(--primary); }
.ht-mainsubtab.active { color: var(--primary); border-bottom-color: var(--primary); }

.ht-subtabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.ht-subtab { padding: 6px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; font-size: 13px; color: var(--text); font-family: inherit; }
.ht-subtab:hover { background: var(--primary-light); }
.ht-subtab.active { background: var(--primary); color: white; border-color: var(--primary); }

.ht-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.ht-hint-inline { font-size: 12px; color: var(--text-muted); }
.ht-filter-bar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.ht-summary-bar { background: var(--primary-light); padding: 12px 16px; border-radius: 6px; margin-bottom: 12px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.ht-ok-text { color: #10b981; font-weight: 600; }
.ht-warn-text { color: #ef4444; font-weight: 600; }

.ht-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ht-table th { background: var(--bg); padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid var(--border); color: var(--text); }
.ht-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ht-table tr:hover td { background: var(--bg); }
.ht-table tr:last-child td { border-bottom: none; }

.ht-form { background: var(--primary-light); padding: 16px; border-radius: 6px; margin-bottom: 16px; }
.ht-form h4 { margin: 0 0 12px 0; font-size: 14px; color: var(--primary); }
.ht-form-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.ht-form-row label { min-width: 100px; font-size: 13px; padding-top: 6px; color: var(--text); }
.ht-form-row textarea.ht-input { font-family: inherit; resize: vertical; }
.ht-form-row select.ht-input { cursor: pointer; }
.ht-form-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

.btn-mini { padding: 3px 10px; font-size: 12px; background: var(--primary); color: white; border: none; border-radius: 3px; cursor: pointer; margin-right: 4px; font-family: inherit; }
.btn-mini.danger { background: #ef4444; }
.btn-mini:hover { opacity: 0.85; }

.ht-overview-top { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.ht-total-card { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark, #1e40af) 100%); color: white; padding: 20px; border-radius: 8px; }
.ht-total-label { font-size: 13px; opacity: 0.9; }
.ht-total-amount { font-size: 28px; font-weight: 700; margin-top: 4px; }
.ht-tech-card { padding: 20px; border-radius: 8px; }
.ht-tech-card.ht-ok { background: #d1fae5; color: #065f46; }
.ht-tech-card.ht-warn-card { background: #fef3c7; color: #92400e; }
.ht-tech-label { font-size: 13px; opacity: 0.9; }
.ht-tech-value { font-size: 28px; font-weight: 700; margin: 4px 0; }
.ht-tech-detail { font-size: 12px; opacity: 0.85; }
.ht-tech-ok, .ht-tech-fail { font-weight: 600; margin-top: 4px; }

.ht-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ht-cat-card { background: white; padding: 14px; border-radius: 6px; border: 1px solid var(--border); text-align: center; transition: all 0.15s; }
.ht-cat-card.ht-warn { border-color: #ef4444; background: #fef2f2; }
.ht-cat-icon { font-size: 24px; }
.ht-cat-name { font-size: 12px; color: var(--text-muted); margin: 4px 0; }
.ht-cat-amount { font-size: 16px; font-weight: 700; color: var(--primary); }
.ht-cat-pct { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ht-cat-warn { font-size: 11px; color: #991b1b; font-weight: 600; margin-top: 4px; }

.ht-warn-list, .ht-export-list { margin: 8px 0; padding-left: 20px; }
.ht-warn-list li, .ht-export-list li { font-size: 13px; line-height: 1.8; }
.ht-ok-banner { padding: 16px; text-align: center; color: #10b981; font-weight: 600; background: #d1fae5; border-radius: 6px; }

.ht-export-actions { display: flex; gap: 8px; margin-top: 12px; }

@media (max-width: 720px) {
  .ht-overview-top { grid-template-columns: 1fr; }
  .ht-form-row { flex-direction: column; align-items: stretch; }
  .ht-form-row label { min-width: auto; }
  .ht-cat-grid { grid-template-columns: 1fr 1fr; }
  .ht-table { font-size: 12px; }
  .ht-table th, .ht-table td { padding: 6px; }
}

/* ========== AI ̱ͼ v0.6 ========== */
.ai-trigger-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; background: var(--primary-light); border-radius: 6px; flex-wrap: wrap; }
.btn-ai-image { padding: 8px 16px; background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; }
.btn-ai-image:hover { opacity: 0.92; transform: translateY(-1px); }
.ai-trigger-hint { font-size: 12px; color: var(--text-muted); }

.ai-image-panel { background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); border: 1px solid #c4b5fd; border-radius: 8px; padding: 16px; margin-top: 12px; }
.ai-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #ddd6fe; }
.ai-panel-head h4 { margin: 0; font-size: 15px; color: #5b21b6; }
.ai-panel-form { background: white; padding: 12px; border-radius: 6px; margin-bottom: 12px; }
.ai-form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ai-form-row label { min-width: 80px; font-size: 13px; }
.ai-color-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; transition: all 0.15s; }
.ai-color-dot:hover { transform: scale(1.1); }
.ai-color-dot.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }

.ai-result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 8px; }
.ai-result-card { background: white; border: 2px solid var(--border); border-radius: 6px; padding: 8px; transition: all 0.15s; }
.ai-result-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(99,102,241,0.15); }
.ai-result-card.picked { border-color: #10b981; box-shadow: 0 0 0 3px #d1fae5; }
.ai-result-card img { width: 100%; height: 160px; object-fit: contain; display: block; background: #fafafa; border-radius: 4px; }
.ai-result-actions { display: flex; gap: 4px; margin-top: 6px; }
.ai-result-actions .btn-mini { flex: 1; text-align: center; padding: 5px; }
.ai-result-actions .btn-mini.ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); text-decoration: none; display: inline-block; }

.ai-panel-foot { margin-top: 12px; padding: 8px 12px; background: #fef3c7; border-left: 3px solid #f59e0b; border-radius: 4px; font-size: 12px; color: #78350f; }

@media (max-width: 720px) {
  .ai-result-grid { grid-template-columns: 1fr 1fr; }
  .ai-form-row { flex-direction: column; align-items: stretch; }
  .ai-form-row label { min-width: auto; }
}
