/* === macOS-inspired Bright SaaS Dashboard === */
@font-face {
  font-family: 'Smiley Sans';
  src: url('https://cdn.jsdelivr.net/gh/atelier-anchor/smiley-sans@v2.0.1/dist/SmileySans-Oblique.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f5f7;
  --bg-sidebar: rgba(251,251,253,0.85);
  --bg-card: #ffffff;
  --bg-hover: #f0f0f3;
  --bg-active: rgba(0,122,255,0.08);
  --bg-input: #ffffff;
  --border: #e5e5ea;
  --border-strong: #d2d2d7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #8e8e93;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.14), 0 0 0 0.5px rgba(0,0,0,0.06);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --accent: #007AFF;
  --accent-soft: rgba(0,122,255,0.1);
  --red: #FF3B30;
  --red-soft: rgba(255,59,48,0.1);
  --orange: #FF9500;
  --orange-soft: rgba(255,149,0,0.1);
  --yellow: #FFCC00;
  --yellow-soft: rgba(255,204,0,0.15);
  --yellow-dark: #a87900;
  --green: #34C759;
  --green-soft: rgba(52,199,89,0.1);
  --purple: #AF52DE;
  --indigo: #5856D6;
  --pink: #FF2D55;
  --teal: #5AC8FA;
  --gray-bg: #f2f2f7;
  --font: 'Smiley Sans', '得意黑', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

button { font-family: inherit; font-size: inherit; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* === App shell === */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* === Sidebar === */
.sidebar {
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 0.5px solid var(--border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 14px;
}
.sidebar-brand .logo {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--indigo));
  display: grid; place-items: center;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.sidebar-brand .title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.sidebar-brand .subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}
.sidebar-section {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
  transition: background 0.1s;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active {
  background: var(--accent);
  color: #fff;
}
.nav-item.active .ico { color: #fff; }
.nav-item .ico { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-secondary); }
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--text-secondary);
}
.nav-item.active .count { background: rgba(255,255,255,0.25); color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* === Main content === */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: rgba(245,245,247,0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid var(--border);
  z-index: 10;
  position: relative;
}
.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.topbar .crumb-sep { color: var(--text-tertiary); }
.topbar .crumb-current { color: var(--text-secondary); font-weight: 500; }

.global-search {
  margin-left: auto;
  position: relative;
  width: 320px;
}
.global-search input {
  width: 100%;
  height: 30px;
  padding: 0 32px 0 32px;
  border-radius: 8px;
  background: rgba(0,0,0,0.04);
  border: 0.5px solid transparent;
  font-size: 13px;
  outline: none;
  transition: all 0.15s;
}
.global-search input:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.global-search .search-ico {
  position: absolute;
  left: 9px; top: 7px;
  width: 16px; height: 16px;
  color: var(--text-tertiary);
}
.global-search .search-clear {
  position: absolute;
  right: 6px; top: 6px;
  width: 18px; height: 18px;
  border: none;
  background: rgba(0,0,0,0.1);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.1s;
}
.global-search .search-clear:hover { background: rgba(0,0,0,0.18); color: var(--text); }

.search-results {
  position: absolute;
  top: 36px;
  left: 0; right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  border: 0.5px solid var(--border);
  max-height: 420px;
  overflow-y: auto;
  z-index: 50;
  padding: 6px 0;
}
.search-results .group-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 12px 4px;
}
.search-results .result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.08s;
}
.search-results .result:hover { background: var(--bg-hover); }
.search-results .result .key { font-weight: 600; min-width: 56px; }
.search-results .result .body { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .result .meta { font-size: 11.5px; color: var(--text-tertiary); }
.search-results .empty-state { padding: 20px 12px; text-align: center; color: var(--text-secondary); font-size: 12.5px; }

.topbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.icon-button {
  width: 30px; height: 30px;
  border-radius: 7px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--text-secondary);
  transition: background 0.1s;
}
.icon-button:hover { background: rgba(0,0,0,0.06); }
.icon-button svg { width: 17px; height: 17px; }

.server-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: rgba(0,0,0,0.04);
  border-radius: 100px;
}
.server-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary); }
.server-pill.online .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(52,199,89,0.2); }
.server-pill.online { color: var(--text); }

/* === Content area === */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 60px;
}
.content-narrow { max-width: 1280px; margin: 0 auto; }

/* === Page header === */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head .sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 3px;
}
.page-head-actions { display: flex; gap: 8px; align-items: center; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  border: 0.5px solid var(--border-strong);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.1s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0,122,255,0.25);
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 90%, black); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(0,0,0,0.05); }
.btn svg { width: 14px; height: 14px; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border: 0.5px solid rgba(0,0,0,0.06);
  padding: 18px;
}
.card-tight { padding: 14px; }
.card h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3 .badge-soft { font-size: 11px; padding: 2px 7px; }
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title-row h3 { margin: 0; }
.card-link {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}
.card-link:hover { text-decoration: underline; }

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  border: 0.5px solid rgba(0,0,0,0.06);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi .label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi .num {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi .num .unit { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-left: 2px; }
.kpi .delta { font-size: 11px; margin-top: 5px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.kpi .delta.up { color: var(--red); }
.kpi .delta.down { color: var(--green); }
.kpi .ico-bg {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
}
.kpi .ico-bg svg { width: 16px; height: 16px; }
.kpi.accent-blue .ico-bg { background: var(--accent-soft); color: var(--accent); }
.kpi.accent-orange .ico-bg { background: var(--orange-soft); color: var(--orange); }
.kpi.accent-red .ico-bg { background: var(--red-soft); color: var(--red); }
.kpi.accent-green .ico-bg { background: var(--green-soft); color: var(--green); }
.kpi.accent-purple .ico-bg { background: rgba(175,82,222,0.1); color: var(--purple); }
.kpi.accent-gray .ico-bg { background: rgba(0,0,0,0.06); color: var(--text-secondary); }
.ledger-metric { border-top: 3px solid transparent; }
.ledger-metric[data-ledger-status="overdue"] { border-top-color: var(--red); }
.ledger-metric[data-ledger-status="due-soon"] { border-top-color: var(--orange); }
.ledger-metric[data-ledger-status="ok"] { border-top-color: var(--green); }
.ledger-metric[data-ledger-status="needs_review"] { border-top-color: #8e8e93; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.badge.red    { background: var(--red-soft); color: var(--red); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow-dark); }
.badge.green  { background: var(--green-soft); color: var(--green); }
.badge.blue   { background: var(--accent-soft); color: var(--accent); }
.badge.gray   { background: rgba(0,0,0,0.06); color: var(--text-secondary); }
.badge.purple { background: rgba(175,82,222,0.12); color: var(--purple); }
.badge-soft { background: rgba(0,0,0,0.06); color: var(--text-secondary); }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Tables */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--border);
  background: rgba(0,0,0,0.015);
  white-space: nowrap;
}
.tbl th:first-child { border-top-left-radius: var(--radius-sm); }
.tbl th:last-child  { border-top-right-radius: var(--radius-sm); }
.tbl td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.08s; }
.tbl tbody tr:hover { background: rgba(0,122,255,0.04); }
.tbl tbody tr.selectable { cursor: pointer; }
.tbl .mono { font-family: var(--font-mono); font-size: 12px; }
.tbl .num { font-variant-numeric: tabular-nums; text-align: right; }
.tbl .truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Health matrix */
.matrix-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
.matrix {
  border-collapse: separate;
  border-spacing: 2px;
}
.matrix th {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  padding: 6px 4px;
  background: transparent;
  border: none;
  vertical-align: bottom;
}
.matrix th.first-col { text-align: right; padding-right: 8px; min-width: 60px; }
.matrix td {
  text-align: center;
  padding: 0;
  background: transparent;
  border: none;
}
.matrix td.vehicle-cell {
  text-align: right;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  padding-right: 8px;
  cursor: pointer;
  min-width: 60px;
}
.matrix td.vehicle-cell:hover { color: var(--accent); }
.matrix-cell {
  width: 28px;
  height: 22px;
  border-radius: 4px;
  display: inline-block;
  cursor: pointer;
  transition: transform 0.1s;
}
.matrix-cell:hover { transform: scale(1.15); }
.matrix-cell.green { background: var(--green); }
.matrix-cell.orange { background: var(--orange); }
.matrix-cell.red { background: var(--red); }
.matrix-cell.none { background: var(--gray-bg); }

/* Donut chart */
.donut-card { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center; }
.donut-svg { width: 180px; height: 180px; }
.donut-center {
  position: relative;
  text-align: center;
}
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.donut-legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.donut-legend-item .swatch { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend-item .name { color: var(--text); }
.donut-legend-item .val { font-variant-numeric: tabular-nums; font-weight: 500; }
.donut-legend-item .pct { color: var(--text-secondary); font-size: 11.5px; font-variant-numeric: tabular-nums; width: 38px; text-align: right; }

/* Timeline */
.timeline {
  position: relative;
  padding-left: 18px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 1.5px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding: 6px 0 14px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 11px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}
.timeline-item.保养::before { border-color: var(--green); }
.timeline-item.维修::before { border-color: var(--orange); }
.timeline-item.诊断::before { border-color: var(--purple); }
.timeline-item .date {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 2px;
}
.timeline-item .body { font-size: 13px; }
.timeline-item .amount { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Drawer */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.18);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 90vw;
  background: var(--bg-card);
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32,0.72,0,1);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 16px 20px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-head h3 { font-size: 15px; font-weight: 600; }
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.drawer-foot {
  padding: 12px 20px;
  border-top: 0.5px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Form */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.field input, .field select, .field textarea {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  border: 0.5px solid var(--border-strong);
  background: #fff;
  font-size: 13px;
  outline: none;
  transition: border 0.1s, box-shadow 0.1s;
}
.field textarea {
  height: 64px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.5;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #fff;
  border: 0.5px solid var(--border-strong);
  border-radius: 100px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
}
.filter-chip:hover { background: var(--bg-hover); }
.filter-chip.active { background: var(--accent); color: #fff; border-color: transparent; }
.filter-chip svg { width: 12px; height: 12px; }
.filter-chip .x { margin-left: 3px; opacity: 0.7; }
.filter-chip .x:hover { opacity: 1; }
.filter-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

/* Segmented control */
.segmented {
  display: inline-flex;
  background: rgba(0,0,0,0.05);
  padding: 2px;
  border-radius: 8px;
  gap: 2px;
}
.segmented button {
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.12s;
  white-space: nowrap;
}
.segmented button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Status pills (specific to repair states) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 100px;
  cursor: pointer;
  border: 0.5px solid transparent;
  transition: all 0.1s;
  white-space: nowrap;
}
.status-pill:hover { box-shadow: 0 0 0 3px rgba(0,0,0,0.04); }
.status-pill.待处理      { background: rgba(142,142,147,0.15); color: #6e6e73; }
.status-pill.进场维修中  { background: var(--accent-soft); color: var(--accent); }
.status-pill.待复查      { background: rgba(175,82,222,0.13); color: var(--purple); }
.status-pill.已完成      { background: var(--green-soft); color: var(--green); }
.status-pill.搁置        { background: var(--orange-soft); color: var(--orange); }
.status-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* Loading + empty */
.spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.08);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
}
.empty .ico {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--gray-bg);
  display: inline-grid;
  place-items: center;
  margin-bottom: 12px;
  color: var(--text-tertiary);
}
.empty h4 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* Anomaly cards */
.anom-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  border: 0.5px solid var(--border);
  transition: all 0.15s;
}
.anom-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.anom-card .stripe { width: 4px; height: 100%; min-height: 36px; border-radius: 2px; }
.anom-card.red .stripe { background: var(--red); }
.anom-card.orange .stripe { background: var(--orange); }
.anom-card.yellow .stripe { background: var(--yellow); }

/* ============================================================
   移动端适配 (iOS / Android) — 底部标签栏 + 卡片化表格
   ============================================================ */
@media (max-width: 768px) {
  /* 壳：单列，整页滚动。minmax(0,1fr) 防止被宽内容撑破视口 */
  .app { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 100vh; }
  .main, .content, .content-narrow { overflow-x: hidden; min-width: 0; }

  /* 侧边栏 → 底部标签栏 */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    height: 58px; flex-direction: row; align-items: stretch; gap: 0;
    padding: 0; border-right: none; border-top: 0.5px solid var(--border);
    overflow-x: auto; overflow-y: hidden; z-index: 100;
    -webkit-overflow-scrolling: touch;
    backdrop-filter: blur(20px) saturate(180%);
  }
  .sidebar-brand, .sidebar-section, .sidebar-footer { display: none; }
  .nav-item {
    position: relative; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; width: auto; min-width: 62px; padding: 6px 6px;
    border-radius: 0; font-size: 10px; flex: 0 0 auto; white-space: nowrap;
  }
  .nav-item span:not(.count) { font-size: 10px; }
  .nav-item .ico { width: 20px; height: 20px; }
  .nav-item.active { background: transparent; color: var(--accent); }
  .nav-item.active .ico { color: var(--accent); }
  .nav-item .count {
    position: absolute; top: 3px; right: 50%; transform: translateX(20px);
    margin: 0; font-size: 9px; line-height: 1.4; padding: 0 4px;
    background: var(--red); color: #fff;
  }

  /* 主内容腾出底栏空间 + 顶栏紧凑 */
  .content { padding-bottom: 72px !important; }
  .content-narrow { padding-left: 12px; padding-right: 12px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .topbar .crumb-sep, .topbar .crumb-current { display: none; }
  .global-search { width: auto; flex: 1; min-width: 0; }
  .page-head { flex-wrap: wrap; gap: 8px; }

  /* 普通表格：横向滚动兜底，不撑破屏幕 */
  .tbl:not(.tbl-cards) {
    display: block; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* 卡片化表格（报修台账）：每行变一张卡 */
  .tbl-cards thead { display: none; }
  .tbl-cards, .tbl-cards tbody { display: block; width: 100%; }
  .tbl-cards tr {
    display: block; border: 0.5px solid var(--border); border-radius: 10px;
    margin: 0 10px 10px; padding: 6px 12px; background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .tbl-cards td {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; padding: 5px 0; border: none !important;
    max-width: none !important; white-space: normal; text-align: right;
    font-size: 13px;
  }
  .tbl-cards td::before {
    content: attr(data-label); font-weight: 600; color: var(--text-secondary);
    font-size: 11.5px; flex-shrink: 0; text-align: left;
  }
  .tbl-cards td:empty { display: none; }
  .tbl-cards td.right, .tbl-cards td[data-label="操作"] { justify-content: flex-end; }
  .tbl-cards td.truncate { max-width: none !important; }

  /* KPI 卡 / 双列面板：自适应收缩，不溢出 */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .grid-2 { grid-template-columns: 1fr !important; }
  /* 内联多列 grid（报修面板/费用明细等）窄屏单列，避免溢出 */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(4"] { grid-template-columns: 1fr !important; }
  /* 快速加报修：窄屏换行 */
  .quick-add { flex-wrap: wrap; }
  .quick-add .qa-prob { flex: 1 1 100% !important; order: 3; }
  /* 同步状态条 / 待复核卡 */
  .sync-bar { flex-wrap: wrap; gap: 8px 14px; }
  .review-card { flex-direction: column; align-items: stretch; gap: 10px; }
  .review-actions { flex-direction: row; }
  .review-actions .btn { flex: 1; }
}
.anom-card .head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.anom-card .veh { font-weight: 600; font-size: 13.5px; }
.anom-card .reason { font-size: 12.5px; color: var(--text); margin-bottom: 2px; }
.anom-card .meta { font-size: 11.5px; color: var(--text-secondary); }

/* Charts axis labels */
.chart-label { font-size: 10.5px; fill: var(--text-secondary); font-family: var(--font); }

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 100px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.28); }
::-webkit-scrollbar-track { background: transparent; }

/* === Repairs dashboard helpers === */
.open-veh-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.open-veh-row:hover { background: var(--bg-hover); }
.open-veh-row.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* Sort group near the filter actions */
.sort-segmented {
  display: inline-flex;
  background: rgba(0,0,0,0.05);
  padding: 2px;
  border-radius: 7px;
  gap: 2px;
}
.sort-segmented button {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-secondary);
}
.sort-segmented button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* System fingerprint tiles (vehicle detail) */
.sys-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s;
  text-align: left;
  font: inherit;
  color: inherit;
}
.sys-tile:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.sys-tile.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.sys-tile-special {
  grid-column: span 1;
  background: linear-gradient(135deg, rgba(255,255,255,1), rgba(248,248,250,1));
  border-color: var(--border-strong);
}
.sys-tile-special.active {
  background: var(--accent-soft);
}
.sys-tile-ico {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gray-bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sys-tile.active .sys-tile-ico { background: rgba(255,255,255,0.6); }
.sys-tile-body { flex: 1; min-width: 0; }
.sys-tile-name { font-size: 12.5px; font-weight: 600; }
.sys-tile-meta { font-size: 11.5px; color: var(--text-secondary); display: flex; align-items: center; margin-top: 2px; gap: 0; }

.part-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  border-bottom: 0.5px solid var(--border);
  background: transparent;
  border-left: none; border-right: none; border-top: none;
}
.part-row:last-child { border-bottom: none; }
.part-row:hover { background: var(--bg-hover); }

.month-row { cursor: pointer; }
.month-row:hover { background: var(--bg-hover) !important; }
.month-row.expanded { background: var(--accent-soft) !important; }
.month-row.expanded td { border-bottom: none !important; }
.month-detail-row td { border-top: 0.5px solid var(--accent) !important; }

/* Chinese-friendly date cell — black/yahei, no wrap */
.date-cn {
  font-family: '微软雅黑', 'Microsoft YaHei', 'SimHei', 'PingFang SC', sans-serif;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Labor / part kind badge */
.kind-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.kind-labor {
  background: rgba(255,149,0,0.14);
  color: var(--orange);
}
.kind-part {
  background: rgba(0,122,255,0.10);
  color: var(--accent);
}

/* Month split table — visual polish */
.tbl-month-split th {
  vertical-align: middle;
  padding: 10px 12px;
}
.tbl-month-split td { vertical-align: middle; }

.tbl-month-split .bucket-th {
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.tbl-month-split .bucket-th .bucket-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}
.tbl-month-split .bucket-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tbl-month-split .month-cell {
  font-family: 'Smiley Sans', 'YouSheBiaoTiHei', '微软雅黑', 'Microsoft YaHei', sans-serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--text);
}


/* === Parts list (vehicle detail) === */
.part-row-wrap {
  border-bottom: 0.5px solid var(--border);
}
.part-row-wrap:last-child { border-bottom: none; }
.part-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  cursor: pointer;
  transition: background 0.1s;
  background: transparent;
  border: none;
}
.part-row:hover { background: var(--bg-hover); }
.part-row.expanded { background: var(--accent-soft); }

.part-detail {
  background: #fbfbfd;
  padding: 4px 8px 8px 22px;
}
.part-detail-row {
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: #fff;
  border: 0.5px solid var(--border);
}
.part-detail-row:last-child { margin-bottom: 0; }

.invoice-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 100px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
}
.invoice-chip-btn {
  border: none;
  cursor: pointer;
  transition: filter 0.1s, transform 0.05s;
}
.invoice-chip-btn:hover { filter: brightness(0.95); }
.invoice-chip-btn:active { transform: scale(0.96); }
.invoice-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.invoice-chip-repair {
  background: var(--accent-soft);
  color: var(--accent);
}
.invoice-chip-parts {
  background: rgba(175,82,222,0.12);
  color: var(--purple);
}

/* Util */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; }
.muted { color: var(--text-secondary); }
.mono { font-family: var(--font-mono); }
.right { text-align: right; }
.center { text-align: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.h-12 { font-size: 12px; } .h-13 { font-size: 13px; } .h-14 { font-size: 14px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.flex-wrap { flex-wrap: wrap; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-overview { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
@media (max-width: 1100px) {
  .grid-overview { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .donut-card { grid-template-columns: 1fr; }
}

.sync-bar{display:flex;gap:16px;align-items:center;flex-wrap:wrap;padding:8px 14px;margin:0 0 12px;
  background:var(--card,#fff);border:1px solid #e5e7eb;border-radius:10px;font-size:13px;color:#374151}
.sync-bar.warn{border-color:var(--yellow-dark,#d97706);background:var(--yellow-soft,#fffbeb)}
.sync-bar .red{color:#dc2626;font-weight:600}

/* 批量报修抽屉 */
.batch-textarea{width:100%;font-size:13px;line-height:1.5;padding:10px;border:1px solid var(--border);border-radius:8px;resize:vertical;font-family:inherit}
.batch-tbl{width:100%;font-size:12.5px}
.batch-tbl th{text-align:left;color:var(--text-secondary);font-weight:500;padding:4px 6px}
.batch-tbl td{padding:3px 6px;border-top:0.5px solid var(--border);vertical-align:middle}
.batch-tbl .cell-in{width:100%;border:1px solid transparent;background:transparent;font-size:12.5px;padding:2px 4px;border-radius:4px;font-family:inherit}
.batch-tbl .cell-in:focus{border-color:var(--border);background:#fff;outline:none}
.batch-tbl tr.dup-row{opacity:.5;background:var(--yellow-soft,#fffbeb)}
.batch-tbl .dup-tag{font-size:11px;color:var(--yellow-dark,#d97706)}
.batch-err{color:#dc2626;font-size:12.5px;margin:8px 0;padding:6px 10px;background:#fef2f2;border-radius:6px}

/* 待复核页 */
.review-card{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:14px 16px;margin-bottom:10px}
.review-main{flex:1;min-width:0}
.review-tk{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}
.review-tk .rv-veh{font-weight:700;font-size:15px}
.review-tk .rv-prob{font-size:13.5px}
.rv-meta{font-size:12px;color:var(--text-tertiary,#9ca3af)}
.review-inv{margin-top:5px;font-size:13px}
.review-inv .rv-arrow{color:var(--text-secondary)}
.rv-text{margin-top:5px;font-size:12.5px;color:var(--text-secondary);line-height:1.5}
.rv-reason{margin-top:3px;font-size:11.5px;color:var(--text-tertiary,#9ca3af)}
.review-actions{display:flex;flex-direction:column;gap:6px;flex-shrink:0}

/* 快速加报修 */
.quick-add{display:flex;gap:8px;margin:0 0 14px;align-items:center}
.quick-add input{border:1px solid var(--border);border-radius:8px;padding:8px 10px;font-size:13px;font-family:inherit;background:var(--card,#fff)}
.quick-add input:focus{outline:none;border-color:var(--accent,#007AFF)}
.quick-add .qa-veh{width:96px;font-weight:600}
.quick-add .qa-prob{flex:1;min-width:0}

/* === 维修档案 === */
.history-page{max-width:1540px;margin:0 auto;min-width:0}
.history-page-head{align-items:center;margin-bottom:14px}
.history-controls{flex-wrap:wrap}
.history-controls select{height:32px;min-width:92px;background:#fff}
.history-scope-tabs{margin-right:2px}
.history-tabs{margin-left:2px}
.history-overview-grid{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(320px,1fr);gap:14px;align-items:stretch}
.history-panel,.history-service-card,.history-evidence-card{background:var(--bg-card);border:0.5px solid var(--border);border-radius:12px;box-shadow:var(--shadow);overflow:hidden;min-width:0}
.history-panel-head{min-height:46px;display:flex;align-items:center;gap:10px;padding:9px 14px;border-bottom:0.5px solid var(--border)}
.history-panel-head>div{display:flex;align-items:baseline;gap:8px;min-width:0}
.history-panel-head h3{font-size:14px;margin:0;white-space:nowrap}
.history-panel-head span,.history-panel-head small{font-size:11px;color:var(--text-secondary)}
.history-panel-head small{margin-left:auto;white-space:nowrap}
.history-track-body{padding:10px 14px 12px}
.history-months{display:grid;grid-template-columns:104px repeat(12,minmax(0,1fr));align-items:center;margin-bottom:4px}
.history-months button{border:0;background:transparent;color:var(--text-secondary);font-size:11px;font-weight:600;padding:2px 0;cursor:pointer;border-radius:5px}
.history-months button:hover,.history-months button.active{background:var(--accent-soft);color:var(--accent)}
.history-lane{display:grid;grid-template-columns:104px minmax(0,1fr);align-items:center;min-height:31px}
.history-lane-name{border:0;background:transparent;text-align:left;padding:4px 6px 4px 0;color:var(--text-secondary);font-size:11px;font-weight:600;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-lane-name:hover,.history-lane-name.active{color:var(--accent)}
.history-rail{height:22px;position:relative;border-radius:6px;background:repeating-linear-gradient(90deg,#f6f8fb 0,#f6f8fb calc(8.333% - 1px),#e3e8ef calc(8.333% - 1px),#e3e8ef 8.333%)}
.history-dot{position:absolute;top:7px;width:8px;height:8px;padding:0;border:2px solid #fff;border-radius:50%;background:#7d9dce;box-shadow:0 0 0 1px #9bb3d6;transform:translateX(-50%);cursor:pointer}
.history-dot.high{top:4px;width:14px;height:14px;background:#e8a300;box-shadow:0 0 0 3px #ffe8a8}
.history-dot.selected{top:3px;width:16px;height:16px;background:#e8a300;outline:2px solid var(--accent);outline-offset:3px;z-index:2}
.history-dot.issue-danger{box-shadow:0 0 0 3px #ffd7d4,0 0 0 5px #d53b32}
.history-dot.issue-warning{box-shadow:0 0 0 3px #ffedc7,0 0 0 5px #d88400}
.history-dot.issue-review{box-shadow:0 0 0 3px #eadcff,0 0 0 5px #7950b6}
.history-dot:focus-visible{outline:2px solid var(--accent);outline-offset:4px}
.history-more-systems{display:block;margin:7px 0 0 104px;border:0;background:transparent;color:var(--accent);font-size:11px;cursor:pointer}
.history-system-details{display:flex;flex-direction:column;min-height:0;max-height:380px}
.history-system-list{min-height:0;overflow-y:auto;padding:4px 10px 9px}
.history-system-month{position:sticky;top:0;z-index:1;padding:8px 4px 5px;background:rgba(255,255,255,.95);color:var(--text-secondary);font-size:10px;font-weight:700}
.history-system-record{padding:8px;border:0.5px solid transparent;border-radius:9px;background:#fafbfd;margin-bottom:6px;transition:border-color .15s ease,background .15s ease}
.history-system-record:hover{border-color:#cbd8ea;background:#fff}.history-system-record.selected{border-color:rgba(0,122,255,.45);background:#f2f7ff}
.history-system-select{display:grid;grid-template-columns:45px minmax(0,1fr) auto;gap:8px;align-items:start;width:100%;padding:0;border:0;background:transparent;text-align:left;cursor:pointer}
.history-system-date{font-family:var(--font-mono);font-size:10.5px;color:var(--accent);padding-top:2px}.history-system-copy{min-width:0}.history-system-copy b{display:block;font-size:11.5px;line-height:1.35}.history-system-copy small{display:block;margin-top:3px;color:var(--text-secondary);font-size:9.5px}
.history-system-record>.history-invoice-links{justify-content:flex-start;margin:6px 0 0 53px}
.history-section-head{min-height:50px;display:flex;align-items:end;gap:10px;padding:13px 2px 10px}
.history-section-head h3{font-size:15px;margin:0 0 2px}
.history-section-head span{font-size:11px;color:var(--text-secondary)}
.history-pager{margin-left:auto;display:flex;align-items:center;gap:5px}
.history-pager button{width:28px;height:28px;border:0.5px solid var(--border);border-radius:7px;background:#fff;color:var(--text);font-size:18px;cursor:pointer}
.history-pager button:disabled{opacity:.35;cursor:default}
.history-detail-grid{display:grid;grid-template-columns:minmax(0,1fr) 292px;gap:14px;align-items:stretch}
.history-service-card{border-color:rgba(0,122,255,.36);box-shadow:0 0 0 1px rgba(0,122,255,.08)}
.history-service-head{min-height:84px;display:grid;grid-template-columns:70px minmax(0,1fr) auto;align-items:center;gap:14px;padding:12px 16px;border-bottom:0.5px solid var(--border)}
.history-date-badge{height:60px;border-radius:10px;background:#19243a;color:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center}
.history-date-badge small{font-size:9px;opacity:.72}.history-date-badge b{font-size:25px;line-height:1.05}
.history-visit-title h3{font-size:16px;margin:0 0 5px}.history-visit-title p{margin:0;color:var(--text-secondary);font-size:11px;line-height:1.5}
.history-complete{padding:5px 9px;border-radius:999px;background:rgba(52,199,89,.12);color:#198653;font-size:10px;font-weight:700;white-space:nowrap}.history-complete.attention{background:#fff0ed;color:#b43b2b}
.history-service-row{display:grid;grid-template-columns:92px minmax(0,1fr) 250px;gap:12px;align-items:center;min-height:68px;padding:10px 16px;border-bottom:0.5px solid var(--border)}
.history-same-day-row{background:#fafbfd}.history-same-day-row .history-system{color:var(--text-secondary)}
.history-system{font-size:11px;font-weight:700;color:#516177}
.history-work{min-width:0}.history-work b{display:block;margin-bottom:3px;font-size:13px;line-height:1.45}.history-work span{display:block;color:var(--text-secondary);font-size:11px;line-height:1.45}
.history-work .history-high-part{color:#8a5d00;font-weight:600}
.history-status-badges{display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap}.history-status-badge{display:inline-flex;padding:3px 6px;border-radius:999px;font-size:9px;font-weight:700;line-height:1.2;white-space:nowrap}.history-status-badge.high{background:#fff0b8;color:#775100}.history-status-badge.danger{background:#ffe1de;color:#ad2b22}.history-status-badge.warning{background:#ffedcc;color:#9a5c00}.history-status-badge.review{background:#eee3ff;color:#68439c}
.history-work .history-status-badges{display:flex;margin-top:6px}.history-work .history-status-badge{display:inline-flex;color:inherit}
.history-invoice-links{display:flex;justify-content:flex-end;gap:6px;flex-wrap:wrap;min-width:0}.history-invoice-links .invoice-chip{padding:4px 7px;border-radius:7px;font-size:10.5px;text-decoration:none;cursor:pointer}.history-invoice-links.compact .invoice-chip{padding:4px 6px}
.history-service-foot{min-height:47px;display:flex;align-items:center;gap:12px;padding:8px 16px;background:#fafbfd;color:var(--text-secondary);font-size:11px}
.history-service-foot>.history-invoice-links{margin-left:auto}.history-service-foot>button{border:0;background:transparent;color:var(--text-secondary);font-size:11px;cursor:pointer;white-space:nowrap}
.history-raw-lines{border-top:0.5px solid var(--border);background:#fbfcfe;padding:6px 16px}
.history-raw-line{display:grid;grid-template-columns:56px 118px minmax(0,1fr) auto auto auto;gap:8px;align-items:center;padding:8px 0;border-bottom:0.5px solid var(--border);font-size:10.5px}.history-raw-line:last-child{border-bottom:0}
.history-source{font-weight:700;color:var(--accent)}.history-source.parts{color:var(--purple)}.history-raw-no,.history-raw-part,.history-raw-price{color:var(--text-secondary);white-space:nowrap}.history-raw-desc{min-width:0}
.history-evidence-card{display:flex;flex-direction:column}
.history-evidence-head{min-height:48px;display:flex;align-items:center;padding:0 14px;border-bottom:0.5px solid var(--border)}
.history-evidence-head b{font-size:14px}.history-evidence-head>span{margin-left:auto;padding:4px 7px;border-radius:999px;background:rgba(52,199,89,.12);color:#198653;font-size:9px;font-weight:700}.history-evidence-head>span.attention{background:#ffe1de;color:#ad2b22}
.history-price-block{padding:15px 16px;background:#fff4cf;box-shadow:inset 4px 0 #d99a00}.history-price-block.review{background:#fff0ed;box-shadow:inset 4px 0 var(--orange)}
.history-price-block label{display:inline-flex;padding:3px 7px;border-radius:999px;background:#ffe49a;color:#7b5300;font-size:10px;font-weight:700}.history-price-block.review label{background:#ffd8cf;color:#a43c25}
.history-price-block h4{margin:10px 0 3px;font-size:14px}.history-price{font-size:25px;font-weight:800;color:#724d00}.history-price-block p{margin:5px 0 0;color:#7d6940;font-size:10px}.history-no-price{padding:18px 16px;color:var(--text-secondary);font-size:11px}
.history-issue-block{padding:12px 15px;border-top:0.5px solid var(--border);background:#fffaf4}.history-issue-block>b{display:block;margin-top:7px;font-size:11.5px}.history-issue-block p{margin:4px 0 0;color:var(--text-secondary);font-size:10px;line-height:1.4}
.history-audit-summary,.history-quick-links{padding:13px 15px;border-top:0.5px solid var(--border)}
.history-audit-summary>b,.history-quick-links>b{display:block;margin-bottom:7px;font-size:12px}.history-audit-summary>div{display:flex;align-items:center;margin-top:5px;color:var(--text-secondary);font-size:10.5px}.history-audit-summary strong{margin-left:auto;color:var(--text)}
.history-quick-links .history-invoice-links{justify-content:flex-start}
.history-audit-entry{margin-top:auto;padding:12px 15px;border:0;border-top:0.5px solid var(--border);background:#fafbfd;color:var(--accent);font-size:11px;font-weight:600;text-align:left;cursor:pointer}
.history-audit-list{margin-top:14px}.history-audit-row{display:grid;grid-template-columns:105px minmax(0,1fr) 110px 112px auto;gap:12px;align-items:center;padding:12px 14px;border-bottom:0.5px solid var(--border)}.history-audit-row:last-child{border-bottom:0}
.history-audit-date{font-family:var(--font-mono);font-size:11px}.history-audit-part b{display:block;font-size:12px}.history-audit-part span,.history-audit-part small{display:block;margin-top:3px;color:var(--text-secondary);font-size:10.5px}.history-audit-part small{font-size:9.5px}.history-audit-money{font-size:14px;font-weight:700;text-align:right}

.history-fleet-view{display:grid;gap:14px}.history-fleet-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.history-fleet-kpis>div{min-height:84px;padding:14px 16px;border:0.5px solid var(--border);border-radius:11px;background:#fff;box-shadow:var(--shadow)}.history-fleet-kpis b{display:block;font-size:24px;line-height:1.05;font-variant-numeric:tabular-nums}.history-fleet-kpis span{display:block;margin-top:7px;color:var(--text-secondary);font-size:10.5px}
.history-fleet-head{min-height:52px}.history-fleet-head>.history-fleet-filters{margin-left:auto}.history-fleet-head>small{margin-left:0}.history-fleet-table-wrap{overflow-x:auto}.history-fleet-table{width:100%;min-width:1080px;border-collapse:collapse;table-layout:fixed}.history-fleet-table th:nth-child(5){width:220px}.history-fleet-table th{padding:9px 12px;background:#f7f8fa;border-bottom:0.5px solid var(--border);color:var(--text-secondary);font-size:10px;text-align:left}.history-fleet-table th:nth-child(1){width:170px}.history-fleet-table th:nth-child(2){width:74px}.history-fleet-table th:nth-child(3){width:105px}.history-fleet-table th:nth-child(4){width:132px;text-align:right}.history-fleet-table th:nth-child(6){width:112px}.history-fleet-table th:nth-child(7){width:150px}.history-fleet-table td{padding:11px 12px;border-bottom:0.5px solid var(--border);vertical-align:middle;font-size:11px}.history-fleet-table tbody tr{cursor:pointer;transition:background .12s ease}.history-fleet-table tbody tr:hover,.history-fleet-table tbody tr:focus{background:#f4f8ff;outline:none}.history-fleet-table tbody tr:focus-visible{box-shadow:inset 0 0 0 2px var(--accent)}
.history-fleet-vehicle{font-size:13px!important;font-weight:800;color:var(--accent)}.history-fleet-partno{font-family:var(--font-mono);color:var(--text-secondary);font-size:10.5px;word-break:break-all}.history-fleet-date{font-family:var(--font-mono);white-space:nowrap}.history-fleet-money{text-align:right}.history-fleet-money b,.history-fleet-part b{display:block;font-size:12px}.history-fleet-money span,.history-fleet-part span,.history-fleet-part small{display:block;margin-top:3px;color:var(--text-secondary);font-size:9.5px}.history-fleet-part{min-width:0}.history-fleet-invoice .invoice-chip{font-size:10px}.history-warranty-button{display:inline-flex;white-space:nowrap;padding:5px 9px;border:1px solid #d8c9ff;border-radius:999px;background:#f5f0ff;color:#7048e8;text-decoration:none;font-size:11px;font-weight:700}.history-warranty-button:hover{background:#ebe1ff}

@media (max-width:1080px){
  .history-overview-grid,.history-detail-grid{grid-template-columns:1fr}
  .history-fleet-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .history-fleet-head{flex-wrap:wrap}.history-fleet-head>.history-fleet-filters{margin-left:auto}
  .history-service-row{grid-template-columns:80px minmax(0,1fr)}
  .history-service-row>.history-invoice-links{grid-column:2;justify-content:flex-start}
  .history-evidence-card{min-height:0}
  .history-audit-row{grid-template-columns:92px minmax(0,1fr) 100px auto}.history-audit-row>.invoice-chip{grid-column:2}
}
@media (max-width:680px){
  .history-page-head{align-items:flex-start}.history-controls{width:100%}.history-tabs,.history-scope-tabs{margin-left:0}
  .history-scope-tabs{order:-1;width:100%}.history-scope-tabs button{flex:1}
  .history-fleet-kpis{gap:7px}.history-fleet-kpis>div{min-height:72px;padding:12px}.history-fleet-kpis b{font-size:20px}
  .history-fleet-head>.history-fleet-filters{order:3;width:100%;margin-left:0}.history-fleet-filters button{flex:1}.history-fleet-head>small{margin-left:auto}
  .history-fleet-table-wrap{overflow:visible}.history-fleet-table,.history-fleet-table tbody,.history-fleet-table tr,.history-fleet-table td{display:block;width:100%;min-width:0}.history-fleet-table thead{display:none}.history-fleet-table tbody{padding:8px}.history-fleet-table tbody tr{margin-bottom:8px;padding:6px 10px;border:0.5px solid var(--border);border-radius:10px;background:#fff}.history-fleet-table td{display:grid;grid-template-columns:78px minmax(0,1fr);gap:8px;padding:7px 0;border-bottom:0.5px solid var(--border)}.history-fleet-table td:last-child{border-bottom:0}.history-fleet-table td::before{content:attr(data-label);color:var(--text-secondary);font-size:9.5px;font-weight:600}.history-fleet-money{text-align:left}.history-fleet-invoice .invoice-chip{width:max-content}
  .history-overview-grid{gap:10px}.history-panel-head>div{display:block}.history-panel-head span{display:block;margin-top:2px}
  .history-months{grid-template-columns:72px repeat(12,minmax(0,1fr))}.history-lane{grid-template-columns:72px minmax(0,1fr)}.history-months button{font-size:9px}.history-more-systems{margin-left:72px}
  .history-system-details{max-height:360px}.history-system-select{grid-template-columns:42px minmax(0,1fr)}.history-system-select>.history-status-badges{grid-column:2}.history-system-record>.history-invoice-links{margin-left:50px}
  .history-section-head{align-items:center;flex-wrap:wrap}.history-section-head>div:first-child{flex:1 1 180px}
  .history-service-head{grid-template-columns:58px minmax(0,1fr);gap:10px;padding:10px}.history-date-badge{height:54px}.history-complete{grid-column:2;width:max-content}
  .history-service-row{grid-template-columns:1fr;padding:10px}.history-service-row>.history-invoice-links{grid-column:1}.history-system{color:var(--accent)}
  .history-service-foot{align-items:flex-start;flex-wrap:wrap;padding:10px}.history-service-foot>.history-invoice-links{margin-left:0;justify-content:flex-start}.history-service-foot>button{margin-left:auto}
  .history-raw-line{grid-template-columns:52px minmax(0,1fr)}.history-raw-desc,.history-raw-part,.history-raw-price,.history-raw-line>.history-status-badges{grid-column:2;white-space:normal}
  .history-audit-row{grid-template-columns:1fr;gap:5px}.history-audit-money{text-align:left}.history-audit-row>.invoice-chip{grid-column:1;width:max-content}
}

/* ── 人工排除（不计入 Warranty）与 Warranty 抽屉 ───────────────────── */
.history-warranty-cell{display:flex;align-items:center;gap:5px;flex-wrap:wrap}
.history-warranty-button.ghost{background:transparent;border-color:var(--border);color:var(--text-secondary);font-weight:600;cursor:pointer}
.history-warranty-button.ghost:hover{background:var(--bg-hover);color:var(--text)}
.history-excluded-reason{max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:10px;color:var(--text-secondary)}

.history-exclude-entry{margin-top:9px;padding:5px 10px;border:1px solid var(--border);border-radius:999px;background:transparent;color:var(--text-secondary);font-size:11px;font-weight:600;cursor:pointer}
.history-exclude-entry:hover{background:var(--bg-hover);color:var(--text)}
.history-excluded-block{margin-top:11px;padding-top:9px;border-top:1px dashed var(--border)}
.history-excluded-block label{display:block;margin-bottom:5px;color:var(--text-secondary);font-size:10px;font-weight:700}
.history-excluded-item{display:flex;align-items:center;gap:6px;padding:3px 0;font-size:11px;opacity:.72}
.history-excluded-item span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:line-through}
.history-excluded-item em{font-style:normal;color:var(--text-secondary);font-size:10px}
.history-excluded-item button{border:none;background:none;color:var(--accent);font-size:10px;cursor:pointer}

.exclusion-mask{position:fixed;inset:0;z-index:80;display:grid;place-items:center;background:rgba(0,0,0,.34)}
.exclusion-dialog{width:min(420px,92vw);padding:19px;border-radius:14px;background:var(--bg-card);box-shadow:0 18px 48px rgba(0,0,0,.22)}
.exclusion-dialog h4{margin:0 0 7px;font-size:15px}
.exclusion-target{margin:0 0 13px;color:var(--text-secondary);font-size:11.5px}
.exclusion-presets{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
.exclusion-presets button{padding:5px 11px;border:1px solid var(--border);border-radius:999px;background:transparent;font-size:11.5px;cursor:pointer}
.exclusion-presets button.active{border-color:var(--accent);background:var(--accent-soft);color:var(--accent);font-weight:700}
.exclusion-dialog textarea{width:100%;min-height:74px;padding:9px;border:1px solid var(--border);border-radius:9px;background:var(--bg-input);font:inherit;font-size:12.5px;resize:vertical}
.exclusion-error{margin-top:7px;color:#d93025;font-size:11.5px}
.exclusion-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}
.exclusion-actions button{padding:7px 15px;border:1px solid var(--border);border-radius:9px;background:transparent;font-size:12.5px;cursor:pointer}
.exclusion-actions button.primary{border-color:var(--accent);background:var(--accent);color:#fff;font-weight:700}
.exclusion-actions button:disabled{opacity:.55;cursor:not-allowed}

.warranty-drawer-mask{position:fixed;inset:0;z-index:70;background:rgba(0,0,0,.3)}
.warranty-drawer{position:absolute;top:0;right:0;display:flex;flex-direction:column;width:min(1080px,94vw);height:100%;background:var(--bg-card);box-shadow:-14px 0 40px rgba(0,0,0,.2)}
.warranty-drawer-head{display:flex;align-items:center;justify-content:space-between;padding:11px 15px;border-bottom:1px solid var(--border)}
.warranty-drawer-head>div{display:flex;align-items:center;gap:13px}
.warranty-drawer-head a{color:var(--accent);text-decoration:none;font-size:11.5px}
.warranty-drawer-head button{border:none;background:none;font-size:21px;line-height:1;color:var(--text-secondary);cursor:pointer}
.warranty-drawer-frame{flex:1;width:100%;border:0}

/* ── 高价件行就地展开 ────────────────────────────────────────────── */
.history-fleet-table tr.expanded{background:var(--bg-active)}
.history-fleet-detail-row>td{padding:0!important;background:var(--bg-hover)}
.history-row-detail{padding:13px 15px;border-top:1px solid var(--border)}
.history-row-detail.empty{color:var(--text-secondary);font-size:11.5px}
.history-row-detail-head{display:flex;align-items:baseline;gap:10px;margin-bottom:9px}
.history-row-detail-head b{font-size:12.5px}
.history-row-detail-head span{color:var(--text-secondary);font-size:10.5px}
.history-row-detail-table{width:100%;border-collapse:collapse;font-size:11px}
.history-row-detail-table th{padding:5px 7px;border-bottom:1px solid var(--border);color:var(--text-secondary);font-size:10px;font-weight:600;text-align:left}
.history-row-detail-table td{padding:5px 7px;border-bottom:1px solid var(--border)}
.history-row-detail-table td:nth-child(n+5){text-align:right;font-variant-numeric:tabular-nums}
.history-row-detail-table tr.current{background:var(--accent-soft);font-weight:700}
.history-row-detail-repair{margin-top:11px;padding-top:9px;border-top:1px dashed var(--border);font-size:11px}
.history-row-detail-repair b{font-size:11.5px}
.history-row-detail-repair span{margin-left:8px;color:var(--text-secondary);font-size:10.5px}
.history-row-detail-repair ul{margin:6px 0 0;padding-left:17px;color:var(--text-secondary)}
.history-row-detail-repair.none{color:var(--text-secondary)}
.history-evidence-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:10px}
.history-evidence-actions .history-exclude-entry{margin-top:0}
.history-row-detail-why{margin-bottom:11px;padding:9px 11px;border-left:3px solid var(--accent);border-radius:0 8px 8px 0;background:var(--accent-soft)}
.history-row-detail-why b{display:block;font-size:11px}
.history-row-detail-why p{margin:4px 0 0;font-size:11.5px}
.history-row-detail-why small{display:block;margin-top:4px;color:var(--text-secondary);font-size:10px}
.history-fleet-kpis>div small{display:block;margin-top:3px;color:var(--text-secondary);font-size:9.5px;line-height:1.35}

/* 高价件表：已建单 / 已排除的行都是「处理过了」，视觉让位给还没决策的行 */
.history-fleet-table tbody tr.declared{background:rgba(52,199,89,.07);box-shadow:inset 3px 0 0 #34c759}
.history-fleet-table tbody tr.declared:hover{background:rgba(52,199,89,.12)}
.history-fleet-table tbody tr.excluded{opacity:.6;box-shadow:inset 3px 0 0 var(--border)}
.history-fleet-table tbody tr.excluded .history-fleet-part b{text-decoration:line-through}
.history-classify{margin-top:9px;padding-top:9px;border-top:1px dashed var(--border)}
.history-classify>label{display:block;margin-bottom:5px;font-size:10.5px;font-weight:700}
.history-classify-row{display:flex;gap:7px;align-items:center}
.history-classify-row select{flex:1;max-width:220px;padding:5px 8px;border:1px solid var(--border);border-radius:7px;background:var(--bg-input);font-size:11.5px}
.history-classify-row button{padding:5px 12px;border:1px solid var(--accent);border-radius:7px;background:var(--accent);color:#fff;font-size:11.5px;font-weight:600;cursor:pointer}
.history-classify-row button:disabled{opacity:.5;cursor:not-allowed}
.history-classify>small{display:block;margin-top:5px;color:var(--text-secondary);font-size:10px;line-height:1.4}
.history-classify-msg{margin-top:6px;font-size:11px;font-weight:600;color:var(--accent)}
.vehicle-archive-entry{margin-left:6px;padding:5px 12px;border:1px solid var(--border);border-radius:999px;background:transparent;color:var(--accent);font-size:11.5px;font-weight:650;cursor:pointer;white-space:nowrap}
.vehicle-archive-entry:hover{background:var(--accent-soft)}
.vehicle-archive-entry.active{border-color:var(--accent);background:var(--accent-soft)}
.history-excluded-item em{opacity:.8}
/* 每列数据的对齐方式统一跟表头一致：状态/车号/日期/零件情况/零件号/发票号/Warranty
   靠左，金额靠右——之前金额表头靠左、数据靠右，头体对不上。 */
.history-fleet-table td{text-align:left}
.history-fleet-table td.history-fleet-money{text-align:right}
.mileage-tier-badge{margin-left:5px;font-size:12px;line-height:1;cursor:help}
.mileage-tier-badge.suspect{opacity:.55}
/* 车辆基本信息小窗：悬停/聚焦展开，纯 CSS 控制显示。 */
.vehicle-info-badge{position:relative;margin-left:5px;font-size:12px;cursor:help;outline:none}
.vehicle-info-popover{display:none;position:absolute;top:calc(100% + 6px);left:0;z-index:20;
  min-width:180px;padding:9px 11px;border:1px solid var(--border);border-radius:10px;
  background:var(--bg-card);box-shadow:0 8px 24px rgba(0,0,0,.14);}
.vehicle-info-badge:hover .vehicle-info-popover,
.vehicle-info-badge:focus .vehicle-info-popover{display:block}
.vehicle-info-row{display:flex;justify-content:space-between;gap:14px;padding:2px 0;font-size:11.5px;white-space:nowrap}
.vehicle-info-row span{color:var(--text-secondary)}
.vehicle-info-row b{font-weight:600}

/* ===== 支出面板统一骨架（单车版 / 车队版共用）===== */
/* 月份是主控轴：点柱子后下方三层全部联动。 */
.spend-bars{display:flex;gap:5px;align-items:flex-end;height:132px;padding:6px 2px 0}
.spend-bar{flex:1;height:100%;display:flex;flex-direction:column;justify-content:flex-end;
  align-items:center;cursor:pointer;transition:opacity .18s}
.spend-bar.dim{opacity:.3}
.spend-bar-val{font-size:9.5px;color:var(--text-tertiary);margin-bottom:2px;
  font-variant-numeric:tabular-nums;white-space:nowrap}
.spend-bar-stack{width:100%;display:flex;flex-direction:column-reverse;overflow:hidden;
  border-radius:3px 3px 0 0;background:var(--bg-subtle,#f2f2f7);transition:height .3s cubic-bezier(.4,0,.2,1)}
.spend-bar-mo{font-size:10px;color:var(--text-tertiary);margin-top:4px}
.spend-bar-mo.on{color:var(--accent);font-weight:700}
.spend-legend{display:flex;gap:14px;margin-top:10px;padding-top:8px;
  border-top:0.5px solid var(--border);font-size:11px;color:var(--text-secondary)}
.spend-legend i{display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:5px}

.spend-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:10px;margin-bottom:12px}
.spend-card{padding:10px 13px}
.spend-card.lead{border-left-width:3px;border-left-style:solid;border-radius:0 10px 10px 0}
.spend-card .k{font-size:11px;color:var(--text-secondary)}
.spend-card .v{font-size:18px;font-weight:700;margin-top:3px;font-variant-numeric:tabular-nums}
.spend-card .p{font-size:10.5px;color:var(--text-tertiary);margin-top:1px}

.spend-sys,.spend-rank{display:flex;align-items:center;gap:7px;font-size:11.5px;
  padding:5px 2px;cursor:pointer;border-radius:6px}
.spend-sys:hover,.spend-rank:hover{background:var(--accent-soft,rgba(0,122,255,.06))}
.spend-sys.on{background:var(--accent-soft,rgba(0,122,255,.1));font-weight:600}
.spend-sys .nm{width:74px;flex:0 0 auto;color:var(--text-secondary);overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap}
.spend-sys .bar{height:9px;border-radius:2px;flex:0 0 auto;min-width:2px}
.spend-sys .am,.spend-rank .am{margin-left:auto;font-variant-numeric:tabular-nums;font-weight:600}
.spend-rank .idx{width:20px;font-size:10px;color:var(--text-tertiary);font-weight:600}
.spend-rank b{width:52px}
.spend-rank .mini{flex:1;display:flex;height:8px;border-radius:2px;overflow:hidden;
  background:var(--bg-subtle,#f2f2f7);max-width:120px}

/* 明细行的复合标签：配色管保养/维修，灰字管工时/零件（两维度共用绿橙会撞色）*/
.spend-tag{display:inline-flex;align-items:center;gap:3px;font-size:10px;
  padding:2px 7px;border-radius:8px;white-space:nowrap}
.spend-tag b{font-weight:700}
.spend-tag .sep{opacity:.4}
.spend-tag .lp{color:var(--text-secondary);font-weight:600}
.spend-dt,.spend-inv{color:var(--text-secondary);font-variant-numeric:tabular-nums;font-size:11.5px}
.spend-sysname{font-size:11.5px;color:var(--text-secondary)}
.spend-amt{font-weight:600;font-variant-numeric:tabular-nums}
.spend-empty{padding:20px;text-align:center;font-size:12px;color:var(--text-secondary)}
