:root {
  --bg: #111; --panel: #1c1c1e; --line: #2c2c2e; --text: #f2f2f2; --muted: #9a9a9e;
  --accent: #ff5a1f; --accent-2: #2f7bff; --ok: #35c46a; --danger: #ff4444;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { display: flex; flex-direction: column; height: 100dvh; }
button { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; flex: 1; }
button.danger { color: var(--danger); }
button.icon { padding: 8px 12px; font-size: 18px; line-height: 1; position: relative; }
button.close { font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; padding: 30px 16px; }

#top { display: flex; align-items: center; gap: 8px; padding: calc(var(--sat) + 8px) calc(var(--sar) + 12px) 8px calc(var(--sal) + 12px); background: var(--bg); border-bottom: 1px solid var(--line); }
#truck-name { flex: 1; font-weight: 700; font-size: 17px; }
.badge { position: absolute; top: -6px; right: -6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 6px; }

#views { display: flex; gap: 6px; padding: 8px calc(var(--sar) + 12px) 8px calc(var(--sal) + 12px); overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; }
#views::-webkit-scrollbar { display: none; }
#views button { white-space: nowrap; padding: 7px 12px; border-radius: 999px; font-size: 14px; }
#views button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

#viewport { flex: 1; position: relative; overflow: hidden; background: #fff; touch-action: none; user-select: none; }
#stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#diagram { display: block; pointer-events: none; }
#hotspots { position: absolute; inset: 0; }
.hot { position: absolute; border: 2px solid rgba(47,123,255,.55); border-radius: 4px; background: rgba(47,123,255,.06); }
.hot.hw { border-color: rgba(120,120,120,.5); background: rgba(120,120,120,.06); }
.hot.inbom { border-color: var(--ok); background: rgba(53,196,106,.15); }
.hot.selected { border-color: var(--accent); background: rgba(255,90,31,.22); border-width: 3px; }
.hot.hit { border-color: #c800ff; background: rgba(200,0,255,.18); }
#hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; pointer-events: none; transition: opacity .5s; }

.panel { position: fixed; left: 0; right: 0; bottom: 0; max-height: 70vh; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0; padding: 6px calc(var(--sar) + 16px) calc(var(--sab) + 14px) calc(var(--sal) + 16px); box-shadow: 0 -8px 30px rgba(0,0,0,.5); z-index: 20; }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.part-big { font-size: 28px; font-weight: 800; letter-spacing: .5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; }
.chip.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.chip .opt { color: var(--muted); font-size: 11px; margin-left: 4px; }
.chip.active .opt { color: #dfe9ff; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.stepper { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { border: 0; border-radius: 0; padding: 10px 14px; font-size: 18px; }
.stepper input { width: 52px; text-align: center; background: var(--bg); color: var(--text); border: 0; font: inherit; font-size: 16px; }
.stepper input::-webkit-inner-spin-button { display: none; }
.loc-link { color: var(--accent-2); text-decoration: underline; cursor: pointer; }

.overlay { position: fixed; inset: 0; background: var(--bg); z-index: 30; display: flex; flex-direction: column; padding: var(--sat) var(--sar) 0 var(--sal); }
.overlay-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.overlay-head h2 { flex: 1; margin: 0; font-size: 18px; }
.overlay-head input { flex: 1; font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.list li .main { flex: 1; min-width: 0; }
.list li .pn { font-weight: 700; font-size: 17px; }
.list li .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list li .qty { font-weight: 700; min-width: 34px; text-align: center; }
.list li button { padding: 6px 10px; }
.bom-actions { display: flex; gap: 8px; padding: 10px 12px calc(var(--sab) + 10px); border-top: 1px solid var(--line); background: var(--panel); }
.bom-actions button { flex: 1; }
#toast { position: fixed; bottom: calc(var(--sab) + 90px); left: 50%; transform: translateX(-50%); background: #333; color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 50; font-size: 14px; }

.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.list.stores { flex: none; }
.section-title { margin: 18px 14px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.list li.group { background: var(--panel); padding: 8px 14px; font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.list li.store .main .pn { font-size: 16px; }
.list li.store .sub { white-space: normal; }
.call { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 700; padding: 10px 14px; border-radius: 999px; white-space: nowrap; text-decoration: none; }
.maps, .ext { color: var(--accent-2); text-decoration: underline; padding: 6px 0; }   /* padding widens the tap target without changing the layout */

.hero { padding: 18px 16px 6px; }
.tagline { margin: 0 0 12px; font-size: 17px; color: var(--text); }
.steps { margin: 0; padding-left: 22px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.steps b { color: var(--text); font-weight: 600; }
.list.trucks { flex: none; }
.list li.truck { cursor: pointer; }
.list li.truck.current { border-left: 3px solid var(--accent); padding-left: 11px; }

.install { display: flex; align-items: center; gap: 10px; margin: 10px 12px 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.install .main { flex: 1; }
.install .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.install button.primary { flex: none; }
