/* CarRecord upgrade components (progress, charts empty, timeline, docs) */
.maint-progress { margin-top: 8px; }
.maint-progress-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 0.78rem; }
.maint-progress-label { color: #6b7280; }
html.dark-mode .maint-progress-label { color: #9ca3af; }
.maint-progress-pct { font-weight: 700; color: var(--lexus-black, #1a1a1a); }
html.dark-mode .maint-progress-pct { color: #f3f4f6; }
.maint-progress-track { height: 8px; border-radius: 999px; background: rgba(0,0,0,0.08); overflow: hidden; width: 100%; }
html.dark-mode .maint-progress-track { background: rgba(255,255,255,0.12); }
.maint-progress-fill { height: 100%; border-radius: 999px; transition: width 0.45s ease; }
#maint-templates-subpage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px 16px;
}
.maint-schedule-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 14px 16px;
  margin: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
html.dark-mode .maint-schedule-row {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
  box-shadow: none;
}
.maint-schedule-row[data-urgency="warn"] { box-shadow: inset 3px 0 0 #f97316; }
.maint-schedule-row[data-urgency="overdue"] { box-shadow: inset 3px 0 0 #ef4444; }
.maint-schedule-row-head {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}
.maint-schedule-row-title { flex: 1 1 auto; min-width: 0; }
.maint-schedule-row-title strong { display: block; line-height: 1.35; }
.maint-schedule-row-head .record-row-actions {
  margin-left: auto !important;
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.maint-schedule-row > .maint-progress {
  display: block;
  width: 100%;
  margin-top: 12px;
  margin-bottom: 0;
}
.maint-schedule-row > .maint-progress .maint-progress-track {
  width: 100%;
  display: block;
}
.maint-schedule-sub { font-size: 0.75rem; color: #6b7280; margin-top: 4px; }
html.dark-mode .maint-schedule-sub { color: #9ca3af; }
.fab-vehicle-picker-list { display: flex; flex-direction: column; gap: 8px; }
.fab-vehicle-pick-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid rgba(0,0,0,0.08); border-radius: 14px; padding: 12px 14px;
  background: #f8f9fa; font-weight: 700; cursor: pointer;
}
.fab-vehicle-pick-btn .badge-type {
  font-size: 0.7rem; color: #fff; border-radius: 999px; padding: 2px 8px; flex-shrink: 0;
}
html.dark-mode .fab-vehicle-pick-btn {
  background: rgba(255,255,255,0.06); color: #f3f4f6; border-color: rgba(255,255,255,0.1);
}
.info-schedule-preview-row .maint-progress { width: 100%; margin-top: 6px; margin-bottom: 0; }
.info-schedule-preview-row .maint-progress-track { height: 6px; }
.fab-speed-dial {
  display: none; flex-direction: column; align-items: flex-end; gap: 10px;
  margin-bottom: 12px; pointer-events: none; opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.fab-container.dial-open .fab-speed-dial {
  display: flex; pointer-events: auto; opacity: 1; transform: translateY(0);
}
.fab-container.dial-open .fab-btn #fab-icon { transform: rotate(45deg); }
.fab-btn #fab-icon { display: inline-block; transition: transform 0.2s ease; }
.fab-dial-btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  padding: 10px 14px; border-radius: 999px; font-weight: 700; font-size: 0.85rem;
  background: var(--lexus-black, #1a1a1a); color: var(--lexus-gold, #CFB378);
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}
html.dark-mode .fab-dial-btn { background: #CFB378; color: #1a1a1a; }
.expense-category-picker-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.expense-category-pick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 88px; border: 1px solid rgba(0,0,0,0.08); border-radius: 16px;
  background: #f8f9fa; color: #1a1a1a; font-weight: 700; cursor: pointer;
}
.expense-category-pick-btn i { font-size: 1.35rem; color: var(--lexus-gold, #b8954a); }
html.dark-mode .expense-category-pick-btn {
  background: rgba(255,255,255,0.06); color: #f3f4f6; border-color: rgba(255,255,255,0.1);
}
.more-datahealth-panel { margin-top: 8px; }
.datahealth-score-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.datahealth-score-ring {
  --dh-color: #22c55e;
  position: relative;
  flex: 0 0 100px;
  width: 100px;
  height: 100px;
  min-width: 100px;
  min-height: 100px;
  max-width: 100px;
  max-height: 100px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--dh-color) 18%, transparent), transparent 68%),
    var(--card-bg, #fff);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--dh-color) 28%, transparent),
    0 10px 28px color-mix(in srgb, var(--dh-color) 22%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  overflow: visible;
}
.datahealth-score-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
  pointer-events: none;
}
.datahealth-score-track {
  fill: none;
  stroke: rgba(120, 130, 145, 0.16);
  stroke-width: 7.5;
}
.datahealth-score-progress {
  fill: none;
  stroke: var(--dh-color, #22c55e);
  stroke-width: 7.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s ease;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--dh-color) 55%, transparent));
}
.datahealth-score-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
  padding: 0 6px;
  max-width: 72px;
}
.datahealth-score-num {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary, #1a1a1a);
  line-height: 1;
}
.datahealth-score-unit {
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 1px;
  color: color-mix(in srgb, var(--dh-color) 75%, #666);
  vertical-align: super;
}
.datahealth-score-label {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--dh-color, #22c55e);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.datahealth-score-hint {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted, #6b7280);
}
.datahealth-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.datahealth-metric {
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(160, 175, 195, 0.12);
}
html.dark-mode .datahealth-metric { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.08); }
.datahealth-metric strong { display: block; font-size: 1.1rem; }
.datahealth-metric span { font-size: 0.72rem; color: #9ca3af; }
.datahealth-issue-list { list-style: none; padding: 0; margin: 0; }
.datahealth-issue-list li {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06); font-size: 0.85rem;
}
html.dark-mode .datahealth-issue-list li { border-color: rgba(255, 255, 255, 0.08); }
.datahealth-issue-list i { color: #f59e0b; margin-top: 2px; }
html.dark-mode .datahealth-score-ring {
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--dh-color) 22%, transparent), transparent 70%),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--dh-color) 35%, transparent),
    0 10px 28px color-mix(in srgb, var(--dh-color) 18%, transparent);
}
html.dark-mode .datahealth-score-track { stroke: rgba(255, 255, 255, 0.1); }
html.dark-mode .datahealth-score-num { color: var(--text-primary, #f3f4f6); }
html.dark-mode .datahealth-score-hint { color: var(--text-muted, #9ca3af); }
@media (max-width: 400px) {
  .datahealth-score-wrap {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }
  .datahealth-score-hint { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .datahealth-score-progress { transition: none; }
}
html.dark-mode .maint-schedule-sub { color: #9ca3af; }
.fab-vehicle-picker-list { display: flex; flex-direction: column; gap: 8px; }
.fab-vehicle-pick-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid rgba(0,0,0,0.08); border-radius: 14px; padding: 12px 14px;
  background: #f8f9fa; font-weight: 700; cursor: pointer;
}
.fab-vehicle-pick-btn .badge-type {
  font-size: 0.7rem; color: #fff; border-radius: 999px; padding: 2px 8px; flex-shrink: 0;
}
html.dark-mode .fab-vehicle-pick-btn {
  background: rgba(255,255,255,0.06); color: #f3f4f6; border-color: rgba(255,255,255,0.1);
}
.info-schedule-preview-row .maint-progress { width: 100%; margin-top: 6px; margin-bottom: 0; }
.info-schedule-preview-row .maint-progress-track { height: 6px; }
.fab-speed-dial {
  display: none; flex-direction: column; align-items: flex-end; gap: 10px;
  margin-bottom: 12px; pointer-events: none; opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.fab-container.dial-open .fab-speed-dial {
  display: flex; pointer-events: auto; opacity: 1; transform: translateY(0);
}
.fab-container.dial-open .fab-btn #fab-icon { transform: rotate(45deg); }
.fab-btn #fab-icon { display: inline-block; transition: transform 0.2s ease; }
.fab-dial-btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer;
  padding: 10px 14px; border-radius: 999px; font-weight: 700; font-size: 0.85rem;
  background: var(--lexus-black, #1a1a1a); color: var(--lexus-gold, #CFB378);
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}
html.dark-mode .fab-dial-btn { background: #CFB378; color: #1a1a1a; }
.expense-category-picker-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.expense-category-pick-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 88px; border: 1px solid rgba(0,0,0,0.08); border-radius: 16px;
  background: #f8f9fa; color: #1a1a1a; font-weight: 700; cursor: pointer;
}
.expense-category-pick-btn i { font-size: 1.35rem; color: var(--lexus-gold, #b8954a); }
html.dark-mode .expense-category-pick-btn {
  background: rgba(255,255,255,0.06); color: #f3f4f6; border-color: rgba(255,255,255,0.1);
}
.more-datahealth-panel { margin-top: 8px; }
.datahealth-score-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.datahealth-score-ring {
  width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--dh-color, #22c55e) calc(var(--dh-pct, 0) * 1%), rgba(0,0,0,0.08) 0);
  position: relative;
}
.datahealth-score-ring::after {
  content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--card-bg, #fff);
}
html.dark-mode .datahealth-score-ring::after { background: #1a1a1a; }
.datahealth-score-num { position: relative; z-index: 1; font-size: 1.35rem; font-weight: 800; line-height: 1; text-align: center; }
.datahealth-score-label { position: relative; z-index: 1; font-size: 0.7rem; color: #9ca3af; text-align: center; }
.datahealth-metric-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px;
}
.datahealth-metric {
  border-radius: 14px; padding: 10px 8px; text-align: center; background: rgba(0,0,0,0.03);
}
html.dark-mode .datahealth-metric { background: rgba(255,255,255,0.05); }
.datahealth-metric strong { display: block; font-size: 1.1rem; }
.datahealth-metric span { font-size: 0.72rem; color: #9ca3af; }
.datahealth-issue-list { list-style: none; padding: 0; margin: 0; }
.datahealth-issue-list li {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 0;
  border-top: 1px solid rgba(0,0,0,0.06); font-size: 0.85rem;
}
html.dark-mode .datahealth-issue-list li { border-color: rgba(255,255,255,0.08); }
.datahealth-issue-list i { color: #f59e0b; margin-top: 2px; }
html.dark-mode .maint-schedule-sub { color: #9ca3af; }
.maint-donut-wrap { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 20px; background: rgba(207,179,120,0.12); margin-bottom: 12px; }
html.dark-mode .maint-donut-wrap { background: rgba(207,179,120,0.08); }
.maint-donut-legend { flex: 1; font-size: 0.8rem; }
.maint-donut-legend-item { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.home-maint-health-widget { margin: 12px 0 16px; }
.home-energy-stat-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
.home-energy-stat-tile {
  border-radius: 14px; padding: 12px 10px; background: rgba(0,0,0,0.03);
}
html.dark-mode .home-energy-stat-tile { background: rgba(255,255,255,0.05); }
.home-energy-stat-label { display: block; font-size: 0.72rem; color: #9ca3af; margin-bottom: 4px; }
.home-energy-stat-tile strong { font-size: 0.95rem; }
.home-quick-add { display: flex; gap: 8px; margin: 8px 0 16px; flex-wrap: wrap; }
.home-quick-add button {
  flex: 1; min-width: 90px; border: none; border-radius: 16px; padding: 12px 10px;
  background: var(--lexus-black, #1a1a1a); color: var(--lexus-gold, #CFB378); font-weight: 700; font-size: 0.85rem;
}
html.dark-mode .home-quick-add button { background: #CFB378; color: #1a1a1a; }
.info-bento-group-title {
  grid-column: 1 / -1; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: #9ca3af; margin: 8px 0 2px; padding-left: 4px;
}
html.dark-mode .info-bento-group-title { color: #6b7280; }
.chart-empty-state {
  display: flex; align-items: center; justify-content: center; min-height: 140px;
  color: #9ca3af; font-size: 0.9rem; border-radius: 16px; background: rgba(0,0,0,0.03);
}
html.dark-mode .chart-empty-state { background: rgba(255,255,255,0.04); color: #6b7280; }
.analytics-chart-card { margin-bottom: 14px; }
/* 分析頁圖表：無資料時不要保留 chart-container 的 300px 高度 */
.more-analytics-charts .analytics-chart-card.chart-container {
  margin-bottom: 10px;
}
.more-analytics-charts .analytics-chart-card.chart-container.is-chart-empty,
.more-analytics-layout > .analytics-chart-card.chart-container.is-chart-empty {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: hidden;
}
.more-analytics-charts .chart-empty-state {
  display: none !important;
}

/* 總持有成本：深色 accent 內的圖表改放淺色卡，避免亮色模式深字看不見 */
#more-tco-section .more-analytics-charts .analytics-chart-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 12px 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
#more-tco-section .more-analytics-charts .analytics-chart-card.chart-container {
  /* keep chart-container height, just surface */
}
html.dark-mode #more-tco-section .more-analytics-charts .analytics-chart-card {
  background: rgba(18, 18, 20, 0.95);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}
#more-tco-section .more-analytics-charts .chart-empty-state {
  background: rgba(0, 0, 0, 0.04);
  color: #4b5563;
}
html.dark-mode #more-tco-section .more-analytics-charts .chart-empty-state {
  background: rgba(255, 255, 255, 0.04);
  color: #9ca3af;
}

/* TCO insight cards: annual mileage + residual value */
.tco-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.tco-insight-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  min-width: 0;
}
.tco-insight-card--residual {
  background: linear-gradient(160deg, rgba(207, 179, 120, 0.22), rgba(255, 255, 255, 0.08));
  border-color: rgba(207, 179, 120, 0.35);
}
.tco-insight-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #f5d78e;
  font-size: 0.95rem;
}
.tco-insight-body {
  min-width: 0;
  flex: 1;
}
.tco-insight-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.68);
  margin-bottom: 4px;
}
.tco-insight-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tco-insight-unit {
  margin-left: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0;
}
.tco-insight-sub {
  margin-top: 4px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.35;
}
.tco-insight-sub strong {
  font-weight: 800;
  color: #fff;
}
.tco-insight-hint {
  margin-top: 6px;
  font-size: 0.68rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}
.tco-insight-carbon {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.22);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  line-height: 1.4;
}
.tco-insight-carbon i {
  color: #86efac;
  margin-top: 2px;
}
.tco-insight-carbon strong {
  color: #fff;
  font-weight: 800;
}
@media (max-width: 420px) {
  .tco-insight-grid {
    grid-template-columns: 1fr;
  }
}

.reminder-timeline { position: relative; padding-left: 18px; margin-top: 12px; }
.reminder-timeline::before {
  content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: rgba(207,179,120,0.45);
}
.reminder-timeline-item { position: relative; padding: 8px 0 12px 8px; }
.reminder-timeline-item::before {
  content: ''; position: absolute; left: -16px; top: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--lexus-gold, #CFB378); border: 2px solid #fff;
}
html.dark-mode .reminder-timeline-item::before { border-color: #1a1a1a; }
.backup-health-banner {
  display: none; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: rgba(245,158,11,0.15); color: #92400e; font-size: 0.85rem; margin-bottom: 12px;
}
html.dark-mode .backup-health-banner { color: #fcd34d; background: rgba(245,158,11,0.12); }
.fuel-anomaly-badge { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 8px; background: #fef2f2; color: #b91c1c; font-size: 0.7rem; font-weight: 700; }
html.dark-mode .fuel-anomaly-badge { background: rgba(239,68,68,0.2); color: #fca5a5; }
.docs-intro { background: rgba(207,179,120,0.12); border-radius: 16px; }
.docs-intro-icon {
  width: 36px; height: 36px; border-radius: 12px; display:flex; align-items:center; justify-content:center;
  background: rgba(207,179,120,0.25); color: #8a6d2f; flex-shrink: 0;
}
html.dark-mode .docs-intro { background: rgba(207,179,120,0.1); }
html.dark-mode .docs-intro-icon { color: #e7d3a0; }
.docs-list-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
  padding: 14px; border-radius: 16px; background: rgba(0,0,0,0.03); margin-bottom: 10px;
}
html.dark-mode .docs-list-item { background: rgba(255,255,255,0.04); }
.docs-list-item-main { min-width: 0; flex: 1; }
.docs-cat-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: rgba(207,179,120,0.22); color: #6b5420; margin-bottom: 4px;
}
html.dark-mode .docs-cat-badge { color: #f0e1b8; background: rgba(207,179,120,0.18); }
.docs-list-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-photo-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-photo-preview img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(0,0,0,0.08);
}

.cr-editable-photos {
  margin-bottom: 0.75rem;
}
.cr-editable-photos-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(60, 60, 60, 0.85);
  margin-bottom: 0.45rem;
}
html.dark-mode .cr-editable-photos-title { color: rgba(250, 250, 250, 0.82); }
.cr-editable-photos-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cr-editable-photo-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.55);
}
html.dark-mode .cr-editable-photo-card {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
}
.cr-editable-photo-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,0.06);
}
.cr-editable-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cr-editable-photo-thumb img.cr-editable-photo-pending,
.cr-editable-photo-thumb img.cr-editable-photo-missing {
  opacity: 0.45;
}
.cr-editable-photo-meta {
  font-size: 0.78rem;
  color: rgba(80,80,80,0.9);
}
html.dark-mode .cr-editable-photo-meta { color: rgba(230,230,230,0.85); }
.cr-editable-photo-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Photo viewer zoom */
.cr-photo-viewer-dialog {
  max-width: min(960px, 96vw);
  margin: 0.5rem auto;
}
.cr-photo-viewer-content {
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
#imageViewerModal .modal-header {
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#imageViewerModal .modal-title {
  flex: 1 1 auto;
  min-width: 0;
}
.cr-photo-zoom-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 0.35rem;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
}
.cr-photo-zoom-toolbar-inline {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0.55rem 0 0;
  margin-right: 0;
}
html.dark-mode .cr-photo-zoom-toolbar {
  background: rgba(255, 255, 255, 0.08);
}
.cr-photo-zoom-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cr-photo-zoom-btn:hover,
.cr-photo-zoom-btn:focus-visible {
  background: rgba(207, 179, 120, 0.28);
  outline: none;
}
.cr-photo-zoom-label {
  min-width: 3.2rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.85;
}
#imageViewerBody {
  overflow: auto;
  max-height: calc(92vh - 4.5rem);
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}
.cr-photo-zoom-stage {
  margin-bottom: 0.85rem;
}
.cr-photo-zoom-viewport {
  position: relative;
  width: 100%;
  max-height: min(70vh, 640px);
  min-height: 180px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.04);
  /* Default: allow vertical scroll of modal; JS sets none when zoomed */
  touch-action: pan-y;
  cursor: default;
  user-select: none;
}
.cr-photo-zoom-viewport.is-zoomed {
  touch-action: none;
  cursor: grab;
}
html.dark-mode .cr-photo-zoom-viewport {
  background: rgba(255, 255, 255, 0.04);
}
.cr-photo-zoom-viewport.is-zoomed:active {
  cursor: grabbing;
}
.cr-photo-zoom-canvas {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
}
.cr-photo-zoom-img {
  max-width: 100%;
  max-height: min(70vh, 640px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  pointer-events: none;
  -webkit-user-drag: none;
}
.cr-photo-zoom-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.45rem;
}
.cr-photo-open-original,
.cr-photo-download-one {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: inherit;
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.cr-photo-download-one {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}
.cr-photo-open-original:hover,
.cr-photo-open-original:focus-visible,
.cr-photo-download-one:hover,
.cr-photo-download-one:focus-visible {
  background: rgba(207, 179, 120, 0.22);
  border-color: rgba(207, 179, 120, 0.55);
  outline: none;
}
.cr-photo-download-one:hover,
.cr-photo-download-one:focus-visible {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.45);
}
.cr-photo-open-original:disabled,
.cr-photo-download-one:disabled {
  opacity: 0.55;
  cursor: wait;
}
html.dark-mode .cr-photo-open-original,
html.dark-mode .cr-photo-download-one {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: inherit;
}
html.dark-mode .cr-photo-download-one {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
}
.cr-photo-zoom-btn.cr-photo-open-btn {
  color: #b45309;
}
.cr-photo-zoom-btn.cr-photo-download-btn {
  color: #1d4ed8;
}
html.dark-mode .cr-photo-zoom-btn.cr-photo-open-btn {
  color: #fbbf24;
}
html.dark-mode .cr-photo-zoom-btn.cr-photo-download-btn {
  color: #93c5fd;
}
.cr-photo-download-all-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 0;
  flex-wrap: wrap;
}
.cr-photo-download-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.cr-photo-download-all-btn:hover,
.cr-photo-download-all-btn:focus-visible {
  background: rgba(37, 99, 235, 0.18);
  outline: none;
}
.cr-photo-download-all-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.cr-photo-download-all-hint {
  font-size: 0.72rem;
  color: rgba(100, 100, 100, 0.9);
}
html.dark-mode .cr-photo-download-all-btn {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}
html.dark-mode .cr-photo-download-all-hint {
  color: rgba(220, 220, 220, 0.7);
}
.cr-photo-zoom-hint {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: rgba(100, 100, 100, 0.85);
  text-align: center;
}
html.dark-mode .cr-photo-zoom-hint {
  color: rgba(220, 220, 220, 0.7);
}
@media (max-width: 576px) {
  .cr-photo-viewer-dialog {
    max-width: 100vw;
    margin: 0;
  }
  .cr-photo-viewer-content {
    min-height: 100vh;
    border-radius: 0;
  }
  .cr-photo-zoom-viewport,
  .cr-photo-zoom-img {
    max-height: 72vh;
  }
}

/* Desktop: wrapper is transparent so table layout stays unchanged */
.records-table-card .table-custom td > .records-cell-value {
  display: contents;
}

/* Mobile: stack each row as a readable card (avoids 1-char-wide vertical text) */
@media (max-width: 768px) {
  .records-table-card .table-responsive {
    overflow: visible;
    -webkit-overflow-scrolling: auto;
  }

  .records-table-card .table-custom {
    width: 100%;
    min-width: 0 !important;
    margin-bottom: 0;
  }

  .records-table-card .table-custom thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .records-table-card .table-custom tbody {
    display: block;
    padding: 10px 12px 14px;
  }

  .records-table-card .table-custom tbody tr {
    display: block;
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .records-table-card .table-custom tbody tr:last-child {
    margin-bottom: 0;
  }

  .records-table-card .table-custom.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: transparent;
    background-color: transparent;
  }

  .records-table-card .table-custom tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: transparent !important;
    vertical-align: top;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
  }

  .records-table-card .table-custom tbody td:first-child {
    padding-top: 0;
  }

  .records-table-card .table-custom tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .records-table-card .table-custom tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 38%;
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #6b7280;
    letter-spacing: 0.01em;
  }

  .records-table-card .table-custom td > .records-cell-value {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    color: inherit;
  }

  .records-table-card .table-custom tbody td[data-label="日期"] {
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .records-table-card .table-custom tbody td[data-label="日期"]::before {
    display: none;
  }

  .records-table-card .table-custom tbody td[data-label="日期"] > .records-cell-value {
    width: 100%;
    text-align: left;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.01em;
  }

  .records-table-card .table-custom tbody td[data-label="操作"],
  .records-table-card .table-custom tbody td:has(.record-row-actions) {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    border-bottom: none;
  }

  .records-table-card .table-custom tbody td[data-label="操作"]::before,
  .records-table-card .table-custom tbody td:has(.record-row-actions)::before {
    display: none;
  }

  .records-table-card .table-custom tbody td[data-label="操作"] > .records-cell-value,
  .records-table-card .table-custom tbody td:has(.record-row-actions) > .records-cell-value {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .records-table-card .table-custom tbody td.records-cell-empty,
  .records-table-card .table-custom tbody td[colspan] {
    display: block;
    text-align: center;
    padding: 1.35rem 0.5rem;
    border: none;
  }

  .records-table-card .table-custom tbody td.records-cell-empty::before,
  .records-table-card .table-custom tbody td[colspan]::before {
    content: none;
    display: none;
  }

  .records-table-card .table-custom tbody tr:has(td.records-cell-empty),
  .records-table-card .table-custom tbody tr:has(td[colspan]) {
    box-shadow: none;
    background: transparent;
    border-style: dashed;
  }

  html.dark-mode .records-table-card .table-custom tbody tr {
    background: var(--card-bg, #1f1f1f);
    border-color: var(--surface-border, rgba(255, 255, 255, 0.12));
    box-shadow: none;
  }

  html.dark-mode .records-table-card .table-custom tbody td {
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  html.dark-mode .records-table-card .table-custom tbody td::before {
    color: rgba(220, 220, 220, 0.72);
  }

  html.dark-mode .records-table-card .table-custom tbody td[data-label="日期"],
  html.dark-mode .records-table-card .table-custom tbody td[data-label="操作"],
  html.dark-mode .records-table-card .table-custom tbody td:has(.record-row-actions) {
    border-color: rgba(255, 255, 255, 0.12);
  }
}
