:root {
  color-scheme: light;
  --ink: #17342e;
  --muted: #698078;
  --line: #d9e2dd;
  --paper: #ffffff;
  --canvas: #f3f6f2;
  --brand: #0c6b58;
  --brand-strong: #084f42;
  --brand-soft: #dff2ea;
  --accent: #f4a340;
  --danger: #b83b35;
  --danger-soft: #fff0ee;
  --warn: #8a5a12;
  --warn-soft: #fff4d9;
  --shadow: 0 16px 40px rgba(27, 66, 56, 0.09);
  --radius: 20px;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, rgba(12, 107, 88, 0.11), transparent 34rem),
    var(--canvas);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}

.boot-mark,
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: white;
  background: var(--brand);
  font-size: 23px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.app-shell { min-height: 100vh; padding-bottom: 88px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  background: rgba(243, 246, 242, 0.92);
  border-bottom: 1px solid rgba(217, 226, 221, 0.78);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 18px; box-shadow: none; }
.brand strong { display: block; font-size: 16px; }
.brand small { display: block; color: var(--muted); margin-top: 2px; white-space: nowrap; }

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.network-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.network-pill.offline .network-dot { background: var(--accent); }

.page { width: min(980px, 100%); margin: 0 auto; padding: 22px 18px 28px; }

.hero {
  padding: 24px;
  border-radius: 26px;
  color: white;
  background:
    linear-gradient(135deg, rgba(255,255,255,.12), transparent 45%),
    linear-gradient(135deg, var(--brand-strong), var(--brand));
  box-shadow: var(--shadow);
}

.hero h1 { margin: 0 0 8px; font-size: clamp(25px, 6vw, 38px); letter-spacing: -0.04em; }
.hero p { margin: 0; color: rgba(255,255,255,.8); line-height: 1.65; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.hero-stat { padding: 12px; border-radius: 15px; background: rgba(255,255,255,.12); }
.hero-stat strong { display: block; font-size: 22px; }
.hero-stat span { font-size: 12px; color: rgba(255,255,255,.72); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 26px 2px 12px; }
.section-head h2 { margin: 0; font-size: 19px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.task-list, .sku-list, .event-list { display: grid; gap: 12px; }

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(27, 66, 56, 0.04);
}

.task-card { position: relative; overflow: hidden; }
.task-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--brand); }
.task-card[data-status="available"]::before { background: var(--accent); }
.task-top, .row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.task-card h3 { margin: 0; font-size: 17px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 9px; color: var(--muted); font-size: 13px; }
.code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: .02em; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.neutral { color: #52655f; background: #edf1ef; }

.progress-track { height: 7px; margin-top: 16px; overflow: hidden; border-radius: 999px; background: #e8eeeb; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--brand); transition: width .25s ease; }
.progress-copy { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 12px; }

.btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: white;
  background: var(--brand);
  font-weight: 700;
  box-shadow: none;
}
.btn:hover { background: var(--brand-strong); }
.btn.secondary { color: var(--ink); border-color: var(--line); background: var(--paper); }
.btn.secondary:hover { background: #edf3f0; }
.btn.ghost { color: var(--brand); background: transparent; }
.btn.danger { color: var(--danger); border-color: #efc7c3; background: var(--danger-soft); }
.btn.small { min-height: 36px; padding: 7px 11px; border-radius: 11px; font-size: 13px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--brand); background: none; border: 0; padding: 0; font-weight: 700; }
.detail-title h1 { margin: 0; font-size: 24px; }
.detail-title p { margin: 7px 0 0; color: var(--muted); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.summary-item { padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: #fbfcfb; }
.summary-item strong { display: block; font-size: 20px; }
.summary-item span { color: var(--muted); font-size: 12px; }

.search-box { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--paper); outline: none; }
.search-box:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,107,88,.12); }

.sku-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.sku-card h3 { margin: 0; font-size: 16px; }
.sku-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.capture-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.capture-dot { padding: 5px 8px; border-radius: 9px; background: #edf1ef; color: #61736d; font-size: 11px; }
.capture-dot.ok { color: var(--brand-strong); background: var(--brand-soft); }

.capture-header { padding: 20px; border-radius: 22px; color: white; background: var(--brand-strong); }
.capture-header h1 { margin: 0; font-size: 25px; }
.capture-header p { margin: 8px 0 0; color: rgba(255,255,255,.72); }
.requirement-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.requirement { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.requirement strong { display: block; font-size: 23px; margin-top: 5px; }
.requirement small { color: var(--muted); }
.requirement.required { border-color: #a8d2c3; background: #f4fbf8; }

.primary-scan {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 16px;
  border: 0;
  border-radius: 19px;
  color: white;
  text-align: left;
  background: var(--brand);
}
.scan-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: rgba(255,255,255,.14); font-size: 25px; }
.primary-scan strong { display: block; font-size: 17px; }
.primary-scan small { color: rgba(255,255,255,.72); }

.media-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.media-action { min-height: 82px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--paper); font-weight: 700; }
.media-action span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 13px; background: #dfe7e3; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb-label { position: absolute; inset: auto 5px 5px; padding: 3px 5px; border-radius: 6px; color: white; background: rgba(8,40,34,.72); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.alert { padding: 13px 14px; border-radius: 14px; color: var(--brand-strong); background: var(--brand-soft); line-height: 1.55; font-size: 13px; }
.alert.warn { color: var(--warn); background: var(--warn-soft); }
.alert.danger { color: var(--danger); background: var(--danger-soft); }

.upload-card .upload-numbers { display: flex; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.upload-card .upload-numbers strong { color: var(--ink); font-size: 17px; }

.bottom-nav {
  position: fixed;
  z-index: 25;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(18px);
}
.nav-btn { min-height: 54px; border: 0; border-radius: 14px; color: var(--muted); background: transparent; font-size: 12px; }
.nav-btn span { display: block; margin-bottom: 3px; font-size: 20px; }
.nav-btn.active { color: var(--brand); background: var(--brand-soft); font-weight: 700; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.95); box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 20px; }
.login-card h1 { margin: 0; font-size: 28px; }
.login-card > p { color: var(--muted); line-height: 1.65; }
.field { display: grid; gap: 7px; margin-top: 14px; }
.field label { font-size: 13px; font-weight: 700; }
.field input, .field textarea { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 13px; outline: none; }
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,107,88,.12); }
.login-card .btn { width: 100%; margin-top: 18px; }
.demo-hint { margin-top: 15px; padding: 11px 12px; border-radius: 12px; color: var(--muted); background: #f0f4f2; font-size: 12px; }

.scanner-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  color: white;
  background: #061613;
}
.scanner-top { display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) 16px 12px; }
.scanner-close { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.22); border-radius: 13px; color: white; background: rgba(255,255,255,.09); font-size: 20px; }
.scanner-stage { position: relative; display: grid; place-items: center; overflow: hidden; }
.scanner-stage video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; width: min(78vw, 470px); aspect-ratio: 1.7; border: 3px solid rgba(255,255,255,.92); border-radius: 20px; box-shadow: 0 0 0 999px rgba(0,0,0,.38); }
.scanner-frame::before, .scanner-frame::after { content: ""; position: absolute; left: 9%; right: 9%; height: 2px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.scanner-frame::before { top: 48%; }
.scanner-frame::after { display: none; }
.scanner-status { position: absolute; inset: auto 16px 16px; padding: 12px; border-radius: 13px; text-align: center; background: rgba(0,0,0,.58); }
.scanner-status.success { background: rgba(12,107,88,.9); }
.scanner-status.error { background: rgba(184,59,53,.92); }
.scanner-controls { padding: 14px 16px max(16px, env(safe-area-inset-bottom)); background: #0a211c; }
.scanner-progress { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; font-size: 12px; }
.scanner-progress span { padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.09); }
.manual-scan { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.manual-scan input { min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; color: white; background: rgba(255,255,255,.08); }
.manual-scan .btn { background: white; color: var(--brand-strong); }

.toast-region { position: fixed; z-index: 120; left: 50%; bottom: 86px; width: min(420px, calc(100% - 32px)); transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 12px 14px; border-radius: 13px; color: white; background: rgba(19,52,46,.94); box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.error { background: rgba(151,43,38,.96); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.empty { padding: 32px 20px; border: 1px dashed #cbd8d2; border-radius: var(--radius); text-align: center; color: var(--muted); background: rgba(255,255,255,.56); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.spacer-8 { height: 8px; }
.spacer-16 { height: 16px; }

@media (min-width: 760px) {
  .task-list { grid-template-columns: 1fr 1fr; }
  .sku-list { grid-template-columns: 1fr 1fr; }
  .gallery { grid-template-columns: repeat(6, 1fr); }
  .bottom-nav { left: 50%; right: auto; bottom: 12px; width: 420px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
  .app-shell { padding-bottom: 106px; }
}

@media (max-width: 520px) {
  .hero { padding: 21px 18px; }
  .hero-stats { gap: 7px; }
  .hero-stat { padding: 10px 8px; }
  .hero-stat strong { font-size: 19px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .sku-card { grid-template-columns: 1fr; }
  .sku-card .btn { width: 100%; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .page { padding-left: 14px; padding-right: 14px; }
}
