:root {
  --brand: #1a4d8f;
  --brand-dark: #133c70;
  --brand-light: #eaf1fa;
  --ok: #17a34a;
  --warn: #f59e0b;
  --danger: #e11d48;
  --gray: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f9;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; padding-bottom: 76px;
}
a { color: var(--brand); text-decoration: none; }
.hide { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  padding: 12px 14px; display: flex; align-items: center; gap: 8px;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; flex: 1; }
.topbar .back { color: #fff; font-size: 20px; line-height: 1; }
.topbar .act { color: #fff; font-size: 14px; }

.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 47px; z-index: 19; }
.tabs div { flex: 1; text-align: center; padding: 11px 0; font-size: 14px; color: var(--gray); }
.tabs div.on { color: var(--brand); font-weight: 600; border-bottom: 2px solid var(--brand); }

.wrap { padding: 12px; }
.card { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card h3 .tag { font-size: 12px; color: var(--gray); font-weight: 400; }

label.f { display: block; margin-bottom: 12px; }
label.f .lb { display: block; font-size: 13px; color: #374151; margin-bottom: 5px; }
label.f .lb i { color: var(--danger); font-style: normal; }
input.f, select.f, textarea.f {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px;
  font-size: 15px; background: #fff; color: #1f2937; outline: none; font-family: inherit;
}
input.f:focus, select.f:focus, textarea.f:focus { border-color: var(--brand); }
textarea.f { min-height: 76px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--gray); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: #374151;
  border-radius: 8px; padding: 10px 14px; font-size: 15px; cursor: pointer; font-family: inherit;
}
.btn:active { opacity: .7; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: #fecdd3; }
.btn.ghost { background: #f9fafb; }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; gap: 10px; padding: 10px 12px; z-index: 30; padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.bottombar .btn { flex: 1; }

.imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.imgs .it { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #f3f4f6; }
.imgs .it img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgs .it .main { position: absolute; left: 0; top: 0; background: var(--brand); color: #fff; font-size: 11px; padding: 1px 5px; border-radius: 0 0 6px 0; }
.imgs .it .op { position: absolute; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.5); display: flex; }
.imgs .it .op span { flex: 1; text-align: center; color: #fff; font-size: 12px; padding: 3px 0; }
.imgs .add {
  aspect-ratio: 1; border: 1px dashed var(--line); border-radius: 8px; display: flex;
  align-items: center; justify-content: center; color: var(--gray); font-size: 26px; background: #fafafa;
}

.prodcard { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.prodcard .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.prodcard .hd b { flex: 1; font-size: 15px; }
.prodcard .pv { display: flex; gap: 8px; align-items: center; }
.prodcard .pv img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: #f3f4f6; }
.prodcard .pv .meta { flex: 1; font-size: 13px; color: var(--gray); min-width: 0; }
.prodcard .pv .meta div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); border-radius: 14px; padding: 5px 11px; font-size: 13px;
  background: #fff; color: #374151; cursor: pointer;
}
.chip.on { background: var(--brand-light); border-color: var(--brand); color: var(--brand); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #f3f4f6; color: var(--gray); }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.info { background: var(--brand-light); color: var(--brand); }

.err { background: #fee2e2; color: #b91c1c; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.err ul { margin: 4px 0 0; padding-left: 18px; }
.okbox { text-align: center; padding: 26px 12px; }
.okbox .ic { font-size: 44px; color: var(--ok); }
.okbox h2 { margin: 10px 0 4px; font-size: 17px; }
.okbox .no { font-size: 20px; font-weight: 700; color: var(--brand); letter-spacing: 1px; }

.list-item { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.list-item .t { display: flex; gap: 10px; align-items: center; }
.list-item .t img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; background: #f3f4f6; }
.list-item .t .m { flex: 1; min-width: 0; }
.list-item .t .m b { font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .t .m span { font-size: 12px; color: var(--gray); }

.empty { text-align: center; color: var(--gray); padding: 50px 20px; font-size: 14px; }
.prog { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin: 6px 0; }
.prog i { display: block; height: 100%; background: var(--brand); }
.toast {
  position: fixed; left: 50%; top: 40%; transform: translateX(-50%); background: rgba(0,0,0,.8);
  color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 99; max-width: 80%;
}
.loading { text-align: center; color: var(--gray); padding: 30px; font-size: 14px; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--gray); }
