:root {
  --bg: #f4f7fc;
  --bg-elev: rgba(255, 255, 255, 0.92);
  --bg-soft: #f1f5f9;
  --bg-subtle: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-dim: #475569;
  --text-muted: #64748b;
  --blue: #2563eb;
  --indigo: #4f46e5;
  --emerald: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow: 0 8px 28px -4px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.03);
  --radius: 18px;
  --radius-sm: 10px;
  --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(960px 520px at 8% -6%, rgba(79, 70, 229, 0.11), transparent 64%),
    radial-gradient(840px 500px at 92% 0%, rgba(37, 99, 235, 0.10), transparent 64%),
    radial-gradient(880px 520px at 50% 106%, rgba(16, 185, 129, 0.08), transparent 64%);
}

.container { max-width: 1240px; margin: 0 auto; padding: 20px 20px 56px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  margin-bottom: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 40px; height: 40px; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(79, 70, 229, 0.14)); }
.brand h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.badge-ver {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.09);
  color: var(--indigo);
  border: 1px solid rgba(79, 70, 229, 0.22);
}
.brand-sub { font-size: 0.78rem; color: var(--text-dim); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.suite-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.suite-link {
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.suite-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.75); }
.suite-link.active { background: #ffffff; color: var(--indigo); box-shadow: var(--shadow-sm); }

.mode-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.mode-tab {
  padding: 7px 13px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.mode-tab.active { background: #ffffff; color: var(--indigo); box-shadow: var(--shadow-sm); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #cbd5e1; background: #f8fafc; transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  border-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.24);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #4338ca, #1d4ed8); color: #ffffff; }
.btn-sm { padding: 5px 10px; font-size: 0.76rem; border-radius: 8px; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.section-gap { margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-title { font-size: 0.85rem; font-weight: 700; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }

.search-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.input, .select, .textarea {
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.input { flex: 1; min-width: 260px; min-height: 44px; }
.textarea { width: 100%; min-height: 120px; resize: vertical; font-family: var(--mono); font-size: 0.84rem; }
.input:focus, .textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }

.chip-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.chip-lbl { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; }
.chip {
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-dim);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--indigo); color: var(--indigo); background: #eef2ff; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.pill-warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.pill-bad { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.pill-info { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.pill-blue { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.pill-muted { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* Intelligence Grid */
.intel-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; }
.risk-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
}
.ring-wrap { position: relative; width: 90px; height: 90px; flex-shrink: 0; }
.ring-svg { width: 90px; height: 90px; transform: rotate(-90deg); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 1.45rem; font-weight: 800; line-height: 1; }
.ring-lbl { font-size: 0.66rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

.stat-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-mini {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  text-align: center;
}
.stat-mini-val { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.stat-mini-lbl { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }

.url-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  margin-bottom: 10px;
}
.url-box-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 0.76rem; font-weight: 700; color: var(--text-dim); }
.url-code { font-family: var(--mono); font-size: 0.8rem; color: var(--text); word-break: break-all; }

/* Hop Timeline */
.timeline { display: flex; flex-direction: column; gap: 12px; position: relative; }
.hop-card {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.hop-card.is-final { border-color: #a7f3d0; background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%); }
.hop-card.is-err { border-color: #fecdd3; background: #fff1f2; }

.hop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.hop-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hop-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--indigo);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hop-url { font-family: var(--mono); font-size: 0.84rem; font-weight: 600; color: var(--text); word-break: break-all; }
.hop-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 0.76rem; color: var(--text-dim); }
.hop-next {
  margin-top: 8px;
  padding: 7px 10px;
  background: var(--bg-subtle);
  border-radius: 8px;
  font-size: 0.77rem;
  color: var(--text-dim);
  word-break: break-all;
}

/* Batch Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: #ffffff; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 10px 13px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 13px; border-bottom: 1px solid #f1f5f9; font-size: 0.84rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.code-pre {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 6px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #0f172a;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { text-align: center; color: var(--text-muted); font-size: 0.78rem; margin-top: 28px; }
footer a { color: var(--indigo); text-decoration: none; font-weight: 500; }

@media (max-width: 1024px) {
  .intel-grid { grid-template-columns: 1fr; }
  .stat-mini-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .container { padding: 12px 12px 40px; }
}
