:root {
  --bg: #0b0f14;
  --surface: #141a22;
  --surface2: #1c2430;
  --border: #2a3544;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b9eff;
  --accent2: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}

a {
  color: var(--accent);
}

.hero {
  padding: 1.25rem 1rem 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero .subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.panel h3 {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.grid-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem 1rem;
}

.field label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(59, 158, 255, 0.45);
  border-color: var(--accent);
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.5rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.toggle input {
  accent-color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

button.primary {
  background: linear-gradient(135deg, #2563eb, #3b9eff);
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

button.primary:active {
  transform: scale(0.98);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.kpi {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}

.kpi .label {
  font-size: 0.72rem;
  color: var(--muted);
}

.kpi .value {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.kpi .hint {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.kpi.risk-low .value {
  color: var(--accent2);
}
.kpi.risk-mid .value {
  color: var(--warn);
}
.kpi.risk-high .value {
  color: var(--danger);
}

.chart-card {
  margin-bottom: 1rem;
}

.chart-card .chart-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.chart-card .chart-desc {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.chart {
  width: 100%;
  height: 320px;
  min-height: 240px;
}

.chart.tall {
  height: 400px;
}

@media (max-width: 640px) {
  .chart {
    height: 260px;
  }
  .chart.tall {
    height: 300px;
  }
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.tab {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.tab.active {
  background: rgba(59, 158, 255, 0.2);
  border-color: var(--accent);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 520px;
}

table.data th,
table.data td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

table.data th:first-child,
table.data td:first-child {
  text-align: left;
}

table.data th {
  color: var(--muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--surface);
}

.badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}

.badge.low {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}
.badge.mid {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
.badge.high {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.insight-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
}

.insight-list li {
  margin-bottom: 0.45rem;
}

.insight-list strong {
  color: var(--accent);
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 1.5rem 1rem;
}

.section-anchor {
  scroll-margin-top: 0.5rem;
}

@media (min-width: 900px) {
  .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
  .two-col .chart-card {
    margin-bottom: 0;
  }
}
