:root {
  --ink: #122033;
  --muted: #657184;
  --line: #dfe5ec;
  --panel: #ffffff;
  --bg: #f4f7fa;
  --blue: #1769e0;
  --blue-dark: #0f4aa5;
  --green: #157347;
  --gold: #9a6400;
  --red: #b42318;
  --shadow: 0 14px 35px rgba(30, 58, 90, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Microsoft YaHei", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
button, input, textarea, select { font: inherit; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px;
  color: var(--ink); background: #fff; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,105,224,.12); }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.035em; }
.mobile-header, .dashboard-header {
  color: white; background: linear-gradient(125deg, #0d3c78, #1769e0 68%, #45a2ff);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.mobile-header { padding: 22px 18px 48px; }
.mobile-header .eyebrow, .dashboard-header .eyebrow { color: #bcd8ff; }
.mobile-header p:last-child, .dashboard-header p:last-child { margin: 8px 0 0; color: #dbeaff; }
.header-link, .primary-link {
  color: white; text-decoration: none; border: 1px solid rgba(255,255,255,.5);
  padding: 10px 14px; border-radius: 999px; white-space: nowrap;
}
.mobile-main { padding: 0 12px 28px; margin-top: -28px; }
.panel {
  max-width: 720px; margin: 0 auto; background: var(--panel); border-radius: 20px;
  padding: 20px 16px; box-shadow: var(--shadow);
}
.panel section { margin-bottom: 24px; }
.section-label { display: block; margin-bottom: 10px; font-weight: 800; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; padding: 11px 5px; text-align: center; border: 1px solid var(--line);
  border-radius: 11px; color: var(--muted); font-size: 14px;
}
.segmented input:checked + span { color: var(--blue-dark); border-color: var(--blue); background: #edf5ff; font-weight: 800; }
.tracking-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.scan-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 8px; margin-top: 9px; }
.primary-button, .secondary-button {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 800; cursor: pointer;
}
.primary-button { width: 100%; color: white; background: linear-gradient(110deg, var(--blue-dark), var(--blue)); box-shadow: 0 9px 20px rgba(23,105,224,.25); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.secondary-button { color: var(--blue-dark); background: #edf5ff; white-space: nowrap; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.hidden-section { display: none; }
.photo-picker {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 112px;
  border: 1.5px dashed #9db9db; border-radius: 14px; background: #f6faff; color: var(--blue-dark);
}
.photo-picker span, .hint { color: var(--muted); font-size: 13px; }
.hint { margin: 8px 2px 0; }
.preview-strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding: 2px; }
.preview-item { position: relative; flex: 0 0 auto; }
.preview-strip img { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.preview-remove {
  position: absolute; top: -4px; right: -4px; width: 24px; height: 24px; border: 0;
  border-radius: 999px; color: #fff; background: rgba(18, 32, 51, .86); font-size: 20px;
  line-height: 22px; cursor: pointer;
}
.candidate-box { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.candidate-box:empty { display: none; }
.candidate-box > span { width: 100%; color: var(--muted); font-size: 13px; }
.candidate-box button {
  border: 1px solid #9db9db; border-radius: 999px; padding: 8px 10px; background: #f6faff;
  color: var(--blue-dark); font-family: ui-monospace, Consolas, monospace; cursor: pointer;
}
.candidate-box button.selected { color: #fff; border-color: var(--blue); background: var(--blue); }
.form-message { margin-top: 12px; border-radius: 10px; padding: 0; font-size: 14px; }
.form-message.show { padding: 12px; background: #eef5ff; color: var(--blue-dark); }
.form-message.error { background: #fff0ee; color: var(--red); }
.scan-dialog {
  width: min(620px, 96vw); border: 0; border-radius: 18px; padding: 14px;
  color: var(--ink); background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.scan-dialog::backdrop { background: rgba(4, 13, 24, .78); }
.scan-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.scan-dialog-head button {
  width: 36px; height: 36px; border: 0; border-radius: 999px; background: #eef2f6;
  color: var(--ink); font-size: 26px; line-height: 32px; cursor: pointer;
}
.scan-video-wrap { position: relative; overflow: hidden; border-radius: 14px; background: #0b1320; }
.scan-video-wrap video { display: block; width: 100%; min-height: 260px; max-height: 66vh; object-fit: cover; }
.scan-guide {
  position: absolute; left: 8%; right: 8%; top: 38%; height: 24%; border: 3px solid #44e38a;
  border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.24);
}
.scan-dialog > p { margin: 10px 2px 0; color: var(--muted); font-size: 13px; }
.dashboard-header { padding: 28px clamp(20px, 4vw, 56px); }
.dashboard-main { padding: 24px clamp(16px, 4vw, 56px) 56px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.summary-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 17px; box-shadow: var(--shadow); }
.summary-card strong { display: block; font-size: 28px; margin-top: 5px; }
.summary-card span { color: var(--muted); font-size: 13px; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 190px auto; gap: 10px; margin: 20px 0; }
.return-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.return-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.photo-rail { display: flex; gap: 4px; height: 145px; background: #e9eef4; overflow: hidden; }
.photo-rail img { flex: 1 1 0; min-width: 0; object-fit: cover; }
.photo-placeholder { width: 100%; display: grid; place-items: center; color: var(--muted); }
.card-body { padding: 15px; }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.case-id { font-size: 12px; color: var(--muted); }
.status { display: inline-block; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; }
.status-matched { color: var(--green); background: #eaf7f0; }
.status-matched_original { color: var(--gold); background: #fff6dc; }
.status-processed { color: #fff; background: var(--green); }
.status-manual_review, .status-unmatched, .status-query_error { color: var(--red); background: #fff0ee; }
.status-pending_query { color: var(--blue-dark); background: #edf5ff; }
.tracking { margin: 10px 0 5px; font-family: ui-monospace, Consolas, monospace; font-size: 16px; font-weight: 800; word-break: break-all; }
.meta-list { display: grid; grid-template-columns: 82px 1fr; gap: 6px 8px; margin: 12px 0; font-size: 13px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.product-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.product-chips span { background: #f1f4f7; border-radius: 7px; padding: 5px 7px; font-size: 12px; }
.card-actions { display: flex; gap: 8px; margin-top: 14px; }
.card-actions button { flex: 1; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.detail-dialog { width: min(920px, 94vw); max-height: 90vh; border: 0; border-radius: 20px; padding: 24px; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.detail-dialog::backdrop { background: rgba(9, 20, 34, .55); }
.dialog-close { position: absolute; right: 15px; top: 12px; border: 0; background: transparent; font-size: 30px; cursor: pointer; }
.detail-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 18px 0; }
.detail-gallery img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #eef2f6; border-radius: 12px; }
@media (max-width: 720px) {
  .scan-actions { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 1fr; }
  .return-grid { grid-template-columns: 1fr; }
  .dashboard-header { align-items: flex-start; }
}
