:root {
  --navy: #1B2A4A;
  --accent: #E89A2E;
  --accent-press: #D4891C;
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --label: #1A1A1A;
  --secondary: #5C6370;
  --tertiary: #8B919A;
  --success: #2E9B57;
  --danger: #C0392B;
  --packed: #2F6FED;
  --line: #E6E8EB;
  --fill: #EEF0F3;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #2C3B5C;
    --bg: #111318;
    --card: #1C2028;
    --label: #F2F2F7;
    --secondary: #AEB4BE;
    --tertiary: #8B919A;
    --line: #2A303A;
    --fill: #262B34;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: #D8DCE3;
  color: var(--label);
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  html, body { background: #0B0C0F; }
}
#app {
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { background: none; border: 0; }
a { color: var(--packed); text-decoration: none; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.top {
  background: var(--navy);
  color: #fff;
  min-height: 56px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.top .back {
  width: 44px; height: 44px; margin: -8px 0 -8px -8px;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 500;
}
.top .title { font-size: 17px; font-weight: 600; flex: 1; }
.top .sub { font-size: 13px; opacity: .72; font-weight: 400; }
.top .meta { margin-left: auto; text-align: right; font-size: 13px; opacity: .9; }
.body {
  flex: 1;
  padding: 12px 16px calc(24px + var(--tabbar) + var(--safe-bottom));
}
.body.no-tab { padding-bottom: 24px; }
.tabbar {
  position: fixed; left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--tabbar) + var(--safe-bottom));
  padding: 6px 8px var(--safe-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 44px; color: var(--tertiary); font-size: 11px;
}
.tab.on { color: var(--label); font-weight: 600; }
.tab svg { width: 22px; height: 22px; }

.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 48px; border-radius: 12px; font-size: 17px; font-weight: 600;
  width: 100%;
}
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--accent); color: #1A1408; }
.btn-primary:active { background: var(--accent-press); }
.btn-ghost { background: var(--card); color: var(--navy); border: 1px solid var(--line); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-sm { min-height: 44px; font-size: 15px; padding: 0 12px; width: auto; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; }
.tiny { color: var(--tertiary); font-size: 12px; }
.muted { color: var(--secondary); }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag-orange { background: #F8E4C4; color: #8A5A12; }
.tag-green { background: #D8F0E2; color: #1E6B3A; }
.tag-red { background: #F8D7D4; color: #8E261C; }
.tag-blue { background: #D9E6FB; color: #1D4EAF; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }

.pick-hero { padding: 28px 8px 18px; }
.pick-hero h1 { font-size: 28px; font-weight: 700; color: var(--navy); }
@media (prefers-color-scheme: dark) {
  .pick-hero h1 { color: #F2F2F7; }
}
.pick-hero p { margin-top: 6px; font-size: 16px; color: var(--secondary); }
.worker {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  min-height: 64px; margin-bottom: 10px; width: 100%; text-align: left;
}
.avatar {
  width: 44px; height: 44px; border-radius: 22px;
  background: var(--fill); color: var(--navy);
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.avatar.admin { background: #F8E4C4; color: #8A5A12; }
.worker .name { font-size: 17px; font-weight: 600; }

.cta { margin: 4px 0 12px; }
.stats { margin-bottom: 14px; color: var(--secondary); font-size: 13px; }
.stats b { color: var(--label); font-size: 15px; }
.sec-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 4px 0 8px;
}
.sec-h h3 { font-size: 15px; font-weight: 600; }
.order-card { margin-bottom: 10px; width: 100%; text-align: left; }
.order-card .row1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.code { font-size: 13px; color: var(--secondary); }
.prod { font-size: 17px; font-weight: 600; margin: 2px 0 4px; }
.kpis { display: flex; gap: 16px; margin-top: 10px; }
.kpis .k .v { font-size: 22px; font-weight: 700; line-height: 1.1; }
.kpis .k .l { font-size: 12px; color: var(--secondary); margin-top: 2px; }
.bar { height: 6px; background: var(--fill); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--navy); border-radius: 3px; }

.hero-prod { font-size: 22px; font-weight: 700; color: var(--navy); }
@media (prefers-color-scheme: dark) {
  .hero-prod { color: #F2F2F7; }
}
.spec { font-size: 15px; color: var(--secondary); margin: 2px 0 8px; }
.meta-line { font-size: 14px; color: var(--secondary); display: flex; flex-wrap: wrap; gap: 8px 14px; }
.price { margin-top: 8px; font-size: 15px; font-weight: 600; }
.piles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.pile {
  background: var(--card); border-radius: 12px; padding: 10px 8px 12px; text-align: center;
}
.pile .v { font-size: 26px; font-weight: 700; line-height: 1.15; }
.pile .l { font-size: 12px; color: var(--secondary); margin-top: 2px; }
.pile.ww .v { color: var(--accent); }
.pile.pk .v { color: var(--packed); }
.plist { background: var(--card); border-radius: 12px; overflow: hidden; }
.prow {
  display: flex; align-items: center; min-height: 44px;
  padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 15px; width: 100%;
  background: transparent; text-align: left;
}
.prow:last-child { border-bottom: none; }
.prow .nm { flex: 1; }
.prow .frac { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--secondary); }
.prow.done .frac { color: var(--success); }
.prow.now { background: #FFF7EA; }
@media (prefers-color-scheme: dark) {
  .prow.now { background: #3A2E1A; }
}
.prow.now .nm { font-weight: 700; }
.fork {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 8px 12px; background: var(--fill); border-bottom: 1px solid var(--line);
}
.lot { background: var(--card); border-radius: 12px; padding: 12px; margin-top: 10px; }
.lot h4 { font-size: 15px; margin-bottom: 6px; }
.sticky-cta { margin-top: 16px; }

.lock {
  background: var(--card); border-radius: 12px; padding: 12px 14px;
  display: flex; align-items: center; gap: 8px; min-height: 52px; width: 100%;
}
.lock .chg { margin-left: auto; color: var(--packed); font-size: 14px; font-weight: 600; min-height: 44px; display: grid; place-items: center; }
.grid10 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 10px 0; }
.pbtn {
  min-height: 52px; border-radius: 10px; background: var(--card);
  display: grid; place-items: center; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line);
}
.pbtn.on { background: var(--accent); border-color: var(--accent); color: #1A1408; }
.qtybox { background: var(--card); border-radius: 12px; padding: 10px 12px 14px; margin: 8px 0; }
.qtyrow { display: flex; align-items: center; justify-content: center; gap: 18px; }
.qbtn {
  width: 48px; height: 48px; border-radius: 24px; background: var(--fill);
  display: grid; place-items: center; font-size: 24px; font-weight: 500;
}
.qval {
  font-size: 40px; font-weight: 700; min-width: 72px; text-align: center;
  background: transparent; border: 0; width: 96px;
}
.cam {
  background: var(--card); border-radius: 12px; min-height: 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border: 1.5px dashed #C9CDD4; color: var(--secondary); margin: 8px 0 10px;
  width: 100%; position: relative; overflow: hidden;
}
.cam b { color: var(--label); font-size: 16px; }
.cam input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cam img { width: 100%; height: 140px; object-fit: cover; display: block; }
.hint { font-size: 13px; color: #8A5A12; background: #FFF7EA; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.warn { color: var(--danger); font-size: 13px; margin-top: 6px; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(80px + var(--safe-bottom));
  background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 14px;
  font-size: 15px; z-index: 20; text-align: center;
}
.field { margin-top: 8px; }
.field label { display: block; font-size: 13px; color: var(--secondary); margin-bottom: 6px; }
.input, .select {
  width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); padding: 0 12px; font-size: 16px; color: var(--label);
}
.search {
  min-height: 44px; background: var(--card); border-radius: 10px;
  display: flex; align-items: center; padding: 0 12px; margin-bottom: 12px;
  border: 1px solid var(--line);
}
.search input { border: 0; background: transparent; width: 100%; min-height: 44px; outline: none; }
.sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30;
  display: flex; align-items: flex-end;
}
.sheet .panel {
  background: var(--bg); width: 100%; max-height: 80dvh; overflow: auto;
  border-radius: 16px 16px 0 0; padding: 12px 16px calc(16px + var(--safe-bottom));
}
.hidden { display: none !important; }
.photo-thumb { width: 100%; border-radius: 10px; margin-top: 8px; }
.me-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; background: var(--card); border-radius: 12px; padding: 0 14px; margin-bottom: 8px;
  width: 100%; text-align: left;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
