:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #0f172a;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  text-decoration: none !important;
  flex-shrink: 0;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}
.header-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.nav-link {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1e293b; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #1d4ed8; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-muted); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger-outline:hover { background: var(--danger-soft); }

/* Container & Cards */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card + .card { margin-top: 16px; }
.card-title {
  margin: 0 0 14px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-neutral { background: var(--surface-muted); color: var(--text-secondary); }

/* Search Input & Dropdown */
.search-box {
  position: relative;
  width: 100%;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  padding: 5px 6px 5px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.search-input-wrap.compact {
  border-radius: 9px;
  padding: 3px 6px 3px 10px;
}
.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  min-width: 0;
}
.search-input-wrap.compact .search-input { font-size: 13.5px; }
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 60;
  max-height: 360px;
  overflow-y: auto;
  display: none;
}
.search-dropdown.open { display: block; }
.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none !important;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg); }
.search-item-name { font-weight: 600; font-size: 14px; }
.search-item-meta { font-size: 12px; color: var(--text-muted); }

/* Home Hero */
.hero {
  text-align: center;
  max-width: 720px;
  margin: 36px auto 44px;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
}
.hero h1 {
  margin: 0 0 14px 0;
  font-size: clamp(28px, 4.5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.hero p {
  margin: 0 0 26px 0;
  font-size: 16.5px;
  color: var(--text-secondary);
}
.hero-examples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.example-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  transition: border-color 0.15s, color 0.15s;
}
.example-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Grids */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

/* Executive Scorecard */
.scorecard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 26px;
  margin-bottom: 22px;
}
.scorecard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.company-heading h1 {
  margin: 0 0 6px 0;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.company-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.score-gauge-box {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
}
.score-ring {
  width: 72px;
  height: 72px;
  position: relative;
  flex-shrink: 0;
}
.score-ring-val {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.score-ring-num { font-size: 21px; font-weight: 800; }
.score-ring-band { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-top: 2px; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.kpi-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 18px; font-weight: 700; margin-top: 3px; letter-spacing: -0.01em; }
.kpi-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.signals-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 500;
}
.signal-pill.ok { background: var(--ok-soft); color: #065f46; }
.signal-pill.warn { background: var(--warn-soft); color: #92400e; }

.scorecard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

/* Tabs */
.tabs-bar {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  border: none;
  background: transparent;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Tables */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; font-weight: 600; }
th.sticky-col { background: var(--bg); z-index: 2; }

/* Spider Graph */
.spider-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.spider-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.spider-stage {
  position: relative;
  width: 100%;
  height: 480px;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.spider-stage:active { cursor: grabbing; }
.spider-popover {
  position: absolute;
  bottom: 14px;
  left: 14px;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 14px 16px;
  display: none;
  z-index: 10;
}
.spider-popover.open { display: block; }
.network-mobile-list { display: none; }
.net-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  margin-bottom: 8px;
}

/* Loading Animation */
.loader-wrap {
  max-width: 520px;
  margin: 64px auto;
  text-align: center;
}
.radar-spinner {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  position: relative;
}
.radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.95s linear infinite;
}
.radar-pulse {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(0.85); opacity: 0.6; } 50% { transform: scale(1.1); opacity: 1; } }
.loader-steps {
  text-align: left;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.loader-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-muted);
  transition: all 0.25s;
}
.loader-step.active { border-color: var(--accent); color: var(--text); font-weight: 600; background: var(--accent-soft); }
.loader-step.done { border-color: #a7f3d0; color: #065f46; background: var(--ok-soft); }

/* Forms & Inputs */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text-secondary); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
}

/* Responsive */
@media (max-width: 900px) {
  .grid-4, .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .header-search { display: none; }
  .header-inner { padding: 10px 14px; }
  .container { padding: 18px 14px 48px; }
  .scorecard { padding: 18px; }
  .score-gauge-box { width: 100%; justify-content: flex-start; }
  .spider-stage { height: 390px; }
  .spider-desktop-wrap { display: none; }
  .spider-desktop-wrap.force-show { display: block; }
  .network-mobile-list { display: block; }
  .network-mobile-list.force-hide { display: none; }
}
