/* Alpha AppRadar · C端付费App市场情报与变现监控台 (analysis.qpmcn.cn)
 * Design System: Porcelain & Frosted Quartz Daylight AI-Tech + Dark Geek Mode
 * Modern Web Guidance: responsive-table, interactions-in-complex-layouts, light-dismiss-a-dialog
 */
:root,
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel2: #f1f5f9;
  --panel-hover: #e2e8f0;
  --line: rgba(148, 163, 184, 0.28);
  --line-strong: rgba(100, 116, 139, 0.38);
  --text: #0f172a;
  --text-sec: #334155;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --cyan: #0284c7;
  --cyan-soft: rgba(2, 132, 199, 0.1);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.12);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --bad: #dc2626;
  --bad-soft: rgba(220, 38, 38, 0.1);
  --good: #059669;
  --warn: #d97706;
  --money: #047857;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 10px 28px -6px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 22px 48px -12px rgba(15, 23, 42, 0.16);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --thead-bg: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Inter", "Helvetica Neue", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #0b0f17;
  --bg-elev: #111827;
  --panel: rgba(18, 24, 38, 0.94);
  --panel2: #172033;
  --panel-hover: #1e293b;
  --line: #243049;
  --line-strong: #334155;
  --text: #e6ecf5;
  --text-sec: #cbd5e1;
  --muted: #8b98b0;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.15);
  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.15);
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.15);
  --good: #34d399;
  --warn: #fbbf24;
  --money: #6ee7b7;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.6);
  --topbar-bg: rgba(11, 15, 23, 0.88);
  --thead-bg: #151d2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
}

/* Porcelain & Neural Prism Background Grid + Aurora */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image:
    linear-gradient(to right, rgba(14, 165, 233, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(14, 165, 233, 0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 50%, transparent 100%);
}

.bg-aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(600px circle at 15% 0%, rgba(6, 182, 212, 0.09), transparent 70%),
    radial-gradient(600px circle at 85% 5%, rgba(99, 102, 241, 0.09), transparent 70%),
    radial-gradient(500px circle at 50% 25%, rgba(16, 185, 129, 0.06), transparent 70%);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--panel2);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
}

/* ==================== TOPBAR ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  flex: none;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.title {
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--accent) 50%, var(--emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  display: inline-block;
}

.subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  line-height: 1.45;
}

/* ==================== NAVIGATION TABS ==================== */
.nav-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  position: sticky;
  top: 65px;
  z-index: 25;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: var(--panel2);
  color: var(--text);
}

.nav-tab.on {
  background: var(--accent-soft);
  border-color: rgba(79, 70, 229, 0.35);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.tab-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
}

.nav-tab.on .tab-pill {
  background: var(--accent);
  color: #fff;
}

/* ==================== LAYOUT & CONTAINERS ==================== */
.container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px 24px 60px;
}

.tab-pane {
  display: none;
}

.tab-pane.on {
  display: block;
}

.section-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sec-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sec-head h2 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.sec-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  max-width: 920px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

/* ==================== MACRO KPIS ==================== */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.macro-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.macro-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--accent), var(--emerald));
}

.macro-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.macro-val {
  font-size: 24px;
  font-weight: 800;
  margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.macro-delta {
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
}

.macro-src {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ==================== CAMPS & PLAYERS (TAB 1) ==================== */
.camp-filter {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.camps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* modern-web-guidance: interactions-in-complex-layouts */
.camp-block,
.card,
.playbook-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

@supports not (content-visibility: auto) {
  .camp-block,
  .card,
  .playbook-card {
    contain: layout style paint;
  }
}

.camp-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
}

.camp-header {
  padding: 14px 18px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.camp-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.camp-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.camp-name {
  font-size: 15.5px;
  font-weight: 800;
}

.camp-meta-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.meta-pill {
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text-sec);
  font-weight: 600;
}

.camp-summary {
  padding: 10px 18px;
  color: var(--text-sec);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  gap: 12px;
  padding: 14px 18px;
}

.player-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.player-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.p-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.p-id {
  display: flex;
  gap: 10px;
  align-items: center;
}

.p-emoji {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: none;
}

.p-name {
  font-weight: 800;
  font-size: 14px;
}

.p-dev {
  color: var(--muted);
  font-size: 11.5px;
}

.p-rev {
  text-align: right;
  flex: none;
}

.p-rev-val {
  font-weight: 800;
  font-size: 15px;
  color: var(--money);
  font-variant-numeric: tabular-nums;
}

.p-rev-sub {
  font-size: 11px;
  color: var(--muted);
}

.p-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.p-tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-weight: 600;
}

.p-tag.price {
  background: var(--amber-soft);
  color: var(--amber);
}

.p-box {
  font-size: 12.5px;
  line-height: 1.55;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text-sec);
}

.p-box b {
  color: var(--text);
}

.p-box.weak {
  background: var(--bad-soft);
  color: var(--text-sec);
}

.p-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 4px;
}

/* ==================== PLAYBOOKS & CALCULATOR (TAB 2) ==================== */
.playbooks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.playbook-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pb-code {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 6px;
  width: fit-content;
}

.pb-title {
  font-size: 14.5px;
  font-weight: 800;
  margin: 2px 0;
}

.pb-meta {
  font-size: 12px;
  color: var(--emerald);
  font-weight: 600;
}

.pb-list {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 12.5px;
  color: var(--text-sec);
  line-height: 1.6;
}

.pb-list li {
  margin-bottom: 5px;
}

/* Calculator */
.calc-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.calc-body {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: stretch;
}

.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.calc-field label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
}

.calc-field label b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.calc-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-marks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.calc-outputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.calc-out-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.calc-out-card.highlight {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--accent-soft), var(--emerald-soft));
  border-color: var(--accent);
}

.co-k {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.co-v {
  font-size: 24px;
  font-weight: 800;
  margin: 4px 0;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.calc-out-card.highlight .co-v {
  font-size: 28px;
  color: var(--emerald);
}

.co-sub {
  font-size: 12px;
  color: var(--text-sec);
}

/* ==================== CONTROLS, CHIPS & INPUTS ==================== */
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.row.wrap {
  align-items: flex-start;
  gap: 8px 10px;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field > label,
.lbl {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.lbl {
  min-width: 68px;
  padding-top: 5px;
}

.spacer {
  flex: 1;
}

.seg {
  display: inline-flex;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}

.seg.full {
  width: 100%;
}

.seg.full button {
  flex: 1;
}

.seg button {
  background: transparent;
  color: var(--text-sec);
  border: 0;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  transition: 0.12s;
}

.seg button.on {
  background: var(--accent);
  color: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.chip {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-sec);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  user-select: none;
  transition: 0.12s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 5px 6px;
}

.preset:hover {
  text-decoration: underline;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  margin-top: 6px;
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  transition: 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn:hover {
  border-color: var(--accent);
}

.btn.primary {
  background: linear-gradient(135deg, var(--cyan), var(--accent));
  border: 0;
  color: #fff;
  padding: 8px 18px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn.primary:hover {
  opacity: 0.94;
}

.btn.sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.filter-bar,
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.input-search,
.input-lg,
.select-box {
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
}

.input-search:focus,
.input-lg:focus,
.select-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-search {
  min-width: 240px;
}

/* ==================== RESPONSIVE TABLES (modern-web-guidance: responsive-table) ==================== */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: 680px;
  container-type: inline-size;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  font-size: 11.5px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--thead-bg);
  white-space: nowrap;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  color: var(--accent);
}

td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tr.app,
tr.clickable-row {
  cursor: pointer;
  transition: background 0.1s;
}

tr.app:hover,
tr.clickable-row:hover {
  background: var(--accent-soft);
}

.rank {
  font-weight: 800;
  font-size: 14px;
  width: 36px;
  text-align: center;
  color: var(--text-sec);
  font-variant-numeric: tabular-nums;
}

.delta {
  font-size: 11px;
  display: block;
  font-weight: 700;
}

.up { color: var(--good); }
.down { color: var(--bad); }
.new { color: var(--warn); font-weight: 700; }

.appcell {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.appcell img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  flex: none;
  background: var(--panel2);
  border: 1px solid var(--line);
}

.appname {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.appdev {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.money {
  font-weight: 800;
  color: var(--money);
  font-variant-numeric: tabular-nums;
}

.range {
  color: var(--muted);
  font-size: 11px;
}

.badge-g {
  font-size: 10.5px;
  color: var(--emerald);
  background: var(--emerald-soft);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
  font-weight: 700;
}

.score-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  background: var(--emerald-soft);
  color: var(--emerald);
}

.stars {
  color: #f59e0b;
  font-weight: 700;
}

/* ==================== LIVE RADAR BOARD (TAB 4) ==================== */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(540px, 1fr));
  gap: 16px;
}

.board.flat {
  display: block;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
}

.card-t {
  font-weight: 800;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-t .flag {
  font-size: 19px;
}

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text-sec);
  font-weight: 600;
}

.tag.paid {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: transparent;
}

.tag.grossing {
  color: var(--emerald);
  background: var(--emerald-soft);
  border-color: transparent;
}

.tag.free {
  color: var(--cyan);
  background: var(--cyan-soft);
  border-color: transparent;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 16px 12px;
}

.kpi {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}

.kpi .k {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.kpi .v {
  font-size: 15px;
  font-weight: 800;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.card-f {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: auto;
  background: var(--panel2);
}

.card-insight {
  padding: 6px 16px 12px 32px;
  margin: 0;
  color: var(--text-sec);
  font-size: 12px;
  line-height: 1.65;
}

.skeleton {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.err {
  color: var(--bad);
  padding: 18px 16px;
}

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: s 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

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

/* ==================== X-RAY SEARCH (TAB 5) ==================== */
.xray-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.xray-search-bar .input-lg {
  flex: 1;
  min-width: 260px;
}

.xray-quick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.xray-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.xray-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: 0.14s;
}

.xray-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ==================== ALPHA LAUNCHPAD (TAB 6) ==================== */
.tracks-grid,
.sop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.track-card,
.sop-step {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px 16px;
  background: var(--bg-elev);
}

.track-card.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), var(--bg-elev));
}

.track-idx {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}

.track-name {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 6px;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.pipe-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipe-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.pipe-rank {
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.sop-num {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--cyan);
  margin-bottom: 4px;
}

.sop-step h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.sop-step p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-sec);
  line-height: 1.6;
}

/* ==================== NATIVE LIGHT-DISMISS DIALOG (modern-web-guidance: light-dismiss-a-dialog) ==================== */
dialog.report-dialog {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--bg-elev);
  color: var(--text);
  width: min(920px, 95vw);
  max-height: 90vh;
  padding: 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog.report-dialog::backdrop {
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.dialog-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}

.dialog-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.dialog-close {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
}

.dialog-close:hover {
  border-color: var(--bad);
  color: var(--bad);
}

.dialog-content {
  padding: 22px 26px 48px;
  overflow-y: auto;
}

.r-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.r-head img {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.r-name {
  font-size: 20px;
  font-weight: 800;
}

.r-sub {
  color: var(--muted);
  margin-top: 4px;
}

.r-links {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.r-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 6px 0 16px;
}

.r-kpis .kpi .v {
  font-size: 17px;
}

.r-sec {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.r-sec h3 {
  margin: 0 0 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.r-sec h3 .muted {
  font-weight: 400;
}

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

.ins {
  display: flex;
  gap: 8px;
  margin: 6px 0;
  line-height: 1.55;
}

.ins .t {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 6px;
  height: fit-content;
  margin-top: 2px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text-sec);
}

.ins.good .t {
  color: var(--good);
  background: var(--emerald-soft);
  border-color: transparent;
}

.ins.warn .t {
  color: var(--warn);
  background: var(--amber-soft);
  border-color: transparent;
}

.hist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 12px;
}

.hist-bar {
  flex: 1;
  height: 8px;
  background: var(--panel2);
  border-radius: 4px;
  overflow: hidden;
}

.hist-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #ea580c);
}

.review {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.review:first-of-type {
  border-top: 0;
}

.review .rt {
  font-weight: 700;
}

.review .rc {
  color: var(--text-sec);
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 4px;
  white-space: pre-wrap;
}

.iap-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 16px;
  font-size: 13px;
}

.iap-tier {
  grid-column: 1 / -1;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  margin-top: 6px;
}

.devapps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.devapp {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.devapp:hover {
  border-color: var(--accent);
}

.devapp img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 12px;
  font-size: 12.5px;
}

.kv .k {
  color: var(--muted);
  font-weight: 600;
}

.desc {
  white-space: pre-wrap;
  color: var(--text-sec);
  line-height: 1.65;
  font-size: 12.5px;
  max-height: 180px;
  overflow: hidden;
}

.desc.open {
  max-height: none;
}

.ai-out {
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: 13px;
  color: var(--text);
  background: var(--panel2);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg-elev);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 90;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%);
}

svg.spark {
  width: 100%;
  height: 140px;
}

@media (max-width: 1100px) {
  .two-col,
  .calc-body,
  .playbooks-grid,
  .tracks-grid,
  .sop-grid,
  .pipeline-grid {
    grid-template-columns: 1fr;
  }
  .macro-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .board,
  .players-grid,
  .macro-grid {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 12px;
  }
  .kpis,
  .r-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}
