/* 停车拍照 — Soft UI 柔和界面风（夜库友好深色变体） */
:root {
  --bg: #eef2f6;
  --bg-deep: #e4eaf1;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --surface-muted: #eef2f7;
  --ink: #2a3441;
  --ink-soft: #5a6678;
  --ink-faint: #8b96a8;
  --accent: #5eb8a8;
  --accent-deep: #3d9a8c;
  --accent-soft: #d8f0eb;
  --accent-ink: #1a3d38;
  --amber: #c49a4a;
  --amber-soft: #f7efd9;
  --red: #d97a72;
  --red-soft: #fdecea;
  --red-ink: #7a2e2a;
  --green: #5aaa78;
  --green-soft: #e3f5ea;
  --shadow-sm: 0 4px 14px rgba(42, 52, 65, 0.06);
  --shadow-md: 0 10px 28px rgba(42, 52, 65, 0.08);
  --shadow-lg: 0 18px 40px rgba(42, 52, 65, 0.1);
  --shadow-accent: 0 12px 28px rgba(61, 154, 140, 0.22);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 200ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

body.is-guest .dashboard { display: none !important; }
body.is-auth .login-panel { display: none !important; }

.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(94, 184, 168, 0.16), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(196, 154, 74, 0.08), transparent 55%),
    linear-gradient(180deg, #f5f8fb 0%, var(--bg) 40%, var(--bg-deep) 100%);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
}

.section-kicker,
.section-label {
  margin: 0;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* —— Topbar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: calc(var(--space-md) + var(--safe-t)) var(--space-lg) var(--space-md);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-ink);
  background: linear-gradient(160deg, #8fd4c6 0%, var(--accent) 100%);
  box-shadow: var(--shadow-sm), 0 6px 16px rgba(61, 154, 140, 0.2);
  flex-shrink: 0;
}
.brand-text strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-text small {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 400;
}

.connection {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--display);
}
.connection::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 3px rgba(139, 150, 168, 0.18);
}
.connection.is-ok {
  color: var(--green);
  background: var(--green-soft);
}
.connection.is-ok::before {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(90, 170, 120, 0.2);
}
.connection.is-error {
  color: var(--red-ink);
  background: var(--red-soft);
}
.connection.is-error::before {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(217, 122, 114, 0.2);
}

.workspace {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
}

/* —— Login card —— */
.login-panel {
  margin: clamp(28px, 9vh, 72px) auto 0;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  box-shadow: var(--shadow-lg);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.login-panel h1 {
  margin: var(--space-sm) 0 var(--space-sm);
  font-size: clamp(1.45rem, 4vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--ink);
}
.login-hint {
  margin: 0 0 var(--space-xl);
  font-size: 0.92rem;
  color: var(--ink-soft);
  max-width: 34ch;
  line-height: 1.6;
}
.login-form {
  display: grid;
  gap: var(--space-lg);
}
.login-form label {
  display: grid;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.login-form label span {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.login-form input {
  height: 52px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: 0;
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
  font-size: 16px;
  letter-spacing: 0.04em;
  font-family: var(--mono);
  box-shadow: inset 0 1px 2px rgba(42, 52, 65, 0.04);
  transition: box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.login-form input:focus {
  background: var(--surface);
  box-shadow:
    0 0 0 3px rgba(94, 184, 168, 0.35),
    var(--shadow-sm);
}
.login-form input::placeholder {
  color: var(--ink-faint);
  letter-spacing: 0;
  font-family: var(--font);
}

/* —— Buttons —— */
.primary-action {
  height: 52px;
  margin-top: 4px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, #7ecfc0 0%, var(--accent-deep) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  font-family: var(--display);
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-accent);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), filter var(--dur) var(--ease);
}
.primary-action:disabled { opacity: 0.55; cursor: not-allowed; }
.primary-action:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(61, 154, 140, 0.28);
}
.primary-action:not(:disabled):active {
  transform: scale(0.97);
  box-shadow: var(--shadow-sm);
}

.ghost-action {
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ghost-action:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.ghost-action:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.ghost-action:not(:disabled):active { transform: scale(0.97); }

.danger-action {
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 10px 22px rgba(217, 122, 114, 0.28);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.danger-action:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.danger-action:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(217, 122, 114, 0.32);
}
.danger-action:not(:disabled):active { transform: scale(0.97); }

/* —— Dashboard —— */
.dashboard {
  display: grid;
  gap: var(--space-lg);
}

.vehicle-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.vehicle-meta { min-width: 0; flex: 1; }
.vehicle-bar .section-kicker { display: none; }
.vehicle-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--display);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vehicle-sub {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-family: var(--mono);
}
.vehicle-stats { display: none; }
.vehicle-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.selection-bar {
  position: sticky;
  top: 68px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-lg);
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.selection-bar.is-empty,
.dashboard.is-empty .selection-bar {
  display: none !important;
}
.selection-bar.has-selection {
  box-shadow: var(--shadow-md), 0 0 0 3px rgba(94, 184, 168, 0.18);
}
.select-all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 600;
  user-select: none;
  color: var(--ink);
}
.select-all input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-deep);
}
.selection-summary {
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-family: var(--mono);
}
.selection-summary.has-selection {
  color: var(--accent-deep);
  font-weight: 600;
}
.selection-actions {
  margin-left: auto;
  display: flex;
  gap: var(--space-sm);
}

/* —— Records —— */
.records {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}
@media (min-width: 760px) {
  .records { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.record-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: grid;
  gap: var(--space-md);
  box-shadow: var(--shadow-md);
  transition: transform 280ms var(--ease), box-shadow 280ms var(--ease);
}
.record-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.record-card.is-selected {
  box-shadow: var(--shadow-lg), 0 0 0 3px rgba(94, 184, 168, 0.35);
}

.record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}
.record-select {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.record-select input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent-deep);
  flex-shrink: 0;
}
.record-title h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-time {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--amber);
  font-family: var(--mono);
  font-weight: 500;
}
.icon-action {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-action:hover {
  color: var(--red);
  background: var(--red-soft);
  transform: translateY(-1px);
}
.icon-action:active { transform: scale(0.95); }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-family: var(--mono);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font);
  box-shadow: var(--shadow-sm);
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.is-complete {
  color: var(--green);
  background: var(--green-soft);
}
.status-pill.is-partial {
  color: #8a6a28;
  background: var(--amber-soft);
}
.status-pill.is-missing {
  color: var(--ink-soft);
  background: var(--surface-muted);
}

/* Soft photo mat */
.snapshot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  box-shadow: inset 0 1px 3px rgba(42, 52, 65, 0.04);
}
.snapshot {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-muted);
  cursor: zoom-in;
  box-shadow: var(--shadow-sm);
  padding: 0;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.snapshot:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.snapshot:active { transform: scale(0.98); }
.snapshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.snapshot .label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--display);
  box-shadow: var(--shadow-sm);
}
.snapshot-placeholder {
  grid-column: 1 / -1;
  padding: var(--space-xl);
  text-align: center;
  color: var(--ink-faint);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.85rem;
}

.media-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  text-align: center;
  background: rgba(244, 247, 251, 0.96);
  color: var(--ink-soft);
  font-size: 0.75rem;
}
.media-fallback[hidden] { display: none !important; }
.media-fallback p { margin: 0; color: var(--ink); font-weight: 600; }
.snapshot.is-failed img { display: none; }

.message {
  margin: 0;
  min-height: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-family: var(--mono);
}
.message:empty { display: none; }
.message.is-error { color: var(--red-ink); }
.message.is-ok { color: var(--green); opacity: 0.85; font-size: 0.72rem; }

.empty-state {
  padding: clamp(48px, 14vh, 88px) var(--space-xl);
  text-align: center;
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  gap: var(--space-sm);
}
.empty-state .section-kicker { margin-bottom: var(--space-xs); }
.empty-state h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.empty-state p {
  margin: 0;
  font-size: 0.92rem;
  max-width: 28ch;
  line-height: 1.6;
  color: var(--ink-soft);
}

.load-more {
  justify-self: center;
  margin: var(--space-sm) auto 0;
  min-height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  font-family: var(--display);
  box-shadow: var(--shadow-md);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.load-more:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.load-more:active { transform: scale(0.97); }

/* —— Dialog / toast / lightbox —— */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: var(--space-lg);
  background: rgba(42, 52, 65, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dialog[hidden] { display: none; }
.dialog-card {
  width: min(100%, 400px);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: var(--space-md);
}
.dialog-card h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.dialog-body { margin: 0; color: var(--ink); font-size: 0.95rem; }
.dialog-warn { margin: 0; color: var(--red-ink); font-size: 0.82rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 120;
  max-width: 90vw;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}
.toast[hidden] { display: none; }
.toast.is-error {
  background: var(--red);
  color: #fff;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: var(--space-lg);
  background: rgba(42, 52, 65, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - 100px);
  border-radius: var(--radius-md);
  object-fit: contain;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
}
.lightbox-caption {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.85rem;
  font-family: var(--mono);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.lightbox-close {
  position: absolute;
  top: calc(12px + var(--safe-t));
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  box-shadow: var(--shadow-md);
  transition: transform var(--dur) var(--ease);
}
.lightbox-close:hover { transform: translateY(-1px); }
.lightbox-close:active { transform: scale(0.95); }

@media (max-width: 420px) {
  .workspace { padding: var(--space-lg) var(--space-md) var(--space-2xl); }
  .login-panel { padding: var(--space-xl) var(--space-lg); }
  .selection-actions { width: 100%; justify-content: flex-end; }
  .selection-actions .danger-action,
  .selection-actions .ghost-action { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(94, 184, 168, 0.55);
  outline-offset: 2px;
}
