/*
 * waylog 车本全局样式 — 总览页核心
 * 职责：summary-board、overview-range 时间范围、vehicle-block、metric 指标卡与内嵌趋势图（trend-chart/trend-key/trend-line）。
 * 拆分自原 styles.css 第 321-761 行：规则内容零改动，仅按行切分；级联顺序 = 本文件在 index.html 中的链接顺序。
 * EV 暗色主题适配：按 docs/reskin-guide.md 原位换肤——玻璃卡（配方1）、大数字渐变裁字（配方6）、下拉/快捷范围令牌化（配方3/4）、principal 反白卡改深色辉光英雄卡；未改任何选择器与布局属性。
 */
.summary-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  align-items: stretch;
}

.vehicle-block,
.metric,
.expense-chart,
.quick-panel,
.vehicle-panel,
.insight-panel,
.ledger-panel,
.sync-panel {
  border-radius: var(--radius-card);
  background: var(--glass);
  backdrop-filter: var(--blur-glass);
  box-shadow: var(--shadow), var(--soft-edge);
}

.overview-range {
  min-width: 0;
  width: min(192px, 100%);
  align-self: center;
  justify-self: end;
  display: block;
  border-radius: var(--control-radius);
  background: transparent;
}

.overview-range.is-open {
  z-index: 12;
}

.overview-range-toggle {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--hairline);
  border-radius: var(--control-radius);
  padding: 6px 10px;
  color: var(--ink);
  background: var(--surface-control);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: var(--space-sm);
  text-align: left;
}

.overview-range-toggle .lucide {
  justify-self: center;
  color: var(--muted);
  transition: transform 160ms ease;
}

.overview-range-toggle[aria-expanded="true"] .lucide {
  transform: rotate(180deg);
}

.overview-range-copy {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  align-items: center;
}

.overview-range-copy span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.overview-range-copy strong {
  min-width: 0;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 1.18rem;
  line-height: 1;
}

.overview-range-copy small {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.12;
  white-space: nowrap;
}

.overview-range-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% - var(--space-sm));
  right: var(--space-xl);
  width: min(360px, calc(100% - 48px));
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-card);
  background: color-mix(in oklch, var(--canvas-quiet), var(--glass));
  box-shadow: var(--shadow-raise), var(--soft-edge);
}

.overview-custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
  align-items: stretch;
}

.range-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: var(--space-sm);
}

.range-options button {
  min-height: 34px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0 var(--space-md);
  color: var(--muted);
  background: var(--glass);
  font-size: var(--type-control-sm);
  font-weight: 800;
}

.range-options button.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.range-error {
  min-height: 1.1em;
  margin: var(--space-xs) 0 0;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 700;
}

.vehicle-block {
  position: relative;
  grid-column: 1 / -1;
  min-height: 128px;
  padding: var(--space-xl);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-lg);
  background:
    linear-gradient(135deg, color-mix(in oklch, var(--green), transparent 86%), transparent 62%),
    var(--glass);
}

.vehicle-identity {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: var(--space-sm);
  padding-left: 122px;
}

/* 吉祥物小车（概览横幅主视觉）：绝对定位，不参与布局、不改卡片高度；上下各留约 14px 呼吸空间 */

.vehicle-mascot {
  position: absolute;
  left: 14px;
  bottom: 14px;
  height: min(calc(100% - 28px), 100px);
  width: auto;
  pointer-events: none;
}

.vehicle-mascot .mascot-stop-a { stop-color: var(--accent); }
.vehicle-mascot .mascot-stop-b { stop-color: var(--accent-2); }
.vehicle-mascot .mascot-accent-fill { fill: var(--accent); }
.vehicle-mascot .mascot-accent2-fill { fill: var(--accent-2); }
.vehicle-mascot .mascot-cyan-stroke { stroke: var(--cyan); }

@media (max-width: 980px) {
  .vehicle-identity {
    padding-left: 134px;
  }
}

.vehicle-name-label,
.section-heading p,
.metric span,
.field span,
.insight-copy > span {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
}

.section-heading p {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.section-heading p .lucide {
  width: 15px;
  height: 15px;
}

.vehicle-name-input {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 2px 0 4px;
  color: var(--ink);
  background: transparent;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.vehicle-name-input[readonly] {
  cursor: default;
}

.trend-discovery-hint {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.3;
}

.metric {
  min-height: 188px;
  padding: var(--space-lg);
  display: grid;
  align-content: start;
  gap: var(--space-sm);
  overflow: hidden;
  container-type: inline-size;
}

.metric.principal {
  background: linear-gradient(140deg, color-mix(in oklch, var(--surface), var(--green) 16%), color-mix(in oklch, var(--surface), var(--cyan) 8%));
  color: var(--ink);
  box-shadow: var(--shadow), var(--accent-glow);
}

.metric.principal span,
.metric.principal small {
  color: color-mix(in oklch, var(--ink), transparent 14%);
}

.metric strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 2.1rem;
  line-height: 0.92;
  background: var(--text-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}

.metric small {
  color: var(--muted);
  line-height: 1.28;
}

.metric-trend,
.insight-trend {
  min-width: 0;
  align-self: end;
}

.metric-trend {
  min-height: 58px;
  margin-top: auto;
  padding-top: var(--space-xs);
}

.insight-trend {
  min-height: 42px;
  margin-top: var(--space-xs);
}

.trend-chart {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.trend-open-button {
  position: absolute;
  z-index: 2;
  inset: 0;
  border: 0;
  border-radius: var(--control-radius);
  padding: 0;
  color: transparent;
  background: transparent;
  cursor: zoom-in;
}

.trend-open-button:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--green), transparent 28%);
  outline-offset: 2px;
}

.trend-key {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px var(--space-sm);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
}

.trend-key span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.trend-key i {
  width: 10px;
  height: 0;
  border-top: 1.5px solid var(--trend-series-color, var(--green));
}

.trend-key .series-depreciation i,
.trend-key .series-unit-l i {
  border-top-style: dashed;
}

.trend-key .series-running i {
  border-top-style: dotted;
}

.trend-plot {
  position: relative;
  min-width: 0;
}

.trend-svg {
  width: 100%;
  height: 44px;
  display: block;
  overflow: visible;
}

.insight-trend .trend-svg {
  height: 36px;
}

.trend-baseline {
  fill: none;
  stroke: var(--hairline-strong);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

.trend-line {
  fill: none;
  stroke: var(--trend-series-color, var(--green));
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.trend-end {
  position: absolute;
  width: 5px;
  height: 5px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--trend-series-color, var(--green));
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.trend-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--trend-series-color, var(--green));
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.series-total,
.series-primary {
  --trend-series-color: var(--green);
}

.series-depreciation,
.series-unit-l {
  --trend-series-color: var(--amber);
}

.series-running {
  --trend-series-color: var(--blue);
}

.series-unit-kwh {
  --trend-series-color: var(--green);
}

.trend-line.series-depreciation,
.trend-line.series-unit-l {
  stroke-dasharray: 5 3;
}

.trend-line.series-running {
  stroke-dasharray: 1 3;
}

.metric.principal .trend-key {
  color: color-mix(in oklch, var(--ink), transparent 18%);
}

.metric.principal .trend-baseline {
  stroke: var(--hairline-strong);
}

.metric.principal .series-total {
  --trend-series-color: var(--ink);
}

.metric.principal .trend-end {
  border-color: var(--surface);
}

.trend-state {
  min-height: 42px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: var(--space-xs);
  align-items: end;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 500;
  line-height: 1.25;
}

.trend-state::before {
  content: "";
  width: 100%;
  border-top: 1px dashed var(--hairline-strong);
}

.metric.principal .trend-state {
  color: var(--muted);
}

.metric.principal .trend-state::before {
  border-color: var(--hairline);
}

