:root {
  --orange: #ff7a00;
  --orange-dark: #e56a00;
  --orange-soft: #fff2e5;
  --orange-line: #ffd9b3;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #7b8794;
  --line: #eef0f3;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

body {
  min-height: 100vh;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
}

.topbar .title {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.topbar .back-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text);
  padding: 4px 6px;
  cursor: pointer;
}

.topbar .spacer {
  width: 28px;
}

.view {
  flex: 1;
  padding: 16px 16px 96px;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}

.tabbar button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0 8px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.tabbar button .ico {
  font-size: 19px;
  line-height: 1;
}

.tabbar button.active {
  color: var(--orange);
  font-weight: 600;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.card.soft {
  background: var(--orange-soft);
  border: 1px solid var(--orange-line);
  box-shadow: none;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title .dot {
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--orange);
  display: inline-block;
}

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.28);
}

.btn-secondary {
  background: var(--orange-soft);
  color: var(--orange-dark);
  border: 1px solid var(--orange-line);
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-danger {
  background: #fff;
  color: var(--red);
  border: 1px solid #f3d1d1;
}

.btn-sm {
  width: auto;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  display: inline-block;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btn-row .btn {
  flex: 1;
}

.hero-btn {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  width: 100%;
  padding: 26px 18px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255, 122, 0, 0.3);
  margin-bottom: 12px;
}

.hero-btn .hero-ico {
  font-size: 30px;
  display: block;
  margin-bottom: 8px;
}

.hero-btn .hero-title {
  font-size: 20px;
  font-weight: 700;
}

.hero-btn .hero-desc {
  font-size: 13px;
  opacity: 0.92;
  margin-top: 4px;
}

.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.entry-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.entry-card.soft {
  background: var(--orange-soft);
  border-color: var(--orange-line);
}

.entry-card .ico {
  font-size: 22px;
  display: block;
  margin-bottom: 6px;
}

.entry-card .t {
  font-size: 15px;
  font-weight: 600;
}

.entry-card .d {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.field {
  margin-bottom: 14px;
}

.field > label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field .req {
  color: var(--red);
  margin-left: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fafbfc;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange);
  background: #fff;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.plate-input {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
  font-size: 19px;
  text-align: center;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}

.kv:last-child {
  border-bottom: none;
}

.kv .k {
  color: var(--muted);
  flex: 0 0 auto;
}

.kv .v {
  text-align: right;
  font-weight: 500;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  border: 1px solid var(--orange-line);
}

.badge.green {
  background: #e8f8ee;
  color: var(--green);
  border-color: #c6ecd4;
}

.badge.gray {
  background: #f1f3f5;
  color: var(--muted);
  border-color: var(--line);
}

.list-item {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.list-item .row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.list-item .plate {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
}

.list-item .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 14px;
}

.empty .ico {
  font-size: 34px;
  display: block;
  margin-bottom: 10px;
  opacity: 0.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translate(-50%, 20px);
  background: rgba(31, 41, 55, 0.94);
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  max-width: 84%;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: rgba(185, 28, 28, 0.95);
}

.toast.success {
  background: rgba(21, 128, 61, 0.95);
}

/* 识别中的大提示：半透明遮罩 + 白色圆角卡片 */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 95;
}

.loading-mask.show {
  display: flex;
}

.loading-box {
  background: #fff;
  border-radius: 18px;
  padding: 30px 36px;
  text-align: center;
  min-width: 220px;
  max-width: 84%;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.22);
}

.loading-box .big-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 4px solid var(--orange-soft);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-box .loading-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.loading-box .loading-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}

/* ---------------- 水印相机（全屏取景） ---------------- */
.wm-full {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
  z-index: 60;
}

.wm-full video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
  transform-origin: center center;
}

.wm-layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  transition: opacity 0.22s;
}

.wm-layer.ui-hidden {
  opacity: 0;
}

.wm-layer > * {
  pointer-events: auto;
}

.wm-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 0;
}

.wm-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.wm-geo {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11.5px;
  line-height: 1.5;
  padding: 6px 10px;
  border-radius: 10px;
  max-height: 48px;
  overflow: hidden;
}

.wm-styles {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
}

.wm-styles button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.wm-styles button.active {
  background: var(--orange);
  border-color: var(--orange);
  font-weight: 600;
}

.wm-bottom {
  padding: 0 14px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wm-inputs {
  display: flex;
  gap: 8px;
}

.wm-inputs input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
}

.wm-inputs input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.wm-zoom {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.wm-zoom button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
}

.wm-zoom button.active {
  background: var(--orange);
  border-color: var(--orange);
  font-weight: 600;
}

.wm-shutterbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}

.wm-shutter {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: var(--orange);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.wm-shutter:active {
  transform: scale(0.94);
}

.wm-side {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.wm-tip {
  position: absolute;
  left: 50%;
  bottom: 30%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  white-space: nowrap;
}

.wm-tip.show {
  opacity: 1;
}

.wm-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 14px 2px;
}

.wm-thumbs .wm-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 78px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.wm-thumbs .wm-thumb img {
  width: 100%;
  height: 78px;
  object-fit: cover;
  display: block;
}

.wm-thumbs .wm-thumb .tag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 2px 0;
}

/* 取景框里的水印预览：与烧录到照片上的效果一致 */
.wm-preview {
  position: absolute;
  left: 5%;
  bottom: 28%;
  max-width: 90%;
  pointer-events: none;
  white-space: pre-wrap;
}

.wm-preview .wm-line {
  white-space: pre-wrap;
}

.wm-preview.style-1 {
  background: rgba(0, 0, 0, 0.45);
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  padding: 7px 11px;
}

.wm-preview.style-1 .wm-line {
  color: #fff;
  font-size: 11.5px;
  line-height: 1.55;
}

.wm-preview.style-2 {
  padding: 0;
  background: none;
}

.wm-preview.style-2 .wm-line {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.6);
}

.wm-preview.style-2 .wm-time {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
}

.wm-preview.style-2 .wm-info {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.wm-preview.style-3 {
  left: 0;
  right: 0;
  max-width: none;
  background: rgba(17, 24, 39, 0.62);
  border-top: 3px solid var(--orange);
  border-radius: 0;
  padding: 8px 12px;
}

.wm-preview.style-3 .wm-line {
  color: #fff;
}

.wm-preview.style-3 .wm-time {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.wm-preview.style-3 .wm-info {
  font-size: 11.5px;
  line-height: 1.5;
}

/* 横屏时字号略小，避免挡住画面 */
.wm-preview.landscape.style-1 .wm-line {
  font-size: 10.5px;
}

.wm-preview.landscape.style-2 .wm-time {
  font-size: 18px;
}

.wm-preview.landscape.style-2 .wm-info {
  font-size: 11px;
}

.wm-preview.landscape.style-3 .wm-time {
  font-size: 15px;
}

.wm-preview.landscape.style-3 .wm-info {
  font-size: 11px;
}

/* 横屏或屏幕较矮时，把水印预览往上挪，避免和底部按钮重叠 */
@media (max-height: 680px) {
  .wm-preview {
    bottom: 46%;
  }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 90;
}

.overlay.show {
  display: flex;
}

.sheet {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px 26px;
  max-height: 88vh;
  overflow-y: auto;
}

.sheet-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
}

.camera-box {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  aspect-ratio: 4 / 3;
}

.camera-box video,
.camera-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-frame {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 26%;
  height: 30%;
  border: 2px solid var(--orange);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.thumb {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f6f7f9;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb .del {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  line-height: 1;
  font-size: 12px;
  cursor: pointer;
}

.thumb.add {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.section-gap {
  height: 8px;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #fff6ee 0%, #ffffff 42%);
  max-width: 480px;
  margin: 0 auto;
}

.login-logo {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  background: var(--orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 18px;
  box-shadow: 0 8px 20px rgba(255, 122, 0, 0.3);
}

.login-title {
  text-align: center;
  font-size: 21px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 26px;
}

.loading {
  text-align: center;
  color: var(--muted);
  padding: 26px;
  font-size: 14px;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--orange-soft);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.fade-in {
  animation: fade 0.18s ease-in;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-box {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-box .n {
  font-size: 22px;
  font-weight: 700;
  color: var(--orange);
}

.stat-box .l {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
