:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e4e7ec;
  --line-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 58px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 190px;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.brand-copy { display: grid; gap: 2px; }
.brand-main { color: var(--accent); font-weight: 900; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }

.nav { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.nav-link {
  height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 800;
}
.nav-link:hover, .nav-link.active { color: var(--accent); background: var(--accent-soft); }

.topbar-right { display: flex; align-items: center; justify-content: end; gap: 10px; }
.health {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-weight: 800;
}
.health::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.health.ok { background: var(--success-soft); color: #166534; }
.health.ok::before { background: var(--success); }
.health.error { background: var(--danger-soft); color: #991b1b; }
.health.error::before { background: var(--danger); }

.secondary-button {
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  padding: 0 12px;
  cursor: pointer;
}

.shell { max-width: 1480px; margin: 0 auto; padding: 22px; display: grid; gap: 16px; }
.page-head, .metric-card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 20px;
}
.kicker, .panel-kicker { color: var(--accent); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.page-head h1 { margin: 6px 0 8px; font-size: 24px; line-height: 1.2; }
.page-head p { margin: 0; color: var(--ink-soft); line-height: 1.6; max-width: 860px; }
.head-note { padding: 8px 10px; border-radius: 8px; background: var(--surface-soft); color: var(--ink-soft); font-weight: 900; white-space: nowrap; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-card { padding: 16px; display: grid; gap: 8px; min-height: 110px; border-left: 4px solid var(--accent); }
.metric-card.warn { border-left-color: var(--warn); }
.metric-card.success { border-left-color: var(--success); }
.metric-card.danger { border-left-color: var(--danger); }
.metric-card span { color: var(--ink-soft); font-weight: 900; }
.metric-card strong { font-size: 24px; }
.metric-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.skeleton { background: linear-gradient(90deg, #fff, #f1f5f9, #fff); }

.panel { padding: 16px; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 14px; }
.panel-head h2 { margin: 4px 0 0; font-size: 16px; }
.text-link, .action-link { color: var(--accent); text-decoration: none; font-weight: 900; }
.meta, .empty { color: var(--muted); font-weight: 800; }

.pipeline { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.stage-card {
  min-height: 152px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  display: grid;
  align-content: space-between;
  gap: 12px;
  background: var(--surface-soft);
}
.stage-card.current { border-color: var(--accent); background: #eff6ff; }
.stage-code { color: var(--muted); font-weight: 900; font-size: 11px; text-transform: uppercase; }
.stage-card h3 { margin: 4px 0 6px; font-size: 15px; }
.stage-card p { margin: 0; color: var(--ink-soft); line-height: 1.45; }

.chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 900;
}
.chip.success { background: var(--success-soft); border-color: #bbf7d0; color: #166534; }
.chip.warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.chip.idle { color: var(--muted); }

.split-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 0.85fr); gap: 16px; align-items: start; }
.priority-list, .release-list, .blocker-list { display: grid; gap: 10px; }
.priority-item, .release-item, .blocker-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}
.release-item, .blocker-item { grid-template-columns: minmax(0, 1fr) auto; }
.priority-rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
}
.priority-item strong, .release-item strong, .blocker-item strong { display: block; margin-bottom: 4px; }
.priority-item p, .release-item p, .blocker-item p { margin: 0; color: var(--ink-soft); line-height: 1.45; }

.platform-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.platform-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}
.platform-card strong { color: var(--ink-soft); }
.platform-card .value { margin: 10px 0 6px; font-size: 22px; font-weight: 900; }
.platform-card p { margin: 0; color: var(--muted); font-weight: 800; }


/* P2 conversion funnel */
.funnel-panel { margin-bottom: 18px; }
.funnel-row { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
.funnel-label { width: 130px; flex: none; font-size: 13px; opacity: .75; }
.funnel-bar-wrap { flex: 1; height: 18px; border-radius: 6px; overflow: hidden; background: rgba(125,140,170,.14); }
.funnel-bar { height: 100%; min-width: 2px; border-radius: 6px; background: linear-gradient(90deg, #3b82f6, #22d3ee); }
.funnel-val { width: 96px; text-align: right; font-weight: 600; font-size: 13px; }
.funnel-pct { margin-left: 6px; font-weight: 400; font-size: 12px; opacity: .65; }
.funnel-leaks { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(125,140,170,.18); }
.leak-title { margin-bottom: 8px; font-size: 12px; opacity: .7; }
.leak-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.leak-row:hover { background: rgba(125,140,170,.10); }
.leak-count { min-width: 44px; padding: 2px 6px; text-align: center; font-weight: 700; color: #f59e0b; background: rgba(245,158,11,.14); border-radius: 6px; }
.leak-label { font-weight: 600; font-size: 13px; }
.leak-action { margin-left: auto; font-size: 12px; opacity: .65; }
