:root {
  --green: #0b4d32;
  --green-2: #13663f;
  --green-tint: #e8f1ec;
  --ink: #1b1f1d;
  --muted: #5f6b65;
  --line: #d9e0dc;
  --bg: #f6f7f6;
  --card: #fff;
  --warn: #9a5b00;
  --warn-bg: #fff4e0;
  --bad: #a3261b;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--green-2); }
header.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--green); color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
header.bar h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: .2px; flex: 1; }
header.bar h1 a { color: inherit; text-decoration: none; }
header.bar .links a, header.bar .links button { color: #fff; font-size: 14px; opacity: .9; background: none; border: 0; padding: 4px 0 4px 12px; cursor: pointer; }
main { max-width: 760px; margin: 0 auto; padding: 14px 14px 80px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
input, textarea, select {
  font: inherit; font-size: 17px; width: 100%;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--green-2); outline-offset: 0; border-color: transparent; }
label.lbl { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
button, .btn {
  font: inherit; font-size: 16px; font-weight: 600;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--green);
  background: var(--green); color: #fff; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
button.secondary, .btn.secondary { background: #fff; color: var(--green); }
button.ghost { background: none; border-color: transparent; color: var(--green-2); padding: 6px 4px; font-weight: 500; font-size: 14px; }
button.small { font-size: 13px; padding: 6px 10px; }
button.danger { background: #fff; color: var(--bad); border-color: #e3b7b2; }
button:disabled { opacity: .5; cursor: default; }
.block { width: 100%; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.hidden { display: none !important; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.error { color: var(--bad); font-size: 14px; margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--green-tint); color: var(--green); border: 1px solid #c9ddd2; border-radius: 999px; padding: 6px 10px; font-size: 14px; font-weight: 600; }
.chip.off { background: #fff; color: var(--muted); border-color: var(--line); text-decoration: line-through; font-weight: 500; }

/* lookup */
.sku-title { font-size: 22px; font-weight: 700; margin: 0; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.mainphoto { width: 100%; border-radius: 10px; background: #eef1ef; display: block; aspect-ratio: 4 / 3; object-fit: contain; cursor: zoom-in; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; }
.strip img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; flex: none; cursor: pointer; background: #eef1ef; }
.strip img.active { border-color: var(--green-2); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0 0; font-size: 15px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }
.result { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.result:first-child { border-top: 0; }
.result img, .result .noimg { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; background: #eef1ef; }
.result .noimg { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-align: center; }
.result .t { font-weight: 650; }
.nb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 8px; }
.nb { cursor: pointer; font-size: 13px; }
.nb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #eef1ef; display: block; }
.nb b { display: block; margin-top: 4px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; }
.lightbox button { position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 10px; }
.photo-tools { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* upload */
.tabs { display: flex; gap: 6px; margin: 4px 0 8px; }
.tabs button { flex: 1; background: #fff; color: var(--green); }
.tabs button.on { background: var(--green); color: #fff; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { position: relative; width: 88px; }
.thumb img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; display: block; background: #eef1ef; }
.thumb .x { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; padding: 0; border-radius: 50%; font-size: 15px; line-height: 1; }
.badge { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.92); color: var(--ink); }
.badge.tag { background: var(--green); color: #fff; }
.badge.skip { background: #777; color: #fff; }
.thumb.skip img { opacity: .35; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.fields .wide { grid-column: 1 / -1; }
.group { border-left: 4px solid var(--green-2); }
.group.bad { border-left-color: var(--bad); }
.progress { height: 8px; background: #e3e8e5; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; width: 0; background: var(--green-2); transition: width .2s; }
details summary { cursor: pointer; color: var(--green-2); font-size: 14px; margin-top: 8px; }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translateX(-50%) translateY(20px);
  background: #222; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; opacity: 0; transition: all .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
