:root {
  color-scheme: light;
  --zkn-blue: #0058aa;
  --zkn-blue-dark: #004488;
  --zkn-blue-light: #e8f1fa;
  --zkn-yellow: #fbd915;
  --zkn-yellow-light: #fef7cc;
  --bg: #f4f6f6;
  --panel: #ffffff;
  --ink: #1f1f1f;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: var(--zkn-blue);
  --brand-dark: var(--zkn-blue-dark);
  --accent: #fbd915;
  --ok: #1e9e5a;
  --warn: #f59e0b;
  --bad: #ed1c24;
  --shadow: 0 1px 3px rgba(0, 40, 80, 0.08), 0 4px 12px rgba(0, 40, 80, 0.06);
  --blue: #0058aa;
  --blue-strong: #004488;
  --blue-soft: #e8f1fa;
  --blue-border: #b6d3ec;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;
  --green-soft: #ecfdf5;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --radius-xl: 14px;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-full: 999px;
  --progress-h: 96px;
  font-family:
    "Alibaba PuHuiTi",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body:has(.admin-shell) {
  background: #f4f6f8;
  color: var(--slate-900);
  overflow-anchor: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px;
}

.admin-shell {
  position: relative;
  min-height: 100vh;
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 32px;
}

.admin-content {
  transition:
    filter 0.18s ease,
    opacity 0.18s ease;
}

.admin-lock-overlay {
  display: none;
}

.admin-shell-locked .admin-content {
  filter: blur(14px);
  opacity: 0.42;
  pointer-events: none;
  user-select: none;
}

.admin-shell-locked .admin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: block;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}

.group-panel,
.admin-panel,
.admin-hero,
.admin-column-card,
.success-panel,
.photo-section,
.rescue-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px 22px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: none;
}

.admin-title-block {
  min-width: 0;
}

.admin-subtitle {
  margin-top: 2px;
  color: var(--slate-500);
  font-size: 12.5px;
  font-weight: 450;
}

.admin-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.admin-hero-actions .ghost-button {
  min-height: 34px;
  padding: 0 16px;
}

.admin-link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-link-box input {
  width: 260px;
  min-height: 36px;
  padding: 6px 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--slate-50);
  color: var(--slate-400);
  font-size: 13px;
}

.admin-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.admin-tab-buttons {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 4px;
  margin: 0 0 -1px;
}

.admin-tab-button {
  position: relative;
  min-width: 132px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 50px;
  padding: 10px 18px;
  border: 0.5px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: transparent;
  color: var(--slate-500);
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  box-shadow: none;
  transform: none;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.admin-tab-button:hover:not(.active) {
  background: rgba(15, 23, 42, 0.04);
  color: var(--slate-700);
}

.admin-tab-button span {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}

.admin-tab-button strong {
  font-size: 11px;
  font-weight: 450;
  color: var(--slate-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-tab-button.active {
  z-index: 2;
  background: var(--panel);
  border-color: var(--slate-200);
  border-bottom-color: var(--panel);
  color: var(--slate-900);
}

.admin-tab-button.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--brand);
}

.admin-tab-button.active strong {
  color: var(--slate-500);
}

.admin-tab-stage {
  position: relative;
}

.admin-login-required {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 20px 22px;
  border: 0.5px solid var(--amber-border);
  border-radius: var(--radius-xl);
  background: var(--amber-soft);
  color: var(--slate-800);
}

.admin-login-required p {
  margin: 6px 0 0;
  color: var(--slate-500);
  font-size: 13px;
}

.admin-login-required .ghost-button {
  flex: 0 0 auto;
  min-height: 34px;
  background: #fff;
}

.admin-shell-locked .admin-login-required {
  visibility: hidden;
}

.admin-column-card {
  display: none;
  gap: 20px;
  min-height: calc(100vh - 220px);
  padding: 24px 28px;
  border: 0.5px solid var(--slate-200);
  border-radius: 0 var(--radius-xl) var(--radius-xl) var(--radius-xl);
  box-shadow: none;
}

.admin-column-card.active {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
}

.top-title,
.section-title,
.task-header,
.scanner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.compact-button {
  min-width: 58px;
}

.task-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-badge {
  flex: 0 0 auto;
  padding: 5px 14px;
  border-radius: var(--radius-md);
  background: var(--slate-900);
  color: #ffd54f;
  font-weight: 700;
  font-size: 13px;
}

.brand-logo {
  flex: 0 0 auto;
  height: 40px;
  width: auto;
  display: block;
}

.brand-title h1 {
  color: var(--zkn-blue);
  font-weight: 800;
  font-size: 20px;
}

.brand-stripe {
  height: 6px;
  margin: 12px 0 10px;
  border-radius: 999px;
  background: repeating-linear-gradient(45deg, var(--zkn-yellow) 0 12px, #fff 12px 24px);
}

.admin-stripe {
  margin: -8px 0 18px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 17px;
}

.muted,
.progress-text,
.scanner-state {
  color: var(--muted);
}

.group-picker {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

select {
  width: 100%;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

select:disabled {
  color: var(--muted);
  background: #eef2f4;
}

.group-start-button {
  margin: 0;
}

.sticky-progress {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -14px -14px 12px;
  padding: 12px 14px;
  background: rgba(244, 246, 246, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.task-title {
  min-width: 0;
}

.group-name {
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-text {
  flex: 0 0 auto;
  color: var(--zkn-blue);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.task-meta {
  min-width: 72px;
}

.progress-track {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  background: var(--zkn-blue-light);
  border-radius: 999px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--zkn-blue);
  transition: width 160ms ease;
}

.capture-layout {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: start;
}

.nav-col {
  position: sticky;
  top: calc(var(--progress-h, 96px) + 4px);
  align-self: start;
  height: calc(100vh - var(--progress-h, 96px) - 16px);
  height: calc(100dvh - var(--progress-h, 96px) - 16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.item-nav {
  flex: 1 1 auto;
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-submit-button {
  flex: 0 0 auto;
  min-height: 52px;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--zkn-blue);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
}

.nav-submit-button:active {
  background: var(--zkn-blue-dark);
}

.item-nav-entry {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 5px;
  align-items: center;
  padding: 7px 5px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}

.item-nav-entry .nav-idx {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 10.5px;
  font-weight: 700;
}

.item-nav-entry .nav-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

.item-nav-entry.active {
  background: var(--zkn-blue-light);
  border-left-color: var(--zkn-blue);
  color: var(--zkn-blue);
  font-weight: 700;
}

.item-nav-entry.active .nav-idx {
  background: var(--zkn-blue);
  color: #fff;
}

.item-nav-entry.complete .nav-idx {
  background: var(--ok);
  color: #fff;
}

.item-list {
  display: grid;
  gap: 12px;
}

.add-free-item-button {
  width: 100%;
  margin-top: 12px;
}

.item-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--progress-h, 96px) + 8px);
}

/* 左侧品类目录条目 */
.cat-nav-entry {
  display: grid;
  gap: 3px;
  padding: 12px 9px;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.cat-nav-name {
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cat-nav-count {
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.cat-nav-entry.active {
  background: var(--zkn-blue-light);
  border-left-color: var(--zkn-blue);
  color: var(--zkn-blue);
  font-weight: 700;
}

.cat-nav-entry.active .cat-nav-count {
  color: var(--zkn-blue);
}

.cat-nav-entry.complete .cat-nav-count {
  color: var(--ok);
  font-weight: 700;
}

/* 右侧品类分段 */
.cat-section {
  scroll-margin-top: calc(var(--progress-h, 96px) + 8px);
  margin-bottom: 16px;
}

.cat-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 2px 10px;
  padding-left: 9px;
  border-left: 4px solid var(--zkn-blue);
  color: var(--zkn-blue);
  font-weight: 800;
  font-size: 15px;
}

.cat-section-head span {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

/* 商品折叠行 */
.item-row {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}

.item-row.complete {
  border-color: rgba(0, 88, 170, 0.4);
  box-shadow: inset 3px 0 0 var(--zkn-blue);
}

.item-row-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  cursor: pointer;
}

.row-dots {
  display: flex;
  gap: 4px;
}

.row-dots .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--slate-300);
}

.row-dots .dot.on {
  background: var(--zkn-blue);
}

.row-name {
  min-width: 0;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.row-name.mismatch {
  color: var(--bad);
}

.row-scan-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--zkn-blue);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.item-row.expanded .row-scan-button {
  background: var(--zkn-blue-dark);
}

.item-row-body {
  display: grid;
  gap: 10px;
  padding: 2px 14px 14px;
}

.item-row-body input {
  min-height: 48px;
  font-size: 15px;
}

.row-ref {
  font-size: 12px;
  color: var(--muted);
}

.row-ref.mismatch {
  color: var(--bad);
}

.price-photo-row {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 10px;
  align-items: stretch;
}

.photo-badge {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  min-height: 48px;
  padding: 0;
  border: 1px dashed #c9d5da;
  border-radius: 8px;
  background: #f7faf9;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
}

.photo-badge .cam-ic {
  font-size: 20px;
  line-height: 1;
}

.photo-badge .badge-tick {
  font-size: 11px;
  line-height: 1;
}

.photo-badge.on {
  border-style: solid;
  border-color: var(--ok);
  color: #fff;
}

.photo-badge.on img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-badge.on .badge-tick {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ok);
  color: #fff;
  font-weight: 700;
}

.capture-card {
  display: grid;
  gap: 10px;
}

.item-card.complete {
  border-color: rgba(0, 88, 170, 0.45);
  box-shadow: inset 4px 0 0 var(--brand);
}

.item-head {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr;
  gap: 8px;
  align-items: start;
}

.reference-code {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--zkn-blue-light);
  color: var(--brand-dark);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.reference-code.mismatch {
  background: #ffe8e8;
  color: #a32323;
}

.item-name {
  font-weight: 700;
  line-height: 1.35;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 8px;
  margin-top: 10px;
}

.price-row {
  margin-top: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c9d5da;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 88, 170, 0.14);
  border-color: var(--zkn-blue);
}

input.input-error {
  border-color: var(--bad);
  background: #fff6f6;
}

input.input-error:focus {
  outline-color: rgba(237, 28, 36, 0.16);
  border-color: var(--bad);
}

input {
  min-height: 44px;
  padding: 10px 11px;
}

.field-error {
  margin-top: 6px;
  color: #a32323;
  font-size: 12px;
}

textarea {
  min-height: 170px;
  padding: 10px;
  resize: vertical;
  white-space: pre;
}

.item-photo-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.item-photo-row .primary-lite-button,
.item-photo-row .ghost-button {
  width: 100%;
  min-height: 42px;
}

.single-photo {
  min-height: 108px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #c9d5da;
  border-radius: 8px;
  background: #f7faf9;
}

.single-photo img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
  background: #eef2f4;
}

.scan-button,
.submit-button,
.primary-lite-button,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.scan-button,
.submit-button {
  background: var(--brand);
  color: #fff;
}

.scan-button {
  min-height: 44px;
}

.submit-button {
  width: 100%;
  min-height: 52px;
  margin: 14px 0;
  font-weight: 700;
}

.submit-button:disabled,
.group-start-button:disabled {
  background: #b8c2cc;
  color: #f3f6f8;
  cursor: not-allowed;
  box-shadow: none;
}

.primary-lite-button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--zkn-yellow);
  color: var(--brand-dark);
  font-weight: 700;
}

.ghost-button,
.icon-button {
  min-height: 36px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid rgba(0, 88, 170, 0.22);
  color: var(--brand-dark);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 20px;
}

.photo-section {
  margin-top: 14px;
}

.photo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fallback-photo-button {
  margin-top: 0;
}

.photo-actions .primary-lite-button,
.photo-actions .fallback-photo-button {
  min-height: 44px;
  width: 100%;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef2f4;
}

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

.remove-photo {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 32, 38, 0.74);
  color: #fff;
}

.submit-state {
  margin-bottom: 18px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--slate-200);
  background: #fff;
  color: var(--slate-500);
  font-size: 12.5px;
  line-height: 1.45;
}

.submit-state.ok {
  border-color: #a7f3d0;
  background: var(--green-soft);
  color: var(--ok);
  font-weight: 500;
}

.submit-state.warn {
  border-color: rgba(163, 90, 0, 0.45);
  color: var(--warn);
}

.submit-state.bad {
  border-color: rgba(180, 35, 24, 0.45);
  color: var(--bad);
}

.submit-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 32, 38, 0.36);
}

.submit-overlay-card {
  width: min(92vw, 390px);
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(220, 228, 232, 0.9);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.submit-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #d7e7e4;
  border-top-color: var(--brand);
  border-radius: 999px;
  animation: submit-spin 850ms linear infinite;
}

.submit-overlay-title {
  font-weight: 800;
}

.submit-overlay-text {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.scanner-dialog,
.camera-dialog,
.confirm-dialog {
  width: min(96vw, 680px);
  max-height: min(92vh, 760px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #11181d;
  color: #fff;
}

.scanner-dialog[open],
.camera-dialog[open],
.confirm-dialog[open] {
  display: flex;
  flex-direction: column;
}

.scanner-dialog::backdrop,
.camera-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.confirm-dialog {
  width: min(92vw, 420px);
  background: transparent;
  color: var(--ink);
}

.confirm-card {
  overflow: hidden;
  border: 1px solid rgba(220, 228, 232, 0.9);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.confirm-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: #f7faf9;
  border-bottom: 1px solid var(--line);
}

.confirm-title {
  font-size: 18px;
  font-weight: 800;
}

.confirm-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.confirm-close-button {
  flex: 0 0 auto;
}

.confirm-body {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  padding: 18px 16px;
}

.confirm-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fff0ec;
  color: var(--accent);
  font-weight: 900;
  font-size: 24px;
}

.confirm-body p {
  margin: 0;
  line-height: 1.55;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  padding: 0 16px 16px;
}

.confirm-actions .ghost-button,
.confirm-actions .submit-button {
  min-height: 48px;
  margin: 0;
}

.admin-alert-dialog {
  width: min(92vw, 440px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: transparent;
  color: var(--slate-900);
}

.login-dialog {
  width: min(92vw, 420px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: transparent;
  color: var(--slate-900);
  z-index: 80;
}

.login-dialog::backdrop {
  background: rgba(15, 23, 42, 0.24);
}

.admin-alert-dialog[open] {
  display: flex;
  flex-direction: column;
}

.admin-alert-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.admin-alert-card {
  overflow: hidden;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.22);
}

.admin-alert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 0.5px solid var(--slate-200);
  background: var(--slate-50);
}

.admin-alert-title {
  color: var(--slate-900);
  font-size: 17px;
  font-weight: 700;
}

.admin-alert-subtitle {
  margin-top: 4px;
  color: var(--slate-500);
  font-size: 12.5px;
  line-height: 1.45;
}

.admin-alert-body {
  padding: 16px 18px 4px;
  color: var(--slate-600);
  font-size: 13px;
  line-height: 1.6;
}

.admin-alert-body p {
  margin: 0 0 12px;
}

.admin-alert-list {
  display: grid;
  gap: 7px;
  max-height: 180px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.admin-alert-list li {
  padding: 8px 10px;
  border: 0.5px solid var(--amber-border);
  border-radius: var(--radius-md);
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 600;
}

.admin-alert-actions {
  display: flex;
  justify-content: flex-end;
  padding: 14px 18px 18px;
}

.admin-alert-actions .ghost-button {
  min-height: 34px;
}

.danger-button {
  background: var(--bad);
}

.danger-button:hover {
  background: #c8151d;
}

.scanner-head {
  padding: 10px 12px;
  background: #172026;
}

.scanner-stage {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #000;
}

.camera-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 280px;
  aspect-ratio: 3 / 4;
  background: #000;
}

#scannerVideo,
#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.debug-hud {
  display: none !important;
  position: absolute;
  left: 10px;
  top: 10px;
  width: min(220px, calc(100% - 20px));
  padding: 9px;
  border: 1px solid rgba(216, 227, 232, 0.22);
  border-radius: 8px;
  background: rgba(12, 19, 23, 0.62);
  color: #d8f7ef;
  font-size: 11px;
  line-height: 1.35;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.hud-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
}

.hud-row span {
  color: rgba(216, 247, 239, 0.68);
}

.hud-row strong {
  font-weight: 800;
}

.hud-log {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(216, 227, 232, 0.18);
  color: rgba(216, 247, 239, 0.78);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.hud-log div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scan-box {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 34%;
  height: 28%;
  border: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.24);
}

.scanner-state {
  margin: 0;
  padding: 10px 12px 14px;
  color: #d8e3e8;
}

.camera-actions {
  flex: 0 0 auto;
  padding: 12px;
  background: #172026;
}

.shutter-button {
  margin: 0;
  width: 100%;
}

.camera-head {
  min-height: 60px;
  padding: 10px 14px;
}

.camera-close-button {
  width: 57px;
  min-height: 54px;
  font-size: 30px;
}

.success-panel {
  min-height: calc(100vh - 28px);
  display: grid;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.success-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--zkn-yellow);
  color: var(--zkn-blue);
  font-size: 42px;
  font-weight: 800;
}

.success-panel p {
  margin: 0;
  color: var(--muted);
}

.login-body {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 0.5px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.login-body .dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--slate-200);
}

.login-body h2 {
  margin: 0;
  color: var(--slate-900);
  font-size: 22px;
  line-height: 1.2;
}

.login-body p {
  margin: 6px 0 0;
  color: var(--slate-500);
  font-size: 13px;
  line-height: 1.5;
}

.login-body label {
  display: grid;
  gap: 7px;
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 600;
}

.login-body input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--slate-50);
  color: var(--slate-900);
  outline: none;
}

.login-body input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 88, 170, 0.12);
}

.login-body .dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  padding-top: 2px;
}

.login-body .ghost-button,
.login-body .submit-button {
  min-height: 44px;
  margin: 0;
}

.admin-locked #adminLoginCloseButton,
.admin-locked #adminLoginCancelButton {
  display: none;
}

.admin-locked .login-body .dialog-actions {
  grid-template-columns: 1fr;
}

.admin-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 0.5px solid var(--slate-200);
}

.panel-subtitle {
  margin-top: 2px;
  color: var(--slate-400);
  font-size: 12.5px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions .submit-button,
.panel-actions .ghost-button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 14px;
}

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

.filter-label {
  color: var(--slate-600);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-block {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.add-item-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.6fr auto;
  gap: 10px;
  align-items: center;
}

.admin-form-band {
  padding: 14px 16px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: var(--slate-50);
}

.admin-form-band input {
  min-height: 36px;
  background: var(--panel);
  font-size: 13px;
}

.upload-row {
  gap: 10px;
}

.paste-import-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.paste-import-band textarea {
  min-height: 74px;
  padding: 10px 11px;
  border-color: var(--slate-200);
  background: var(--panel);
  color: var(--slate-700);
  font-size: 13px;
  white-space: pre;
  resize: vertical;
}

.paste-import-band .ghost-button {
  align-self: stretch;
}

.upload-row input[type="file"] {
  padding: 5px 11px;
  border: 0.5px solid var(--slate-200);
  background: var(--panel);
  color: var(--slate-600);
}

.upload-row input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 4px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  color: var(--slate-700);
  cursor: pointer;
}

.add-item-form .submit-button {
  width: auto;
  min-height: 38px;
  margin: 0;
  padding: 0 16px;
  font-size: 13px;
  white-space: nowrap;
}

.task-group-list {
  display: grid;
  gap: 14px;
  overflow-anchor: none;
}

.task-group-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: none;
  transition: border-color 0.15s;
}

.task-group-card:hover {
  border-color: var(--slate-300);
}

.task-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.task-group-head strong {
  color: var(--slate-800);
  font-size: 15px;
  font-weight: 600;
}

.task-group-head span {
  margin-left: 8px;
  color: var(--slate-400);
  font-size: 12.5px;
  font-weight: 450;
}

.task-group-head .submit-button,
.task-group-head .ghost-button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 14px;
  font-size: 12.5px;
}

.task-item-list {
  display: grid;
  gap: 8px;
}

.task-group-add-area {
  display: flex;
  justify-content: flex-start;
}

.add-item-inline {
  width: 34px;
  height: 30px;
  border: 0.5px solid var(--slate-300);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--blue-strong);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}

.add-item-inline:hover {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.task-item-row {
  display: grid;
  grid-template-columns: 52px 96px 1fr minmax(170px, 1.4fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 0.5px solid transparent;
  border-radius: var(--radius-md);
  background: var(--slate-50);
  transition:
    border-color 0.15s,
    background 0.15s;
}

.task-item-row:hover {
  border-color: var(--slate-200);
  background: var(--panel);
}

.add-task-item-row {
  width: 100%;
  border-color: var(--blue-border);
  background: var(--blue-soft);
}

.task-item-row input {
  min-height: 32px;
  padding: 4px 9px;
  border-color: var(--slate-200);
  background: var(--panel);
  font-size: 12.5px;
}

.task-item-index {
  color: var(--slate-400);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.task-item-row .submit-button {
  width: auto;
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  font-size: 12.5px;
}

.task-item-row .ghost-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.group-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.group-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--slate-600);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.group-filter:hover {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue);
}

.group-filter:has(input:checked) {
  border-color: var(--blue-border);
  background: var(--blue-soft);
  color: var(--blue-strong);
  font-weight: 600;
}

.group-filter input {
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  accent-color: var(--blue);
}

.admin-tools .submit-button {
  margin: 0;
}

.records-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 16px;
  align-content: start;
}

.empty-records {
  grid-column: 1 / -1;
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 0.5px dashed var(--slate-200);
  border-radius: var(--radius-lg);
  background: var(--slate-50);
  color: var(--slate-500);
  font-size: 13px;
}

.record-card {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 18px;
  padding: 16px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: none;
  transition:
    border-color 0.2s,
    transform 0.15s;
}

.record-card:hover {
  border-color: var(--slate-300);
  transform: translateY(-2px);
}

.record-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.record-name {
  min-width: 0;
  color: var(--slate-900);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.record-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.record-price {
  flex: 0 0 auto;
  padding: 3px 10px;
  border: 0.5px solid var(--amber-border);
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 14.5px;
  font-weight: 700;
}

.record-check input {
  width: 18px;
  min-height: 18px;
}

.record-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.record-grid label,
.record-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.record-grid label span,
.record-grid > div span {
  color: var(--slate-400);
  font-size: 11px;
  font-weight: 500;
}

.record-grid > div strong {
  padding: 5px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.record-meta span {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 12px;
  font-weight: 500;
}

.record-photo {
  width: 100%;
  height: 148px;
  object-fit: cover;
  display: block;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--slate-100);
}

.record-photo.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.record-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.record-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.record-actions .submit-button,
.record-actions .ghost-button {
  width: auto;
  min-height: 32px;
  margin: 0;
  padding: 0 11px;
  font-size: 13px;
}

@media (max-width: 430px) {
  .app-shell {
    padding: 10px;
  }

  .capture-layout {
    grid-template-columns: 80px 1fr;
  }

  .item-head {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr 74px;
  }

  .confirm-actions {
    grid-template-columns: 1fr;
  }

  .upload-row,
  .paste-import-band,
  .add-item-form,
  .filter-strip,
  .admin-tools,
  .record-grid,
  .record-actions,
  .task-item-row {
    grid-template-columns: 1fr;
  }

  .task-group-head {
    align-items: stretch;
    flex-direction: column;
  }

  .item-photo-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .admin-tab-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-tab-button {
    width: auto;
    border-bottom: 1px solid var(--line);
    border-radius: 12px;
    transform: none;
  }

  .admin-column-card {
    border-top-left-radius: var(--radius-xl);
    padding: 20px;
  }

  .admin-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-hero-actions {
    justify-content: flex-end;
  }

  .admin-login-required {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-login-required .ghost-button {
    width: 100%;
  }

  .admin-link-box {
    grid-template-columns: 1fr;
  }

  .admin-link-box .ghost-button,
  .admin-link-button {
    width: 100%;
  }

  .admin-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-actions {
    justify-content: stretch;
  }

  .panel-actions .submit-button,
  .panel-actions .ghost-button {
    width: 100%;
  }

  .records-list {
    grid-template-columns: 1fr;
  }

  .add-item-form {
    grid-template-columns: 1fr 1fr;
  }

  .record-card {
    grid-template-columns: 120px 1fr;
  }

  .record-photo {
    height: 130px;
  }
}

@media (max-width: 640px) {
  .admin-shell {
    padding: 10px;
  }

  .record-card {
    grid-template-columns: 1fr;
  }

  .upload-row,
  .paste-import-band,
  .add-item-form,
  .task-item-row {
    grid-template-columns: 1fr;
  }

  .task-item-index {
    text-align: left;
  }

  .task-group-head .submit-button {
    width: 100%;
  }

  .task-group-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .record-photo {
    height: 220px;
  }

  .record-title-row,
  .task-group-head {
    align-items: stretch;
    flex-direction: column;
  }

  .record-actions {
    justify-content: stretch;
  }

  .record-actions .submit-button,
  .record-actions .ghost-button {
    flex: 1;
  }
}

/* 竞对品牌管理 */
.brand-region-band {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.brand-region-band .band-label {
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 600;
}

.brand-region-band select {
  min-height: 38px;
  background: var(--panel);
  font-size: 13px;
}

.add-brand-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.add-brand-band input {
  min-height: 38px;
  background: var(--panel);
  font-size: 13px;
}

.add-brand-band .submit-button {
  width: auto;
  min-height: 38px;
  margin: 0;
  padding: 0 18px;
  font-size: 13px;
  white-space: nowrap;
}

.brand-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

#regionList {
  display: grid;
  gap: 10px;
}

.region-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: #fff;
}

.region-row.dragging {
  opacity: 0.62;
  border-color: var(--brand);
  box-shadow: 0 10px 26px rgba(0, 88, 170, 0.14);
}

.region-drag-handle {
  width: 32px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--slate-50);
  color: var(--slate-500);
  cursor: grab;
  font-size: 16px;
  line-height: 1;
}

.region-drag-handle:active {
  cursor: grabbing;
}

.region-row.paused {
  background: var(--slate-50);
}

.region-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.region-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.region-switch span {
  width: 46px;
  height: 26px;
  position: relative;
  border-radius: var(--radius-full);
  background: var(--slate-300);
  transition: background 0.15s;
}

.region-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s;
}

.region-switch input:checked + span {
  background: var(--ok);
}

.region-switch input:checked + span::after {
  transform: translateX(20px);
}

.region-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.region-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.region-title strong {
  color: var(--slate-800);
  font-size: 14px;
}

.region-title span {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--green-soft);
  color: var(--ok);
  font-size: 11px;
  font-weight: 700;
}

.region-row.paused .region-title span {
  background: var(--slate-100);
  color: var(--slate-500);
}

.region-link-input {
  min-height: 34px;
  border-color: var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 12.5px;
}

.region-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.region-actions .ghost-button,
.region-actions .submit-button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 12px;
  font-size: 12.5px;
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 14px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius-full);
  background: #fff;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 500;
}

.brand-chip button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.brand-chip button:hover {
  background: #fde2e2;
  color: var(--bad);
}

@media (max-width: 640px) {
  .add-brand-band {
    grid-template-columns: 1fr;
  }

  .region-row {
    grid-template-columns: auto 1fr;
  }

  .region-switch {
    grid-column: 1;
  }

  .region-main {
    grid-column: 2;
  }

  .region-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
