:root {
  color-scheme: dark;
  --bg: #070707;
  --panel: #121212;
  --panel-2: #1b1b1b;
  --line: #303030;
  --text: #f6f2e9;
  --muted: #9e9a92;
  --orange: #ffad00;
  --red: #ef3732;
  --green: #62c66b;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.inventory-app { width: min(100%, 680px); min-height: 100vh; margin: 0 auto; padding: 12px; overflow: hidden; }
.inventory-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inventory-brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 850; }
.inventory-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--orange); color: #111; font-weight: 950; transform: rotate(-3deg); }
.inventory-location { display: grid; justify-items: end; gap: 3px; color: var(--muted); font-size: 10px; }
.inventory-location select { max-width: 220px; border: 0; border-radius: 8px; padding: 6px 8px; background: var(--orange); color: #17120a; font-weight: 800; }
.inventory-search { position: relative; margin-top: 11px; border-radius: 12px; background: #f5f3ee; color: #151515; }
.inventory-search label { position: absolute; left: 13px; top: 7px; color: #776f62; font-size: 10px; }
.inventory-search input { width: 100%; min-height: 58px; padding: 22px 52px 7px 13px; border: 0; outline: 0; background: transparent; color: #111; }
.inventory-search button { position: absolute; top: 7px; right: 7px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: #171717; color: var(--orange); font-size: 20px; }
.search-results { position: absolute; z-index: 30; width: min(calc(100% - 24px), 656px); max-height: 45vh; overflow: auto; margin-top: 5px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #171717; box-shadow: 0 18px 45px rgba(0,0,0,.5); }
.search-result { display: grid; width: 100%; gap: 3px; padding: 11px; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.search-result:hover { background: rgba(255,173,0,.12); }
.search-result span { color: var(--muted); font-size: 11px; }
.camera-region { position: relative; height: clamp(210px, 31vh, 320px); min-height: 0; margin-top: 11px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg,#242424,#0f0f0f 52%,#342a17); transition: min-height .24s ease, height .24s ease, opacity .18s ease, border-width .24s ease; }
.camera-region video { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.camera-line { position: absolute; left: 14%; right: 14%; top: 49%; height: 2px; background: var(--orange); box-shadow: 0 0 12px var(--orange); }
.camera-region p { position: absolute; left: 50%; bottom: 11px; margin: 0; transform: translateX(-50%); padding: 6px 9px; border-radius: 8px; background: rgba(0,0,0,.76); white-space: nowrap; font-size: 11px; }
.camera-region.is-success { border-color: rgba(98,198,107,.75); box-shadow: inset 0 0 20px rgba(98,198,107,.25), 0 0 14px rgba(98,198,107,.3); }
.camera-region.is-success .camera-line { background: var(--green); box-shadow: 0 0 12px var(--green); }
.inventory-sheet { position: relative; margin-top: 10px; padding-top: 10px; }
.inventory-app[data-sheet-state="list"] .camera-region { min-height: 0; height: 0; margin-top: 5px; opacity: 0; border-width: 0; }
.inventory-app[data-sheet-state="list"] .inventory-list { max-height: calc(100vh - 260px); }
.sheet-handle { position: relative; display: flex; justify-content: space-between; width: 100%; padding: 13px 0 8px; border: 0; background: transparent; font-weight: 850; }
.sheet-handle::before { content: ""; position: absolute; left: 50%; top: 2px; width: 42px; height: 4px; border-radius: 99px; background: #6b6b6b; transform: translateX(-50%); }
.sheet-handle b { color: var(--orange); font-size: 11px; }
.inventory-list { display: grid; gap: 7px; max-height: 36vh; overflow: auto; }
.inventory-empty { padding: 26px 12px; color: var(--muted); text-align: center; }
.inventory-card { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); transition: border-color .2s, box-shadow .2s; }
.inventory-card.is-touched { border-color: var(--green); box-shadow: 0 0 16px rgba(98,198,107,.28); }
.inventory-card__image { width: 54px; height: 54px; border-radius: 8px; background: #f4f2ed; object-fit: contain; }
.inventory-card__copy { min-width: 0; }
.inventory-card__copy strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.inventory-card__meta { margin-top: 4px; color: var(--muted); font-size: 10px; }
.expected-value { color: var(--orange); }
.stock-warning { display: block; margin-top: 3px; color: #ff8d89; font-size: 9px; }
.quantity-controls { display: flex; align-items: center; gap: 5px; margin-top: 7px; }
.quantity-button, .card-menu { border: 0; border-radius: 7px; background: var(--panel-2); }
.quantity-button { width: 28px; height: 26px; }
.quantity-controls input { width: 74px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: #090909; color: var(--orange); text-align: center; font-weight: 900; }
.card-menu { align-self: start; width: 32px; height: 32px; color: var(--muted); }
.inventory-actions { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 7px; margin-top: 11px; }
.button { min-height: 42px; border-radius: 10px; font-weight: 850; }
.button.primary { border: 0; background: var(--orange); color: #17120a; }
.button.secondary { border: 1px solid var(--orange); background: transparent; color: var(--orange); }
.button.danger { border: 1px solid #67302e; background: #2b1413; color: #ff8d89; }
.manual-copy { position: fixed; inset: 12px; z-index: 90; width: calc(100% - 24px); padding: 16px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 18px; max-width: calc(100% - 24px); padding: 10px 14px; border-radius: 9px; background: #282828; transform: translateX(-50%); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.install-prompt { position: fixed; z-index: 80; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--orange); border-radius: 13px; background: #171717; }
.install-prompt p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.scan-error { position: fixed; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 22px; background: var(--red); color: #fff; text-align: center; }
.scan-error strong { font-size: clamp(26px, 8vw, 48px); }
.scan-error small { margin-top: 20px; }
.stale-dialog { width: min(430px, calc(100% - 28px)); border: 1px solid var(--orange); border-radius: 14px; background: #171717; color: var(--text); box-shadow: 0 22px 70px rgba(0,0,0,.65); }
.stale-dialog::backdrop { background: rgba(0,0,0,.78); }
.stale-dialog p { color: var(--muted); line-height: 1.45; }
.stale-dialog div { display: grid; gap: 8px; }
.stale-dialog button { min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.stale-dialog button:first-child { border-color: var(--orange); color: var(--orange); }

@media (max-width: 440px) {
  .inventory-brand > span:last-child { font-size: 12px; }
  .inventory-location select { max-width: 170px; font-size: 10px; }
  .inventory-actions { grid-template-columns: 1fr 1fr; }
  .button.danger { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .camera-region, .inventory-card { transition: none; }
}
