:root {
  --bg: #f6f7f8; --card: #fff; --text: #1d2327; --muted: #5f6b73;
  --accent: #1f6f8b; --accent-text: #fff; --line: #dde2e5; --mark: #e8590c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181b; --card: #1e2428; --text: #e7ecef; --muted: #9aa7b0;
    --accent: #4fa3c4; --accent-text: #0b1a20; --line: #2f383e; --mark: #ff8a3d;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--accent); color: var(--accent-text);
}
header h1 { margin: 0; font-size: 20px; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h2 { font-size: 17px; margin: 28px 0 8px; }
button, .file { font: inherit; cursor: pointer; }
.icon { background: none; border: 0; color: inherit; font-size: 28px; line-height: 1; padding: 0 6px; }
.primary {
  display: block; width: 100%; text-align: center; margin: 10px 0; padding: 14px;
  border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-weight: 600;
}
.primary:disabled { opacity: .5; }
.tile {
  display: grid; gap: 2px; width: 100%; text-align: left; padding: 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.tile-emoji { font-size: 32px; }
.tile-name { font-size: 20px; font-weight: 700; }
.tile-sub { color: var(--muted); }
.primary.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
input[type=search], input.text, select {
  width: 100%; padding: 12px; font: inherit; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; color: var(--muted); }
.where { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.where label { display: grid; gap: 4px; color: var(--muted); }
.list { list-style: none; padding: 0; margin: 0; }
.list li, .result {
  padding: 12px; margin: 6px 0; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
}
.list li { cursor: pointer; }
.list.small li { padding: 6px 10px; margin: 3px 0; cursor: default; font-size: 15px; }
ol.list.small { list-style: decimal inside; }
.result h3 { margin: 0 0 4px; font-size: 17px; }
.copy { display: block; width: 100%; text-align: left; margin-top: 6px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.muted, .note { color: var(--muted); font-size: 14px; }
.tag { font-size: 12px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); }
.low { opacity: .7; }
.status { font-weight: 600; }
.status.error { color: #c92a2a; }
#preview-wrap, #photo-wrap { position: relative; margin: 8px 0; }
#preview, #row-img { display: block; width: 100%; border-radius: 8px; }
.field { display: grid; gap: 4px; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 22px; }
#lines { position: absolute; inset: 0; }
.shelf-line { position: absolute; left: 0; right: 0; height: 28px; margin-top: -14px; cursor: ns-resize; touch-action: none; }
.shelf-line::after { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 4px;
  background: var(--mark); box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.shelf-num { position: absolute; left: 6px; padding: 0 7px; border-radius: 6px; font-weight: 700;
  background: var(--mark); color: #fff; font-size: 14px; pointer-events: none; transform: translateY(-50%); }
.shade-out { position: absolute; left: 0; right: 0; background: rgba(0,0,0,.55); pointer-events: none; }
#marker {
  position: absolute; top: 0; bottom: 0; border: 3px solid var(--mark); border-radius: 6px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none;
}
