/* ── 主题变量 ──────────────────────────────────── */
:root {
  --navy:   #0D1B3E;
  --blue:   #2563EB;
  --blue2:  #1D4ED8;
  --green:  #10B981;
  --red:    #EF4444;
  --amber:  #F59E0B;
  --bg:     #F1F5F9;
  --card:   #FFFFFF;
  --text:   #0F172A;
  --text2:  #334155;
  --muted:  #64748B;
  --line:   #E2E8F0;
  --accent: #DBEAFE;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

/* ── App根容器 ──────────────────────────────────── */
.app-root { min-height: 100vh; display: flex; flex-direction: column; }

/* ── 顶栏 ─────────────────────────────────────────
   深色品牌头部，参考 ChatGPT 版本
────────────────────────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, #0D1B3E 0%, #1E3A70 100%);
  color: #fff;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* BD 徽标 */
.brand-badge {
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.brand-texts { display: flex; flex-direction: column; }
.topbar-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
  line-height: 1.2;
}
.topbar-sub {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  letter-spacing: .5px;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 币种切换 */
.currency-radio {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 3px;
}
.currency-radio label {
  color: rgba(255,255,255,.7) !important;
  font-size: 11px !important;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.currency-radio input[type=radio]:checked + label,
.currency-radio label:has(input:checked) {
  background: var(--blue);
  color: #fff !important;
}
.currency-radio input[type=radio] { display: none; }

/* 刷新按钮 */
.btn-refresh {
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-refresh:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* ── 筛选栏 ─────────────────────────────────────── */
.filter-bar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  flex-wrap: wrap;
}
.filter-item { display: flex; align-items: center; gap: 8px; }
.filter-item-wide .filter-dropdown { min-width: 280px; }
.filter-item .filter-dropdown { min-width: 170px; }
.filter-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ── Tab 导航 ─────────────────────────────────────
   Dash 渲染结构: .tab-container > .tab > span
────────────────────────────────────────────────── */
.tab-container.tabs {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: visible;
  flex-wrap: nowrap;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* 每个 Tab 外壳 */
.tab {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  flex-shrink: 0;
}

/* Tab 标签文字（Dash 把 label 渲染进 span） */
.tab > span {
  display: block;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  letter-spacing: .2px;
}

.tab:hover > span {
  color: var(--blue);
}

/* 选中态 */
.tab--selected > span,
.tab-selected > span {
  color: var(--blue) !important;
  font-weight: 700 !important;
  border-bottom: 2px solid var(--blue) !important;
}

/* ── 页面容器 ────────────────────────────────────── */
.page-content { flex: 1; overflow-y: auto; }
.page-single {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1600px;
}

/* ── 分区标题（01 · 总览 风格）─────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.section-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--blue);
  background: var(--accent);
  border-radius: 5px;
  padding: 3px 8px;
  letter-spacing: .5px;
}
.section-title-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.section-desc {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

/* ── 卡片 ─────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 8px rgba(15,23,42,.04);
  padding: 20px;
}
.card-sm { padding: 14px 16px; }

/* ── KPI 行（大字风格）──────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.kpi-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 8px rgba(15,23,42,.04);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 3px 0 0 3px;
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 12px;
}
.kpi-halves { display: flex; gap: 12px; }
.kpi-half { flex: 1; min-width: 0; }
.kpi-sub {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.kpi-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -.3px;
}
.kpi-val-blue { color: var(--blue) !important; }
.kpi-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}
.kpi-sub-text {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── 图表行 ─────────────────────────────────────── */
.chart-row { display: flex; gap: 14px; }
.chart-half { flex: 1; min-width: 0; }
.chart-third { flex: 1; min-width: 0; }

/* ── 表格 ─────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.tbl th, .tbl td {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl th:first-child, .tbl td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
}
.tbl thead th {
  background: #F8FAFC;
  color: var(--muted);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--line);
}
.tbl thead th:first-child { z-index: 3; }

/* 月份列头稍窄 */
.tbl .col-month { min-width: 72px; }
.tbl .col-pct   { min-width: 56px; }

.tbl-th { cursor: pointer; user-select: none; }
.tbl-th:hover { background: #EFF6FF !important; color: var(--blue); }

.tbl tbody tr:hover td { background: #F8FAFF; }

/* 合计行 */
.tbl-total-row td {
  background: #EFF6FF !important;
  font-weight: 700;
  color: var(--navy);
  border-top: 2px solid var(--line);
}

/* H1/H2 列高亮 */
.col-h1 { background: #F8FAFC; }
.col-h2 { background: #EFF6FF; color: var(--blue); font-weight: 600; }

/* 正负色 */
.text-green { color: var(--green) !important; font-weight: 600; }
.text-red   { color: var(--red)   !important; font-weight: 600; }
.text-blue  { color: var(--blue)  !important; }
.text-muted { color: var(--muted) !important; }

/* ── H1/H2 标签 chip ────────────────────────────── */
.chip-h1 {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #F1F5F9;
  color: var(--muted);
  margin-right: 4px;
}
.chip-h2 {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--blue);
}

/* ── 通知条 ─────────────────────────────────────── */
.notice-warning {
  background: #FFFBEB;
  border-left: 4px solid var(--amber);
  color: #92400E;
  padding: 10px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  font-weight: 500;
}
.notice-ok {
  background: #ECFDF5;
  border-left: 4px solid var(--green);
  color: #065F46;
  padding: 10px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  font-weight: 500;
}

/* ── 分隔线标题 ─────────────────────────────────── */
.sub-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sub-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── 可展开表格行 ───────────────────────────────── */
.tier-header-row td {
  background: #EEF2FF;
  cursor: pointer;
  font-weight: 700;
  color: var(--navy);
  border-top: 1px solid #C7D2FE;
}
.tier-header-row:hover td { background: #E0E7FF; }

.model-detail-row td {
  background: #F8FAFC;
  font-size: 11.5px;
  color: var(--text2);
}
.model-detail-row:hover td { background: #F0F7FF; }

/* 机型销量筛选区 */
.filter-dropdown {
  min-width: 160px;
  font-size: 12px;
}

/* ── 全览模式分隔线 ──────────────────────────────── */
.section-divider {
  border: none;
  border-top: 3px solid var(--line);
  margin: 0;
  opacity: 0.6;
}

/* ── 响应式 ─────────────────────────────────────── */
@media (max-width: 1300px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .chart-row { flex-direction: column; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: 1fr; }
  .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
}
