/* ═══════════════════════════════════════════════════════
   知小卫 - 知识产权智能监测系统 全局样式
   设计风格：深色专业 + 紫光渐变 + 玻璃拟态
═══════════════════════════════════════════════════════ */

/* ── 变量 ─────────────────────────────────────── */
:root {
  --bg-base:       #0a0b14;
  --bg-card:       rgba(20, 22, 40, 0.85);
  --bg-card2:      rgba(30, 32, 58, 0.7);
  --border:        rgba(99, 102, 241, 0.2);
  --border-hover:  rgba(99, 102, 241, 0.5);
  --accent:        #6366f1;
  --accent2:       #8b5cf6;
  --accent3:       #06b6d4;
  --text-primary:  #f1f3ff;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --red:           #ef4444;
  --orange:        #f97316;
  --yellow:        #eab308;
  --green:         #22c55e;
  --radius:        14px;
  --radius-sm:     8px;
  --shadow:        0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow:   0 0 30px rgba(99,102,241,0.25);
}

/* ── 重置 ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(139,92,246,0.10) 0%, transparent 60%);
}

/* ── HEADER ───────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 11, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-icon svg { width: 40px; height: 40px; }

.logo-name {
  display: block;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.logo-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-top: -2px;
}

.header-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.nav-btn {
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(99,102,241,0.1);
  color: var(--text-primary);
  border-color: var(--border);
}

.nav-btn.active {
  background: rgba(99,102,241,0.15);
  color: var(--accent);
  border-color: rgba(99,102,241,0.4);
  font-weight: 600;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.3);
  flex-shrink: 0;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-green 2s infinite;
}

.badge-text {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ── MAIN ─────────────────────────────────────── */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ── SECTION TITLE ────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title h1,
.section-title h2 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-sub {
  font-size: 14px;
  color: var(--text-muted);
  flex: 0 0 100%;
  margin-top: -20px;
}

/* ── KPI GRID ─────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  border-color: var(--border-hover);
}

.kpi-icon { font-size: 28px; flex-shrink: 0; }
.kpi-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.kpi-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.kpi-glow {
  position: absolute;
  right: -30px; bottom: -30px;
  width: 100px; height: 100px;
  border-radius: 50%;
  opacity: 0.06;
  filter: blur(20px);
}

.kpi-total  .kpi-glow { background: var(--red); }
.kpi-high   .kpi-glow { background: var(--red); }
.kpi-medium .kpi-glow { background: var(--orange); }
.kpi-recent .kpi-glow { background: var(--yellow); }
.kpi-evidence .kpi-glow { background: var(--accent); }
.kpi-scanned  .kpi-glow { background: var(--accent3); }

/* ── CHART ROW ────────────────────────────────── */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 768px) { .chart-row { grid-template-columns: 1fr; } }

.chart-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}

.chart-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* 风险条形图 */
.risk-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.risk-label { font-size: 13px; width: 50px; color: var(--text-secondary); flex-shrink: 0; }
.risk-bar-bg {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 5px;
  overflow: hidden;
}

.risk-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.bar-high   { background: linear-gradient(90deg, #ef4444, #f97316); }
.bar-medium { background: linear-gradient(90deg, #f97316, #eab308); }
.bar-low    { background: linear-gradient(90deg, #22c55e, #06b6d4); }
.risk-pct   { font-size: 13px; width: 36px; text-align: right; color: var(--text-muted); }

/* 状态列表 */
.status-list { display: flex; flex-direction: column; gap: 14px; }

.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.status-item .status-val {
  margin-left: auto;
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green  { background: var(--green);  box-shadow: 0 0 6px var(--green); }
.dot-yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.dot-red    { background: var(--red);    box-shadow: 0 0 6px var(--red); }

/* ── QUICK ACTIONS ────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.qbtn {
  padding: 12px 22px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}

.qbtn:hover {
  background: rgba(99,102,241,0.15);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* ── DETECT GRID ──────────────────────────────── */
.detect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) { .detect-grid { grid-template-columns: 1fr; } }

.detect-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.detect-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.detect-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.detect-card-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.detect-card-header p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 14px;
  position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99,102,241,0.05);
}

.upload-placeholder {
  text-align: center;
  padding: 20px;
}

.upload-icon-wrap { margin-bottom: 12px; }

.upload-svg { width: 56px; height: 56px; }

.upload-hint { font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.upload-link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.upload-types { font-size: 12px; color: var(--text-muted); }

.upload-preview {
  width: 100%;
  text-align: center;
  padding: 12px;
}

.upload-preview img {
  max-height: 160px;
  max-width: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.btn-clear {
  display: block;
  margin: 8px auto 0;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(255,60,60,0.12);
  border: 1px solid rgba(255,60,60,0.3);
  border-radius: 4px;
  color: #fc8181;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-clear:hover { background: rgba(255,60,60,0.2); }

/* 文本输入 */
.text-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
  transition: border-color 0.2s;
  margin-bottom: 10px;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

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

.text-quick-fills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.quick-label { font-size: 12px; color: var(--text-muted); }

.quick-fill {
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 20px;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.quick-fill:hover { background: rgba(99,102,241,0.2); }

/* 检测按钮 */
.btn-detect {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-detect:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

.btn-detect:disabled { opacity: 0.4; cursor: not-allowed; }

/* 结果面板 */
.result-panel { display: flex; flex-direction: column; gap: 10px; }

.result-item {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.result-item.rank-1 { border-color: rgba(99,102,241,0.5); }
.result-item.rank-2 { border-color: rgba(99,102,241,0.3); }
.result-item.rank-3 { border-color: rgba(99,102,241,0.15); }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.result-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(99,102,241,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.result-name { font-size: 15px; font-weight: 600; flex: 1; padding: 0 10px; }
.result-meta { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

.similarity-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin: 8px 0;
  overflow: hidden;
}

.similarity-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.sim-high   .similarity-fill { background: linear-gradient(90deg, #ef4444, #f97316); }
.sim-medium .similarity-fill { background: linear-gradient(90deg, #f97316, #eab308); }
.sim-low    .similarity-fill { background: linear-gradient(90deg, #22c55e, #06b6d4); }

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.risk-high   { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.risk-medium { background: rgba(234,179,8,0.15);  color: #fbbf24; border: 1px solid rgba(234,179,8,0.3); }
.risk-low    { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }

/* ── CRAWL ────────────────────────────────────── */
.crawl-control {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.threshold-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

input[type="range"] {
  width: 140px;
  accent-color: var(--accent);
  cursor: pointer;
}

.threshold-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  min-width: 32px;
}

.filter-row { display: flex; gap: 10px; }

.select-styled {
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.select-styled:focus { border-color: var(--accent); }
.select-styled option { background: #1a1c2e; }

.btn-scan {
  padding: 11px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  margin-left: auto;
}

.btn-scan:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

/* 进度条 */
.scan-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.progress-bar-outer {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

/* 统计 chip */
.crawl-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid transparent;
}

.chip-blue   { background: rgba(6,182,212,0.1);  border-color: rgba(6,182,212,0.3);  color: #67e8f9; }
.chip-red    { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #f87171; }
.chip-orange { background: rgba(249,115,22,0.1); border-color: rgba(249,115,22,0.3); color: #fb923c; }
.chip-yellow { background: rgba(234,179,8,0.1);  border-color: rgba(234,179,8,0.3);  color: #fbbf24; }
.chip-green  { background: rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.3);  color: #4ade80; }

/* 线索列表 */
.clue-list { display: flex; flex-direction: column; gap: 12px; }

.clue-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.2s;
  animation: slideIn 0.3s ease;
  backdrop-filter: blur(8px);
}

.clue-card:hover {
  border-color: var(--border-hover);
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.clue-thumb {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: rgba(99,102,241,0.1);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  overflow: hidden;
}

.clue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.clue-body { flex: 1; min-width: 0; }

.clue-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.clue-name { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; }
.clue-url  { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.clue-info {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.clue-info span { display: flex; align-items: center; gap: 4px; }

.clue-actions { display: flex; gap: 8px; flex-shrink: 0; flex-direction: column; align-items: flex-end; }

.btn-evidence {
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 7px;
  color: white;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-evidence:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.btn-evidence:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  background: rgba(99,102,241,0.3);
}

/* ── EVIDENCE ─────────────────────────────────── */
.evidence-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon { font-size: 56px; margin-bottom: 16px; }
.evidence-empty p { font-size: 16px; margin-bottom: 8px; }
.empty-sub { font-size: 13px !important; }
.evidence-empty .btn-scan { margin: 20px auto 0; }

.evidence-list { display: flex; flex-direction: column; gap: 12px; }

.ev-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  animation: slideIn 0.3s ease;
}

.ev-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.ev-id {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  background: rgba(99,102,241,0.1);
  padding: 3px 10px;
  border-radius: 4px;
}

.ev-time { font-size: 13px; color: var(--text-muted); }
.ev-status { margin-left: auto; }

.ev-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 600px) { .ev-grid { grid-template-columns: 1fr; } }

.ev-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.ev-field p {
  font-size: 13.5px;
  color: var(--text-primary);
  word-break: break-all;
}

.ev-hash {
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: monospace;
  font-size: 12px;
  color: var(--green);
  word-break: break-all;
  border: 1px solid rgba(34,197,94,0.2);
  margin-bottom: 12px;
}

.ev-actions { display: flex; gap: 10px; }

.btn-download {
  padding: 8px 16px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 7px;
  color: var(--green);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-download:hover { background: rgba(34,197,94,0.18); }

/* ── REFRESH BTN ──────────────────────────────── */
.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-refresh svg { width: 14px; height: 14px; }
.btn-refresh:hover { background: rgba(99,102,241,0.1); color: var(--text-primary); border-color: var(--border-hover); }

/* ── SPINNER ──────────────────────────────────── */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  animation: toastIn 0.3s ease;
  pointer-events: all;
  max-width: 340px;
  box-shadow: var(--shadow);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast-success {
  background: rgba(34,197,94,0.15);
  border: 1px solid rgba(34,197,94,0.4);
  color: #4ade80;
}

.toast-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #f87171;
}

.toast-info {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.4);
  color: #a5b4fc;
}

/* ── MODAL ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: #14162a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow);
  position: relative;
  animation: fadeIn 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.08);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── SCROLLBAR ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.5); }

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 640px) {
  .header-nav { display: none; }
  .app-main { padding: 16px 12px 40px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .crawl-control { flex-direction: column; align-items: stretch; }
  .btn-scan { margin-left: 0; }
}
/* ── RESPONSIVE OVERRIDES ───────────────────────── */
@media (max-width: 768px) {
  :root {
    --radius: 10px;
    --radius-sm: 6px;
  }

  .app-main {
    padding: 16px 12px 40px;
  }

  .section-title h1, .section-title h2 {
    font-size: 20px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kpi-card {
    padding: 16px;
  }

  .kpi-value {
    font-size: 28px;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .detect-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .topbar {
    padding: 0 16px;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .drawer {
    width: 100% !important;
    max-width: 100% !important;
  }

  .modal {
    width: 95%;
    margin: 10px;
  }

  .detail-meta-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .clue-card {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .clue-thumb {
    width: 60px !important;
    height: 60px !important;
  }

  .clue-actions {
    flex-direction: row !important;
    justify-content: flex-start !important;
    margin-top: 12px;
  }

  .sidebar-footer {
    padding: 16px !important;
  }
}
