/*
 * waylog 车本全局样式 — 趋势弹窗
 * 职责：trend-dialog 底板、gallery-auto-banner、trend-dialog-shell/header/stepper 与趋势明细图表（trend-detail-*、tooltip）。
 * 拆分自原 styles.css 第 762-1227 行：规则内容零改动，仅按行切分；级联顺序 = 本文件在 index.html 中的链接顺序。
 * EV 暗色主题适配：按 docs/reskin-guide.md 原位换肤——弹窗底板/::backdrop（配方8）、横幅与控件井令牌化（配方3）、图表网格线 hairline-strong、tooltip 反白改深色玻璃井；深色阴影统一转纯黑透明；未改任何选择器与布局属性。
 */
.trend-dialog {
  width: min(840px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  border: 0;
  border-radius: var(--radius-sheet);
  padding: 0;
  color: var(--ink);
  background: color-mix(in oklch, var(--canvas-quiet), var(--veil-faint));
  box-shadow: var(--shadow-raise), var(--soft-edge);
}

.trend-dialog::backdrop {
  background: oklch(0 0 0 / 0.55);
  backdrop-filter: blur(6px);
}

.gallery-auto-banner {
  position: fixed;
  z-index: 900;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  width: min(460px, calc(100% - 20px));
  padding: 8px 11px 7px;
  border: 1px solid color-mix(in oklch, var(--green), var(--line) 68%);
  border-radius: var(--control-radius);
  color: var(--ink);
  background: color-mix(in oklch, var(--canvas-quiet), var(--veil-faint));
  box-shadow: 0 14px 38px oklch(0 0 0 / 0.2);
  backdrop-filter: var(--blur-glass);
  transform: translateX(-50%);
  display: grid;
  gap: 2px;
}

.gallery-auto-head,
.gallery-auto-head > span {
  display: flex;
  align-items: center;
}

.gallery-auto-head {
  justify-content: space-between;
  gap: 8px;
}

.gallery-auto-head > span {
  min-width: 0;
  gap: 8px;
}

.gallery-auto-head .lucide {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--green);
}

.gallery-auto-head strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-auto-head .text-action {
  min-height: 30px;
  flex: 0 0 auto;
  padding-inline: 9px;
  font-size: 0.76rem;
}

.gallery-count-control > span:first-child {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.gallery-count-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 var(--space-md);
  padding: 0 3px;
}

.gallery-count-control output {
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 800;
}

.gallery-count-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  margin: -5px 0 -4px;
  grid-column: 1 / -1;
  border: 0;
  background: transparent;
  cursor: ew-resize;
  touch-action: pan-x;
}

.gallery-count-control input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--green), var(--canvas) 70%);
}

.gallery-count-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -11px;
  border: 5px solid var(--surface);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 3px 10px oklch(0 0 0 / 0.28);
}

.gallery-count-control input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--green), var(--canvas) 70%);
}

.gallery-count-control input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 5px solid var(--surface);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 3px 10px oklch(0 0 0 / 0.28);
}

.gallery-count-scale {
  display: none;
}


.trend-dialog-shell {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-md);
  padding: var(--space-lg);
}

.trend-dialog-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.trend-dialog-header span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.trend-dialog-header small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.trend-dialog-header strong {
  overflow-wrap: anywhere;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 1.55rem;
  line-height: 1;
}

.trend-dialog-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--control-radius);
  color: var(--muted);
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--hairline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.trend-dialog-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.trend-dialog-stepper {
  display: inline-grid;
  grid-template-columns: repeat(2, 38px);
  border-radius: var(--control-radius);
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--hairline);
  overflow: hidden;
}

.trend-dialog-stepper button {
  width: 38px;
  height: 38px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.trend-dialog-stepper button + button {
  border-left: 1px solid var(--hairline);
}

.trend-dialog-stepper button:disabled {
  color: color-mix(in oklch, var(--muted), transparent 64%);
  cursor: default;
}

.trend-dialog-close:focus-visible,
.trend-dialog-stepper button:focus-visible,
.trend-detail-plot:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--green), transparent 32%);
  outline-offset: 2px;
}

.trend-dialog-chart {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: var(--space-sm);
}

.trend-dialog-key {
  min-height: 20px;
  justify-content: flex-end;
  font-size: 0.7rem;
}

.trend-dialog-key i {
  width: 16px;
}

.trend-detail-visual {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(52px, auto) minmax(0, 1fr);
  grid-template-rows: minmax(280px, 52vh) auto;
  gap: var(--space-xs) var(--space-sm);
}

.trend-detail-y-axis {
  min-width: 0;
  height: 100%;
  padding-block: 8%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: end;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.trend-detail-plot {
  position: relative;
  min-width: 0;
  height: 100%;
  border-radius: var(--control-radius);
  background: var(--surface-control);
  overflow: visible;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.trend-detail-plot.is-interacting {
  cursor: ew-resize;
}

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

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

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

.trend-detail-line.series-depreciation,
.trend-detail-line.series-unit-l {
  stroke-dasharray: 6 4;
}

.trend-detail-line.series-running {
  stroke-dasharray: 2 4;
}

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

.trend-detail-crosshair {
  position: absolute;
  z-index: 1;
  top: 8%;
  bottom: 8%;
  width: 1px;
  background: color-mix(in oklch, var(--ink), transparent 56%);
  pointer-events: none;
  transform: translateX(-0.5px);
}

.trend-detail-point {
  position: absolute;
  z-index: 2;
  width: 9px;
  height: 9px;
  border: 2px solid var(--surface-control);
  border-radius: 50%;
  background: var(--trend-series-color, var(--green));
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--trend-series-color, var(--green)), transparent 34%);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.trend-detail-tooltip {
  position: absolute;
  z-index: 3;
  top: var(--space-sm);
  left: 50%;
  width: min(188px, calc(100% - 8px));
  border-radius: var(--control-radius);
  padding: var(--space-xs) var(--space-sm);
  color: var(--ink);
  background: color-mix(in oklch, var(--canvas-quiet), var(--veil-faint));
  box-shadow: 0 6px 16px oklch(0 0 0 / 0.16), var(--soft-edge);
  pointer-events: none;
  transform: translateX(-50%);
}

.trend-detail-tooltip.is-left {
  transform: translateX(8px);
}

.trend-detail-tooltip.is-right {
  transform: translateX(calc(-100% - 8px));
}

.trend-detail-tooltip > strong,
.trend-detail-tooltip > small {
  display: block;
  overflow-wrap: anywhere;
}

.trend-detail-tooltip > strong {
  font-size: 0.7rem;
  line-height: 1.25;
}

.trend-detail-tooltip > small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.3;
}

.trend-detail-tooltip dl {
  margin: var(--space-xs) 0 0;
  display: grid;
  gap: var(--space-xs);
}

.trend-detail-tooltip dl > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-xs);
  align-items: baseline;
}

.trend-detail-tooltip dt,
.trend-detail-tooltip dd {
  min-width: 0;
  margin: 0;
  font-size: 0.64rem;
  line-height: 1.2;
}

.trend-detail-tooltip dt {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--muted);
}

.trend-detail-tooltip dt i {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--trend-series-color, var(--green));
}

.trend-detail-tooltip dd {
  overflow-wrap: anywhere;
  font-weight: 800;
  text-align: right;
}

.trend-detail-x-axis {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.2;
}

.trend-detail-x-axis span:last-child {
  text-align: right;
}

.trend-dialog-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

