:root {
  --navy: #172f52;
  --ink: #172b47;
  --blue: #165de5;
  --blue-dark: #104abd;
  --amber: #a65e0c;
  --muted: #606d82;
  --line: #d2dbea;
  --base: #f2f6fb;
  --soft-blue: #edf3ff;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: #e9eff6;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #648fff; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -80px; padding: 12px; background: white; color: var(--blue); z-index: 5; }
.skip-link:focus { top: 8px; }
.app-shell { max-width: 500px; min-height: 100svh; margin: 0 auto; background: white; display: flex; flex-direction: column; }
.masthead { min-height: 62px; background: var(--navy); color: white; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 23px; font-weight: 700; line-height: 1.2; white-space: nowrap; letter-spacing: -.4px; }
.barcode-mark { width: 36px; height: 27px; stroke: currentColor; stroke-width: 1.3; }
.brand-tag { border: 1px solid #d0dced; border-radius: 7px; padding: 2px 9px; font-size: 13px; white-space: nowrap; }
main { flex: 1; padding: 21px 20px 25px; }
h1 { font-size: 30px; font-weight: 750; line-height: 1.3; letter-spacing: -.6px; }
.page-intro p { margin-top: 7px; color: var(--muted); font-size: 14px; }
.query-form { margin-top: 22px; }
.search-row { display: flex; align-items: stretch; gap: 8px; }
.search-field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 1px solid #aabbd5; border-radius: 7px; padding: 0 11px; background: white; }
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px #165de51a; }
.search-field .icon { width: 20px; height: 20px; color: #40516b; }
.search-field input { min-width: 0; width: 100%; min-height: 46px; padding: 9px 0; color: var(--ink); border: 0; background: transparent; font-size: 15px; outline: none; }
.search-field input::placeholder { color: #67768b; opacity: 1; }
.button { min-height: 44px; padding: 8px 16px; border: 1px solid transparent; border-radius: 7px; font-size: 16px; font-weight: 600; line-height: 1.4; background: white; color: var(--ink); }
.primary { background: var(--blue); color: white; border-color: var(--blue); }
.primary:hover { background: var(--blue-dark); }
.outline { background: white; color: var(--blue); border-color: #97afe1; }
.outline:hover:not(:disabled) { background: var(--soft-blue); }
.date-row { display: flex; align-items: center; gap: 10px; margin-top: 19px; }
.date-row label { font-size: 14px; color: #46566e; font-weight: 600; white-space: nowrap; }
.date-row input { flex: 1; min-width: 0; width: 0; min-height: 44px; padding: 7px 9px; border: 1px solid #aabbd5; border-radius: 6px; color: var(--ink); background: white; font-size: 15px; }
.date-row .button { padding-left: 13px; padding-right: 13px; font-weight: 500; }
.filter-row { display: flex; gap: 9px; margin-top: 19px; }
.filter { min-height: 44px; padding: 8px 18px; border: 1px solid #a7b9d9; border-radius: 10px; background: white; color: #46566e; font-size: 16px; font-weight: 600; }
.filter:first-child { min-width: 94px; }
.filter.selected { background: var(--blue); color: white; border-color: var(--blue); }
.filter:hover:not(.selected) { background: var(--soft-blue); }
.helper { margin-top: 8px; color: var(--muted); font-size: 13px; }
.results { margin-top: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
h2 { font-size: 19px; font-weight: 700; }
.sort-actions { display: flex; align-items: center; gap: 3px; color: #35527d; font-size: 12px; white-space: nowrap; }
.icon-button { width: 44px; height: 44px; padding: 8px; border: 0; background: transparent; color: var(--blue); display: grid; place-items: center; border-radius: 6px; }
.icon-button .icon { width: 18px; height: 18px; }
.icon-button:hover { background: var(--soft-blue); }
.table-heading { min-height: 35px; padding: 6px 24px 6px 9px; display: flex; justify-content: space-between; align-items: center; background: #edf1f7; border-radius: 5px; font-size: 13px; font-weight: 600; color: #526078; }
.ranking-list { list-style: none; margin: 3px 0 0; padding: 0; }
.ranking-list li + li { border-top: 1px solid var(--line); }
.rank-row { display: grid; grid-template-columns: 27px minmax(0,1fr) minmax(62px,max-content) 12px; align-items: center; gap: 8px; width: 100%; min-height: 52px; border: 0; background: white; color: var(--ink); padding: 11px 8px; text-align: left; border-radius: 5px; }
.ranking-list li:first-child .rank-row { background: var(--soft-blue); }
.rank-row:hover { background: #e3edff; }
.rank-number { color: #26416c; font-size: 16px; font-weight: 650; }
.rank-code { min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.rank-count { color: var(--amber); text-align: right; font-size: 18px; font-weight: 750; white-space: nowrap; }
.rank-count small { font-size: 13px; font-weight: 600; }
.rank-row .icon { width: 12px; height: 18px; color: #60728b; }
.list-tip { padding-top: 10px; color: var(--muted); font-size: 13px; }
.complete { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); margin-top: 17px; padding-top: 14px; }
.pager .button { font-size: 14px; padding-left: 12px; padding-right: 12px; }
.pager span { font-size: 13px; color: var(--muted); }
.status { padding: 34px 12px; text-align: center; color: var(--muted); font-size: 14px; background: var(--base); border-radius: 7px; overflow-wrap: anywhere; }
.status strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 7px; }
.error-box { padding: 17px; border: 1px solid #edc5b0; background: #fff8f3; border-radius: 8px; color: #8b3e1c; font-size: 14px; }
.error-box p { margin-bottom: 12px; overflow-wrap: anywhere; }
.error-box .button { font-size: 14px; }
.page-footer { padding: 12px 20px max(12px, env(safe-area-inset-bottom)); text-align: center; background: #edf2f8; color: #5e6b80; font-size: 12px; }
.back-button { min-height: 44px; margin: -9px 0 7px -7px; padding: 7px; border: 0; background: transparent; color: var(--blue); display: flex; align-items: center; gap: 5px; font-size: 15px; }
.back-button .icon { width: 19px; height: 19px; }
.raw-label { margin-top: 18px; color: var(--muted); font-size: 14px; }
.raw-code { margin-top: 2px; font-size: 28px; font-weight: 750; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; }
.summary-panel { position: relative; margin-top: 17px; background: var(--navy); color: white; padding: 33px 19px 17px; border-radius: 9px; display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); gap: 14px; }
.summary-panel > div { display: flex; flex-direction: column; justify-content: flex-end; }
.summary-panel > div > span { font-size: 13px; color: #e1e8f3; }
.summary-count { border-right: 1px solid #8092ab; padding-right: 14px; }
.summary-count strong { font-size: 30px; font-weight: 750; color: #ffd38d; line-height: 1.3; }
.summary-date strong { font-size: 20px; font-weight: 650; white-space: nowrap; line-height: 1.8; }
.threshold-tag { position: absolute; top: 9px; right: 12px; background: #bc7008; color: white; border-radius: 8px; padding: 1px 9px; font-size: 12px; }
.detail-results { margin-top: 23px; }
.muted { font-size: 14px; color: var(--muted); }
.entries-list { margin: 0; padding: 0; list-style: none; }
.entry-row { position: relative; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) 42px; align-items: center; gap: 10px; min-height: 65px; padding: 10px 0 10px 33px; border-top: 1px solid var(--line); }
.entry-row::before { content: ""; position: absolute; top: 0; bottom: 0; left: 13px; width: 1px; background: #cfddf2; }
.entry-row::after { content: ""; position: absolute; top: 25px; left: 8px; width: 11px; height: 11px; border: 2px solid var(--blue); border-radius: 50%; background: white; }
.entry-row:first-child::before { top: 30px; }
.entry-row:last-child::before { bottom: calc(100% - 30px); }
.entry-row:first-child:last-child::before { display: none; }
.entry-time { display: block; font-size: 17px; font-weight: 650; }
.entry-date { display: block; color: var(--muted); font-size: 12px; }
.entry-counter { min-width: 0; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.entry-badge { justify-self: end; padding: 1px 6px; background: #e0eaff; color: #0a50c7; font-size: 12px; border-radius: 5px; }
.photos-summary { margin-bottom: 5px; color: #35527d; font-size: 13px; }
.photo-rule { margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.entry-images { grid-column: 1 / -1; min-width: 0; padding: 1px 0 5px; }
.no-photo { color: var(--muted); font-size: 12px; padding: 2px 0 4px; }
.photo-record + .photo-record { margin-top: 15px; }
.photo-record-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 9px; margin-bottom: 6px; color: #50617a; font-size: 12px; overflow-wrap: anywhere; }
.photo-record-heading strong { font-weight: 500; color: #3d5271; }
.photo-comparison { color: #925609; background: #fff2dc; border-radius: 4px; padding: 1px 5px; }
.photo-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.photo-tile { min-width: 0; }
.photo-open { display: block; width: 100%; padding: 0; border: 1px solid #d0dced; border-radius: 7px; overflow: hidden; color: var(--ink); background: white; text-align: center; }
.photo-open:disabled { opacity: 1; cursor: default; }
.photo-open:not(:disabled):hover { border-color: var(--blue); }
.photo-frame { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; background: #edf2f8; overflow: hidden; }
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.photo-state { padding: 9px; color: var(--muted); font-size: 12px; text-align: center; }
.photo-type { display: block; padding: 5px; color: #3d5271; font-size: 12px; }
.photo-retry { display: block; width: 100%; min-height: 44px; margin-top: 5px; border: 1px solid #a7b9d9; border-radius: 6px; color: var(--blue); background: white; font-size: 13px; }
.unmatched-section { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; }
.unmatched-photos { margin-top: 13px; }
.unmatched-photos > .photo-record { margin-top: 16px; }
.unmatched-device { margin-bottom: 7px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.photo-viewer { width: min(900px,calc(100% - 24px)); max-height: 94svh; padding: 16px; border: 0; border-radius: 11px; background: var(--navy); color: white; }
.photo-viewer::backdrop { background: rgba(8,20,38,.85); }
.viewer-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.viewer-heading h2 { font-size: 18px; }
.viewer-close { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 1px solid #a6bbd6; border-radius: 7px; color: white; background: transparent; font-size: 27px; line-height: 1; }
.viewer-caption { margin: 5px 0 13px; font-size: 13px; color: #d5e0f1; overflow-wrap: anywhere; }
.viewer-frame { display: grid; place-items: center; min-height: 140px; background: #f0f4fa; border-radius: 6px; overflow: hidden; }
.viewer-frame img { display: block; max-width: 100%; max-height: 68svh; object-fit: contain; }
.viewer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 12px; }
.viewer-actions a { display: inline-flex; align-items: center; min-height: 44px; color: #d5e0ff; font-size: 14px; }
.detail-progress { padding-top: 12px; margin-top: 2px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.detail-results .error-box { margin-top: 12px; }
.full-width { display: block; width: 100%; margin-top: 16px; }
.noscript { padding: 20px; background: white; color: #8b3e1c; }
@media (min-width: 540px) {
  body { padding: 28px 20px; }
  .app-shell { min-height: calc(100svh - 56px); border-radius: 15px; overflow: hidden; box-shadow: 0 8px 32px #172f5212; }
  main { padding: 26px 25px 30px; }
  .masthead { padding-left: 25px; padding-right: 25px; }
  .rank-code { font-size: 16px; }
}
@media (max-width: 359px) {
  main { padding-left: 14px; padding-right: 14px; }
  .masthead { padding-left: 14px; padding-right: 14px; }
  .brand { font-size: 21px; gap: 6px; }
  .barcode-mark { width: 28px; }
  .brand-tag { padding-left: 7px; padding-right: 7px; font-size: 12px; }
  h1 { font-size: 28px; }
  .page-intro p { font-size: 12px; }
  .search-field { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .search-field input { font-size: 13px; }
  .search-row > .button { padding-left: 13px; padding-right: 13px; }
  .date-row { gap: 7px; }
  .date-row label { font-size: 13px; }
  .date-row input { font-size: 14px; padding-left: 5px; padding-right: 5px; }
  .date-row .button { padding-left: 10px; padding-right: 10px; font-size: 14px; }
  .filter { font-size: 15px; padding-left: 13px; padding-right: 13px; }
  .filter:first-child { min-width: 82px; }
  .rank-row { grid-template-columns: 22px minmax(0,1fr) minmax(52px,max-content) 10px; gap: 5px; padding-left: 7px; padding-right: 7px; }
  .rank-code { font-size: 14px; }
  .rank-count { font-size: 17px; }
  .rank-number { font-size: 14px; }
  .helper, .sort-actions { font-size: 12px; }
  .summary-panel { padding-left: 14px; padding-right: 14px; gap: 12px; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); }
  .summary-date strong { font-size: 18px; }
  .entry-row { gap: 7px; padding-left: 28px; }
  .entry-time { font-size: 16px; }
}
