/*
 * waylog 车本全局样式 — 录入与流水
 * 职责：record-dialog 及其表单/compact-list/fleet-details、lower-grid/insight-*、ledger-head、流水列表（record-list/record-item/record-row/record-*）、quick-toast。
 * 拆分自原 styles.css 第 4993-5757 行：规则内容零改动，仅按行切分；级联顺序 = 本文件在 index.html 中的链接顺序。
 * EV 暗色主题适配说明：按 docs/reskin-guide.md 执行——record-dialog 弹层（recipe 8）、流水卡玻璃化（recipe 1）与类目色低透明徽标、tabs/more 选中态（recipe 4）、insight 大数字（recipe 6）、quick-toast 玻璃胶囊。
 */
.record-dialog {
  width: min(720px, calc(100% - 32px));
  height: min(720px, calc(100vh - 64px));
  max-height: calc(100vh - 64px);
  border: 0;
  border-radius: var(--radius-sheet);
  padding: 0;
  color: var(--ink);
  background: var(--surface-panel);
  box-shadow: var(--shadow-raise), var(--soft-edge);
}

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

.record-dialog-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: var(--space-md);
  padding: var(--space-lg);
  overflow: hidden;
}

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

.record-dialog-header span {
  display: grid;
  gap: 2px;
}

.record-dialog-header small,
.record-history-heading span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

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

.record-dialog-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.record-dialog-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
  padding: 6px;
  border-radius: 8px;
  background: color-mix(in oklch, var(--surface), var(--canvas) 58%);
}

.record-dialog-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--type-control-sm);
  font-weight: 800;
}

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

.record-dialog-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--space-md);
  min-height: 0;
}

.record-history {
  display: grid;
  align-content: start;
  gap: var(--space-sm);
  min-height: 0;
  overflow: auto;
}

.record-history-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}

.record-history-heading strong {
  color: var(--muted);
  font-size: 0.76rem;
}

.inline-record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: 8px;
  background: color-mix(in oklch, var(--surface), var(--canvas) 48%);
  box-shadow: inset 0 0 0 1px var(--glass-strong);
}

.inline-record-form.is-editing {
  background: color-mix(in oklch, var(--surface), var(--green) 5%);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--green), transparent 62%);
}

.record-form-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}

.record-form-title span,
.fleet-details summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.record-form-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 1.18rem;
}

.inline-record-form .field:nth-of-type(3),
.compact-list {
  grid-column: 1 / -1;
}

.inline-record-form .secondary-action {
  align-self: end;
}

.record-form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.record-form-actions .text-action {
  min-height: var(--control-height);
  padding-inline: var(--space-md);
}

.compact-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-sm);
  list-style: none;
}

.compact-list li {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--ink);
  font-size: var(--type-control-sm);
}

.compact-list li.is-editing {
  background: color-mix(in oklch, var(--surface), var(--green) 5%);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--green), transparent 58%);
}

.compact-list small {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.compact-list button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in oklch, var(--surface), var(--canvas) 36%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compact-list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compact-empty {
  grid-template-columns: 1fr !important;
  color: var(--muted) !important;
}

.fleet-details {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
}

.fleet-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  cursor: pointer;
}

.fleet-details summary strong {
  color: var(--muted);
  font-size: 0.86rem;
}

.fleet-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.fleet-body .text-action {
  min-height: var(--control-field-height);
  padding: 0 var(--space-lg);
  color: var(--ink);
  background: transparent;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.35fr);
  gap: var(--space-xl);
  align-items: start;
}

.insight-list {
  min-width: 0;
}

.insight-groups {
  display: grid;
  gap: var(--space-lg);
}

.insight-group-nav {
  display: none;
}

.insight-group {
  min-width: 0;
  display: grid;
  gap: var(--space-sm);
}

.insight-group-title {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.1;
}

.insight-group-items {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
  gap: var(--space-sm) var(--space-lg);
}

@media (min-width: 981px) {
  .insight-group-items {
    row-gap: var(--space-md);
  }
}

.insight-item {
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(56px, 32%);
  gap: var(--space-sm);
  align-items: center;
  padding-block: var(--space-xs);
  overflow: hidden;
  container-type: inline-size;
}

.insight-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  align-content: center;
}

.insight-copy > span {
  line-height: 1.15;
}

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

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

.insight-item .insight-trend {
  min-height: 32px;
  margin-top: 0;
  align-self: center;
  opacity: 0.68;
}

.insight-trend .trend-baseline,
.insight-trend .trend-state::before {
  display: none;
}

.insight-trend .trend-chart {
  gap: 2px;
}

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

.insight-trend .trend-line {
  stroke-width: 1.35;
}

.insight-trend .trend-end {
  width: 4px;
  height: 4px;
}

.insight-trend .trend-dot {
  width: 4px;
  height: 4px;
}

.insight-trend .trend-state {
  min-height: 32px;
  grid-template-rows: 1fr;
  align-items: center;
  font-size: 0.58rem;
}

.ledger-head {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.ledger-filters {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  overflow: visible;
}

.filter-button {
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
  font-size: var(--type-control-sm);
  line-height: 1.25;
  white-space: nowrap;
}

.filter-button span {
  min-width: 0;
  min-height: 1.2em;
  padding-block: 1px;
  display: inline-flex;
  align-items: center;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-list {
  min-height: 160px;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  list-style: none;
}

.record-load-sentinel {
  min-height: 64px;
  display: grid;
  place-items: center;
}

.record-load-sentinel button {
  min-height: 42px;
  border: 0;
  border-radius: var(--control-radius);
  padding: 0 var(--space-lg);
  color: var(--muted);
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--hairline);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
}

.record-load-sentinel .lucide {
  width: 16px;
  height: 16px;
}

.record-load-sentinel small {
  color: color-mix(in oklch, var(--muted), transparent 25%);
}

.record-item {
  min-width: 0;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.record-row {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(58px, 0.18fr) minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  border-radius: var(--radius-card);
  background: var(--glass);
  box-shadow: var(--soft-edge);
  backdrop-filter: var(--blur-glass);
  cursor: default;
  touch-action: pan-y;
}

.record-row.is-swiping {
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.record-row.is-swipe-return {
  transition: transform 240ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

.record-swipe-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline: var(--space-md);
  border-radius: var(--radius-card);
  background: color-mix(in oklch, var(--surface), var(--blue) 18%);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.record-swipe-hint .lucide {
  width: 15px;
  height: 15px;
}

.record-item.is-swipe-armed .record-swipe-hint {
  background: var(--blue);
  color: oklch(0.15 0.02 240);
}

.quick-toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(86vw, 420px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow-raise);
  backdrop-filter: var(--blur-glass);
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.quick-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.record-row.is-editing {
  background: color-mix(in oklch, var(--blue) 10%, var(--glass));
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--blue), transparent 56%);
}

.record-row.is-income {
  background: var(--glass);
  box-shadow: var(--soft-edge);
}

.record-row.is-income .record-icon,
.record-row.is-income .record-type,
.record-row.is-income .record-main strong {
  color: var(--green);
}

.record-icon {
  width: 30px;
  height: 30px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tone-color, var(--green));
  background: color-mix(in oklch, var(--tone-color, var(--green)), transparent 78%);
  border-radius: var(--control-radius);
  box-shadow: none;
}

.record-icon .lucide {
  width: 25px;
  height: 25px;
  stroke-width: 2.35;
}

.record-stamp {
  min-width: 0;
  display: grid;
  gap: 3px;
  align-self: center;
  align-content: center;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.record-stamp time {
  color: var(--ink);
  font-weight: 900;
}

.record-stamp span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-main {
  min-width: 0;
  display: grid;
  gap: 2px;
  align-self: center;
  align-items: center;
  align-content: center;
}

.record-type {
  color: var(--tone-color, var(--green));
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.15;
}

.record-main strong {
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 1.35rem;
  line-height: 1.05;
}

.record-main p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-main p:focus-visible {
  outline: none;
}

.record-row.is-editing .record-main p,
.record-row.is-expanded .record-main p {
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}

.record-actions {
  min-width: max-content;
  position: relative;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.record-action {
  min-width: 0;
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 var(--space-sm);
  font-size: 0.74rem;
  line-height: 1;
  white-space: nowrap;
}

.record-action .lucide {
  width: 14px;
  height: 14px;
}

.more-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink);
  background: var(--surface-control);
}

.record-actions.is-open .more-button {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.record-action-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 132px;
  padding: 4px;
  display: grid;
  gap: 2px;
  border-radius: 12px;
  background: var(--surface-panel, var(--surface));
  box-shadow: var(--shadow), inset 0 0 0 1px var(--hairline-strong);
}

.record-action-menu.is-above {
  top: auto;
  bottom: calc(100% + 6px);
}

.record-menu-item {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.record-menu-item .lucide {
  width: 15px;
  height: 15px;
}

.record-menu-item:hover {
  background: color-mix(in oklch, var(--surface), var(--canvas) 45%);
}

.record-menu-item.is-destructive {
  color: var(--red);
}

.delete-button .lucide,
.compact-list button .lucide {
  width: 15px;
  height: 15px;
}

.danger-action {
  color: var(--red);
  background: color-mix(in oklch, var(--surface-control), var(--red) 8%);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--red), transparent 70%);
}

.compact-list button[data-delete-odometer-id],
.compact-list button[data-delete-valuation-id] {
  color: var(--red);
  background: color-mix(in oklch, var(--surface), var(--red) 8%);
}

.compact-list button[data-edit-odometer-id],
.compact-list button[data-edit-valuation-id] {
  color: var(--green);
  background: color-mix(in oklch, var(--surface), var(--green) 8%);
}

.empty-row {
  grid-column: 1 / -1;
  padding: var(--space-xl);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in oklch, var(--surface), var(--canvas) 48%);
  box-shadow: inset 0 0 0 1px var(--glass-strong);
  text-align: center;
}

