/*
 * waylog 车本全局样式 — 通用组件与录入表单
 * 职责：h1/h2 标题、type-pill/filter-button/text-action/danger-action 等通用按钮、entry 表单控件（field/type-picker/parking-kind）、拍照与语音、金额键盘、note-suggestions、vehicle-form。
 * 拆分自原 styles.css 第 2346-3076 行：规则内容零改动，仅按行切分；级联顺序 = 本文件在 index.html 中的链接顺序。
 * EV 暗色主题适配说明：按 docs/reskin-guide.md 执行——次级控件井+发丝线（recipe 3）、九宫格/分段/chips 选中态（recipe 4）、金额键盘井（recipe 9）、玻璃卡片（recipe 1）、类目色徽标。
 */
h1,
h2 {
  margin: 0;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 1.65rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.entry-form,
.vehicle-form,
.sync-body {
  display: grid;
  gap: var(--space-lg);
}

.entry-form {
  position: relative;
  grid-template-columns: minmax(280px, 0.82fr) minmax(360px, 1fr);
  gap: var(--space-md);
  align-items: start;
}

.type-picker {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: var(--space-sm);
}

.parking-kind-field {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-sm);
}

.parking-kind-field legend {
  padding: 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1;
}

.parking-kind-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--control-radius);
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.parking-kind-picker button {
  min-height: 32px;
  border: 0;
  border-radius: calc(var(--control-radius) - 4px);
  color: var(--muted);
  background: transparent;
  font-size: var(--type-control-sm);
  font-weight: 800;
}

.parking-kind-picker button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.type-pill,
.filter-button,
.entry-ai-action,
.amount-chips button,
.keypad-button,
.text-action,
.danger-action,
.record-action,
.delete-button {
  border: 0;
  border-radius: var(--control-radius);
  color: var(--ink);
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
}

.text-action,
.danger-action {
  min-height: var(--control-height);
  padding: 0 var(--space-md);
  font-size: var(--type-control);
}

.text-action:disabled,
.danger-action:disabled,
.record-action:disabled,
.delete-button:disabled {
  color: color-mix(in oklch, var(--muted), var(--surface) 20%);
  background: color-mix(in oklch, var(--surface-control), var(--canvas) 30%);
  box-shadow: inset 0 0 0 1px var(--glass-strong);
  cursor: not-allowed;
}

.type-pill .lucide,
.filter-button .lucide,
.entry-ai-action .lucide {
  width: 15px;
  height: 15px;
}

.type-pill {
  min-height: 48px;
  padding: 0 var(--space-sm);
  font-size: var(--type-control-sm);
}

.type-pill.is-active,
.filter-button.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.filter-button.is-active .filter-count {
  color: color-mix(in oklch, var(--accent), transparent 22%);
}

.entry-photo-picker {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  align-self: end;
  min-width: 0;
  max-width: min(520px, 58vw);
  display: flex;
  align-items: center;
  gap: 6px;
}

.entry-photo-strip {
  min-width: 0;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.entry-photo-strip::-webkit-scrollbar {
  display: none;
}

.entry-photo-strip > :first-child {
  margin-left: auto;
}

.entry-photo-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 5px;
}

.entry-ai-action {
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface-control);
  font-size: var(--type-control-sm);
  white-space: nowrap;
}

.entry-photo-thumb {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
}

.entry-photo-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.entry-photo-thumb > span {
  position: absolute;
  inset: 3px 3px auto auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  color: transparent;
  background: oklch(0 0 0 / 0.5);
  box-shadow: 0 0 0 0.75px var(--ring-strong);
  display: grid;
  place-items: center;
}

.entry-photo-thumb > span .lucide {
  width: 6px;
  height: 6px;
  stroke-width: 2.5;
}

.entry-photo-thumb.is-selected {
  box-shadow: 0 0 0 2px var(--green);
}

.entry-photo-thumb.is-selected > span {
  color: var(--surface);
  background: var(--green);
}

.entry-photo-thumb:disabled {
  opacity: 1;
  cursor: default;
}

.entry-photo-thumb.is-queued {
  box-shadow: 0 0 0 2px var(--amber);
}

.entry-photo-thumb.is-queued > span {
  background: var(--amber);
}

.entry-photo-thumb.is-current {
  box-shadow: 0 0 0 2px var(--blue);
}

.entry-photo-thumb.is-current > span {
  background: var(--blue);
}

.entry-photo-thumb.is-reviewing {
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
}

.entry-photo-thumb.is-reviewing > span {
  background: var(--blue);
}

.entry-photo-thumb.is-failed {
  box-shadow: 0 0 0 2px var(--red);
}

.entry-photo-thumb.is-failed > span {
  background: var(--red);
}

.entry-photo-thumb.is-current > span .lucide-loader-circle {
  animation: entry-feedback-spin 900ms linear infinite;
}

.entry-photo-thumb.is-counting-down {
  box-shadow: 0 0 0 2px var(--blue);
}

.entry-photo-countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: oklch(0 0 0 / 0.58);
  font-size: 1.15rem;
  line-height: 1;
  text-shadow: 0 1px 3px oklch(0 0 0 / 0.65);
}

.entry-recognition-overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  width: 100%;
  min-height: 100%;
  border: 1px solid color-mix(in oklch, var(--blue), transparent 55%);
  border-radius: var(--control-radius);
  padding: var(--space-xl);
  color: var(--ink);
  background: color-mix(in oklch, var(--surface), transparent 16%);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  cursor: pointer;
}

.entry-recognition-overlay .lucide {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  color: var(--blue);
  animation: entry-feedback-spin 900ms linear infinite;
}

.entry-recognition-overlay span {
  display: grid;
  gap: 3px;
  text-align: left;
}

.entry-recognition-overlay strong {
  font-size: var(--type-control-lg);
}

.entry-recognition-overlay small {
  color: var(--muted);
  font-size: var(--type-control-sm);
  font-weight: 700;
}

.entry-photo-loading,
.entry-photo-empty {
  min-height: 30px;
  padding: 0 8px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--type-control-sm);
  font-weight: 800;
  white-space: nowrap;
}

.entry-photo-loading .lucide {
  width: 14px;
  height: 14px;
  animation: entry-feedback-spin 900ms linear infinite;
}

.entry-voice-action {
  min-width: 106px;
  min-height: var(--control-height-lg);
  border: 1px solid var(--hairline);
  border-radius: var(--control-radius);
  padding: 0 var(--space-md);
  color: var(--ink);
  background: var(--surface-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--type-control);
  font-weight: 800;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.entry-voice-action .lucide {
  width: 17px;
  height: 17px;
}

.entry-voice-action:focus:not(:focus-visible) {
  outline: none;
}

.entry-voice-action:active {
  transform: none;
}

.entry-ai-action:disabled {
  color: color-mix(in oklch, var(--muted), var(--surface) 20%);
  background: color-mix(in oklch, var(--surface-control), var(--canvas) 30%);
  box-shadow: inset 0 0 0 1px var(--glass-strong);
  cursor: not-allowed;
}

.entry-voice-action.is-recording {
  color: oklch(0.15 0.02 240);
  background: var(--red);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--red), transparent 82%);
  cursor: grabbing;
}

.entry-voice-action.is-recording {
  transform: scale(0.98);
}

.amount-line {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  align-items: start;
}

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

.field {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: var(--control-field-height);
  border-radius: var(--control-radius);
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface-control);
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
}

.field span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.66rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  font-size: var(--type-control);
}

.field input[type="date"] {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  -webkit-appearance: none;
  appearance: none;
}

.field input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.field input[type="date"]::-webkit-calendar-picker-indicator {
  margin: 0;
  padding: 0;
}

.field textarea {
  min-height: 34px;
  resize: vertical;
}

.field.has-note-suggestions {
  position: relative;
  overflow: visible;
  z-index: 2;
}

.field.has-note-suggestions:focus-within {
  z-index: 24;
}

.note-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 30;
  display: grid;
  gap: 4px;
  max-height: min(260px, 52vh);
  overflow: auto;
  padding: 6px;
  border-radius: 8px;
  background: color-mix(in oklch, var(--surface-panel), var(--surface) 18%);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--hairline);
}

.note-suggestions[hidden] {
  display: none;
}

#entryNoteSuggestions {
  top: auto;
  bottom: calc(100% + 6px);
  left: auto;
  width: min(360px, calc(100vw - 32px));
}

.note-suggestion-empty {
  padding: 10px 9px;
  color: var(--muted);
  font-size: var(--type-control-sm);
  font-weight: 800;
  line-height: 1.35;
}

.note-suggestion {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
}

.note-suggestion:hover,
.note-suggestion.is-active {
  background: color-mix(in oklch, var(--blue), var(--surface) 86%);
}

.note-suggestion strong,
.note-suggestion small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-suggestion strong {
  font-size: var(--type-control-sm);
  font-weight: 900;
  line-height: 1.22;
}

.note-suggestion small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}

.quantity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: var(--space-sm);
}

.amount-field input {
  min-height: auto;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: 1.72rem;
  font-weight: 800;
  text-align: right;
}

.amount-field-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.amount-field-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.entry-direction-picker {
  min-width: 0;
  padding: 2px;
  border-radius: 7px;
  background: color-mix(in oklch, var(--surface), var(--canvas) 48%);
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
}

.entry-direction-picker button {
  min-width: 54px;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

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

.entry-direction-picker button[data-entry-direction="income"].is-active {
  color: oklch(0.15 0.02 240);
  background: var(--green);
}

.entry-direction-hint {
  min-width: 0;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-form.is-income .amount-field {
  background: color-mix(in oklch, var(--surface-control), var(--green) 7%);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--green), transparent 58%);
}

.entry-form.is-income .amount-field input,
.entry-form.is-income .entry-direction-hint {
  color: var(--green);
}

.amount-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 8px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.amount-chips button {
  min-height: 44px;
  min-width: 0;
  padding: 0 var(--space-sm);
  color: var(--blue);
  background: color-mix(in oklch, var(--blue), transparent 86%);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--blue), transparent 74%);
  font-size: var(--type-control-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-keypad {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
}

.keypad-button {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  font-family: "Avenir Next Condensed", "DIN Condensed", "PingFang SC", sans-serif;
  font-size: var(--type-control-number);
  font-weight: 900;
}

.keypad-double-zero,
.keypad-zero {
  grid-column: span 2;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

#quantityField {
  grid-column: auto;
}

.form-grid:has(#odometerField:not([hidden])) .note-field,
.form-grid:has(#quantityField:not([hidden])) .note-field {
  grid-column: 1 / -1;
}

.vehicle-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: var(--space-md);
}

.vehicle-profile-view {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-sm);
  align-items: stretch;
}

.vehicle-profile-view div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: var(--space-md);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

.vehicle-profile-view span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.vehicle-profile-view strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

