:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg,#eef2ff,#f9fafb 35%); }
button,input { font: inherit; }
.app-shell { width: min(980px, 100%); margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 16px; }
.card { background: rgba(255,255,255,.95); border: 1px solid #e5e7eb; border-radius: 20px; box-shadow: 0 12px 30px rgba(17,24,39,.07); }
.hero { padding: 22px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .12em; color: #6366f1; }
h1,h2,p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(32px,6vw,52px); line-height: 1; }
h2 { margin-bottom: 0; }
.sub { margin-bottom: 0; color: #4b5563; max-width: 650px; }
.status,.pill { background: #eef2ff; color: #4338ca; padding: 8px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.controls { padding: 16px; }
.action-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.btn { border: 1px solid #d1d5db; background: #fff; color: #111827; border-radius: 12px; padding: 12px 14px; font-weight: 750; cursor: pointer; text-align: center; transition: .2s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.06); }
.btn:disabled { opacity:.45; cursor:not-allowed; transform:none; box-shadow:none; }
.btn.primary { background: #111827; color: #fff; border-color:#111827; }
.btn.ghost { background: #f9fafb; }
.search-row { margin-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-row input { width:100%; border:1px solid #d1d5db; border-radius:12px; padding:12px 14px; outline:none; background:#fff; }
.search-row input:focus { border-color:#6366f1; box-shadow:0 0 0 3px rgba(99,102,241,.12); }
.viewer { padding: 12px; overflow: hidden; }
.stage { position: relative; min-height: 360px; border-radius: 15px; overflow: hidden; background:#111827; display:grid; place-items:center; }
.stage.empty { background: radial-gradient(circle at top,#1f2937,#111827); }
#photo { display:none; max-width:100%; width:auto; height:auto; max-height:70vh; object-fit:contain; }
#overlay { position:absolute; inset:0; pointer-events:none; }
.empty-state { color:#fff; text-align:center; padding:40px 24px; max-width:430px; }
.empty-state p { color:#cbd5e1; }
.camera-icon { width:66px; height:66px; margin:0 auto 14px; border-radius:20px; background:#ffffff14; display:grid; place-items:center; font-size:38px; }
.results { padding:18px; }
.section-head { display:flex; justify-content:space-between; gap:16px; align-items:center; margin-bottom:12px; }
.message { padding:12px 14px; border-radius:12px; background:#f9fafb; color:#4b5563; margin-bottom:12px; }
.message.success { background:#ecfdf5; color:#065f46; }
.message.warn { background:#fff7ed; color:#9a3412; }
.chips { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.chip { border:1px solid #d1d5db; background:#fff; padding:8px 11px; border-radius:999px; cursor:pointer; font-weight:700; }
.chip.active { background:#111827; color:white; border-color:#111827; }
.result-list { display:grid; gap:8px; }
.result-item { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; border:1px solid #e5e7eb; border-radius:12px; }
.result-item button { border:0; background:transparent; color:#4338ca; font-weight:800; cursor:pointer; }
.score { color:#6b7280; font-size:14px; }
.privacy { padding:14px 16px; font-size:14px; color:#4b5563; }
@media (max-width:700px){
  .hero { flex-direction:column; }
  .action-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stage { min-height:300px; }
}

.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,.82);
  display: grid;
  place-items: center;
  padding: 16px;
}
.camera-modal[hidden] { display: none; }
.camera-panel {
  width: min(680px, 100%);
  background: #111827;
  color: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.camera-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}
.camera-close {
  appearance: none;
  border: 0;
  background: rgba(255,255,255,.12);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.camera-preview-wrap {
  background: #000;
  aspect-ratio: 3 / 4;
  max-height: 70vh;
  overflow: hidden;
}
#cameraVideo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.camera-message {
  padding: 12px 16px 0;
  color: #d1d5db;
  text-align: center;
}
.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  padding: 16px;
}
.capture-btn { min-height: 52px; }
@media (max-width: 520px) {
  .camera-modal { padding: 0; }
  .camera-panel { width: 100%; height: 100%; border-radius: 0; display: flex; flex-direction: column; }
  .camera-preview-wrap { flex: 1; max-height: none; aspect-ratio: auto; }
}

.finder-box { margin-top: 14px; padding: 13px; border: 1px solid #e5e7eb; border-radius: 14px; background: #f8fafc; }
.finder-label { display: flex; flex-direction: column; gap: 3px; color: #111827; }
.finder-label span { color: #64748b; font-size: 13px; line-height: 1.35; }
.finder-box .search-row { margin-top: 10px; }

.hero-statuses { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.muted-status { background:#f3f4f6; color:#475569; }
.result-copy { min-width:0; }
.result-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.mini-btn { border:1px solid #c7d2fe; background:#eef2ff; color:#4338ca; border-radius:10px; padding:9px 11px; min-height:40px; font-weight:800; cursor:pointer; }
.primary-mini { background:#111827; border-color:#111827; color:#fff; }
.result-item.selected-result { border-color:#f59e0b; box-shadow:0 0 0 2px rgba(245,158,11,.14); }
.saved-preview { padding:18px; }
.compact-head { margin-bottom:10px; }
.recent-row { display:flex; align-items:center; gap:14px; padding:12px; border:1px solid #d1fae5; background:#f0fdf4; border-radius:14px; }
.recent-row img { width:110px; height:76px; object-fit:cover; border-radius:10px; background:#111827; }
.recent-path { margin:4px 0; color:#166534; font-weight:700; line-height:1.4; }

.location-modal { position:fixed; inset:0; z-index:1100; background:rgba(15,23,42,.72); display:grid; place-items:center; padding:18px; overflow:auto; }
.location-modal[hidden] { display:none; }
.location-panel { width:min(720px,100%); max-height:calc(100vh - 36px); overflow:auto; background:#fff; border-radius:22px; box-shadow:0 24px 80px rgba(15,23,42,.35); }
.location-topbar { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; padding:20px 20px 12px; border-bottom:1px solid #e5e7eb; }
.location-topbar h2 { font-size:24px; }
.modal-close { appearance:none; border:0; background:#f3f4f6; color:#111827; width:42px; height:42px; border-radius:999px; font-size:28px; line-height:1; cursor:pointer; flex:0 0 auto; }
.stepper { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; padding:16px 20px 4px; }
.step { position:relative; display:grid; justify-items:center; gap:5px; color:#94a3b8; text-align:center; font-weight:700; font-size:12px; }
.step::before { content:""; position:absolute; top:17px; left:-50%; width:100%; height:2px; background:#e5e7eb; z-index:0; }
.step:first-child::before { display:none; }
.step span { position:relative; z-index:1; width:34px; height:34px; display:grid; place-items:center; border-radius:999px; background:#f1f5f9; border:2px solid #e2e8f0; color:#64748b; }
.step.active, .step.complete { color:#111827; }
.step.active span { background:#111827; color:#fff; border-color:#111827; }
.step.complete span { background:#dcfce7; border-color:#86efac; color:#166534; }
.step.complete::before, .step.active::before { background:#86efac; }
#locationForm { padding:14px 20px 20px; }
.wizard-step { display:none; min-height:300px; }
.wizard-step.active { display:block; }
.selected-object-card { display:grid; grid-template-columns:minmax(150px,240px) 1fr; gap:16px; align-items:center; border:1px solid #e5e7eb; background:#f8fafc; border-radius:16px; padding:12px; margin-bottom:18px; }
#objectPreview { width:100%; height:140px; object-fit:cover; border-radius:12px; background:#111827; }
.selected-object-card strong { display:block; font-size:24px; text-transform:capitalize; margin:3px 0; }
.mini-label { color:#64748b; font-size:12px; text-transform:uppercase; font-weight:800; letter-spacing:.08em; }
.confidence-text { color:#64748b; font-size:14px; }
.field-label { display:block; font-weight:800; margin:0 0 7px; color:#111827; }
.field-label.spaced { margin-top:17px; }
.optional { color:#94a3b8; font-weight:600; font-size:12px; }
.field-input { width:100%; border:1px solid #cbd5e1; border-radius:12px; padding:12px 13px; font:inherit; background:#fff; color:#111827; outline:none; }
.field-input:focus { border-color:#6366f1; box-shadow:0 0 0 3px rgba(99,102,241,.12); }
.field-textarea { resize:vertical; min-height:90px; }
.field-help { margin:7px 0 0; color:#64748b; font-size:13px; }
.conditional-field { margin-top:12px; padding:12px; border-radius:12px; background:#f8fafc; border:1px dashed #cbd5e1; }
.confirm-card { text-align:center; padding:24px 18px; border:1px solid #d1fae5; background:#f0fdf4; border-radius:18px; }
.confirm-icon { width:54px; height:54px; display:grid; place-items:center; margin:0 auto 10px; border-radius:999px; background:#16a34a; color:white; font-size:26px; font-weight:900; }
.confirm-card h3 { margin:0 0 10px; font-size:26px; }
.location-path { margin:0; color:#166534; font-size:17px; font-weight:800; line-height:1.55; }
.confirm-extra { margin:10px 0 0; color:#475569; }
.save-note { margin:14px 4px 0; color:#64748b; font-size:13px; line-height:1.5; }
.wizard-error { margin-top:12px; padding:10px 12px; border-radius:10px; background:#fff7ed; color:#9a3412; font-weight:700; }
.wizard-actions { display:flex; gap:10px; justify-content:flex-end; align-items:center; flex-wrap:wrap; border-top:1px solid #e5e7eb; margin-top:18px; padding-top:16px; }
.wizard-actions .btn { min-width:110px; }

@media (max-width:700px) {
  .hero-statuses { justify-content:flex-start; }
  .result-item { align-items:flex-start; flex-direction:column; }
  .result-actions { width:100%; }
  .result-actions .mini-btn { flex:1; }
  .location-modal { padding:0; align-items:start; }
  .location-panel { max-height:none; min-height:100vh; border-radius:0; }
  .selected-object-card { grid-template-columns:1fr; }
  #objectPreview { height:180px; }
  .wizard-actions { display:grid; grid-template-columns:1fr 1fr; }
  .wizard-actions .btn { min-width:0; }
  .recent-row { align-items:flex-start; }
}

@media (max-width:420px) {
  .step small { font-size:10px; }
  .stepper { padding-inline:12px; }
  #locationForm { padding-inline:14px; }
  .location-topbar { padding-inline:14px; }
}

/* v5 detection quality UI */
.result-item.possible-result { border-color:#fde68a; background:#fffbeb; }
.result-item.possible-result .score { color:#92400e; }
.review-uncertain { width:100%; border:1px dashed #d97706; background:#fffbeb; color:#92400e; border-radius:12px; padding:11px 13px; min-height:44px; font-weight:800; cursor:pointer; }
.review-uncertain:hover { background:#fef3c7; }

/* v6 simplified manual inventory flow */
.simple-actions { grid-template-columns: repeat(4,minmax(0,1fr)); }
.workflow-message { margin:14px 0 0; }
#photo { max-height:72vh; }
@media (max-width:700px) {
  .simple-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* v7 Storage Map */
.home-nav-row { display:flex; justify-content:flex-end; margin-bottom:12px; }
.inventory-nav-btn { background:#eef2ff; border-color:#c7d2fe; color:#3730a3; font-weight:900; }
.inventory-shell { padding-bottom:42px; }
.inventory-topbar { padding:20px; display:flex; justify-content:space-between; align-items:center; gap:18px; }
.inventory-tools { padding:18px; }
.inventory-search-row { display:grid; grid-template-columns:1fr auto; gap:10px; }
.inventory-filters { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:14px; }
.compact-label { margin-bottom:6px; font-size:13px; }
.inventory-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.summary-card { padding:18px; display:flex; flex-direction:column; gap:2px; }
.summary-card span { font-size:30px; font-weight:900; color:#111827; }
.summary-card small { color:#64748b; font-weight:700; }
.room-map-card, .inventory-results-card { padding:18px; }
.room-map { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.room-tile { min-height:88px; border:1px solid #e2e8f0; background:#f8fafc; border-radius:14px; padding:13px; text-align:left; cursor:pointer; display:flex; flex-direction:column; justify-content:space-between; gap:8px; color:#111827; }
.room-tile strong { font-size:16px; }
.room-tile span { color:#64748b; font-size:13px; font-weight:700; }
.room-tile.active { background:#111827; border-color:#111827; color:#fff; }
.room-tile.active span { color:#d1d5db; }
.room-map-empty { color:#64748b; margin:2px 0; }
.inventory-list { display:grid; gap:12px; }
.inventory-item-card { display:grid; grid-template-columns:128px 1fr auto; gap:14px; align-items:center; padding:12px; border:1px solid #e5e7eb; border-radius:16px; background:#fff; }
.inventory-thumb { width:128px; height:92px; object-fit:cover; border-radius:12px; background:#111827; }
.thumb-placeholder { display:grid; place-items:center; color:#fff; font-size:30px; }
.inventory-item-body { min-width:0; }
.inventory-item-body h3 { margin:0 0 5px; font-size:20px; }
.inventory-location-path { margin:0; color:#166534; font-weight:800; line-height:1.45; overflow-wrap:anywhere; }
.inventory-tags { display:flex; flex-wrap:wrap; gap:6px; margin-top:9px; }
.inventory-tags span { border-radius:999px; background:#f1f5f9; color:#475569; padding:5px 8px; font-size:12px; font-weight:800; }
.inventory-view-btn { white-space:nowrap; }
.inventory-empty { text-align:center; padding:36px 18px; color:#64748b; }
.inventory-empty h3 { color:#111827; font-size:22px; margin:0 0 6px; }
.inventory-empty .btn { margin-top:10px; display:inline-flex; }
.item-detail-panel { width:min(660px,100%); }
.item-detail-body { padding:18px 20px 22px; }
.detail-photo { width:100%; max-height:360px; object-fit:contain; border-radius:14px; background:#111827; margin-bottom:14px; }
.detail-location-box { padding:16px; border-radius:14px; background:#f0fdf4; border:1px solid #bbf7d0; }
.detail-location-box strong { display:block; margin-top:5px; color:#166534; font-size:19px; line-height:1.5; }
.detail-notes { margin-top:14px; padding:14px; border-radius:14px; background:#f8fafc; border:1px solid #e2e8f0; }
.detail-notes p { margin:6px 0 0; color:#475569; line-height:1.55; }
.detail-meta { margin:14px 2px 0; color:#94a3b8; font-size:13px; }
@media (max-width:800px) {
  .room-map { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .inventory-item-card { grid-template-columns:96px 1fr; }
  .inventory-thumb { width:96px; height:78px; }
  .inventory-view-btn { grid-column:1 / -1; width:100%; }
}
@media (max-width:650px) {
  .inventory-topbar { align-items:flex-start; flex-direction:column; }
  .inventory-topbar .btn { width:100%; }
  .inventory-search-row { grid-template-columns:1fr; }
  .inventory-filters { grid-template-columns:1fr; }
  .inventory-summary-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
  .summary-card { padding:13px; }
  .summary-card span { font-size:24px; }
  .summary-card small { font-size:11px; }
  .home-nav-row .btn { width:100%; }
}
@media (max-width:420px) {
  .room-map { grid-template-columns:1fr 1fr; }
  .inventory-item-card { grid-template-columns:78px 1fr; gap:10px; }
  .inventory-thumb { width:78px; height:68px; }
  .inventory-item-body h3 { font-size:18px; }
}

.inline-add-row { margin-top:8px; display:flex; justify-content:flex-start; }
.inline-add-btn {
  border:0;
  background:transparent;
  color:#4338ca;
  font:inherit;
  font-weight:800;
  padding:8px 2px;
  cursor:pointer;
  text-align:left;
}
.inline-add-btn:hover { text-decoration:underline; }
.inline-add-btn:focus-visible { outline:3px solid rgba(79,70,229,.22); outline-offset:3px; border-radius:6px; }
.conditional-field.custom-entry-open {
  margin-top:6px;
  padding:12px;
  background:#f5f7ff;
  border:1px solid #dfe3ff;
  border-radius:12px;
}

/* v10 phone-first refinement */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  overflow-x: hidden;
  min-width: 0;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
button, a, select, input, textarea { touch-action: manipulation; }
.btn, .mini-btn, .inline-add-btn, .room-tile, .camera-close, .modal-close {
  -webkit-tap-highlight-color: transparent;
}
.field-input,
.inventory-search-row input,
select,
textarea {
  font-size: 16px;
}

@media (max-width: 600px) {
  body { background: #f8fafc; }
  .app-shell {
    width: 100%;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(28px + env(safe-area-inset-bottom));
    gap: 12px;
  }
  .card {
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(17,24,39,.055);
  }
  .hero { padding: 18px 16px; gap: 12px; }
  .hero h1, .inventory-topbar h1 {
    font-size: clamp(30px, 10vw, 40px);
    line-height: 1.02;
  }
  .sub { font-size: 15px; line-height: 1.5; }
  .hero-statuses { width: 100%; }
  .status, .pill { font-size: 12px; padding: 7px 10px; }

  .controls { padding: 12px; }
  .simple-actions, .action-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .btn {
    width: 100%;
    min-height: 50px;
    padding: 13px 14px;
    border-radius: 13px;
    font-size: 16px;
  }
  .home-nav-row { margin-bottom: 9px; }

  .viewer { padding: 8px; }
  .stage { min-height: 240px; border-radius: 12px; }
  #photo { width: 100%; max-height: none; object-fit: contain; }
  .empty-state { padding: 32px 18px; }
  .empty-state h2 { font-size: 20px; }
  .camera-icon { width: 58px; height: 58px; font-size: 32px; }
  .workflow-message { font-size: 14px; line-height: 1.45; }
  .saved-preview { padding: 14px; }
  .recent-row { flex-direction: column; }
  .recent-row img { width: 100%; height: auto; max-height: 180px; }

  .camera-modal {
    padding: 0;
    align-items: stretch;
    background: #000;
  }
  .camera-panel {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .camera-topbar {
    padding: max(12px, env(safe-area-inset-top)) 14px 10px;
    min-height: 58px;
  }
  .camera-close { width: 44px; height: 44px; }
  .camera-preview-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
  }
  .camera-message { padding: 10px 14px 0; font-size: 14px; }
  .camera-actions {
    grid-template-columns: 1fr;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    gap: 9px;
  }
  .camera-actions .btn { min-height: 52px; }
  .capture-btn { order: -1; min-height: 58px !important; font-size: 17px; }

  .location-modal {
    padding: 0;
    align-items: stretch;
    background: #fff;
  }
  .location-panel {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .location-topbar {
    padding: max(14px, env(safe-area-inset-top)) 14px 10px;
    flex: 0 0 auto;
  }
  .location-topbar h2 { font-size: 21px; line-height: 1.15; }
  .modal-close { width: 44px; height: 44px; }
  .stepper {
    padding: 12px 10px 4px;
    gap: 3px;
    flex: 0 0 auto;
  }
  .step { font-size: 10px; gap: 4px; min-width: 0; }
  .step span { width: 30px; height: 30px; }
  .step::before { top: 15px; }
  .step small { font-size: 9px; line-height: 1.15; }
  #locationForm {
    padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
  }
  .wizard-step { min-height: 0; }
  .selected-object-card {
    grid-template-columns: 104px 1fr;
    gap: 12px;
    padding: 10px;
    margin-bottom: 16px;
  }
  #objectPreview { height: 92px; border-radius: 10px; }
  .selected-object-card strong { font-size: 18px; }
  .confidence-text { font-size: 13px; line-height: 1.35; }
  .field-label { font-size: 15px; }
  .field-label.spaced { margin-top: 15px; }
  .field-input {
    min-height: 50px;
    padding: 13px 12px;
    border-radius: 12px;
  }
  textarea.field-input { min-height: 96px; }
  .field-help { font-size: 13px; line-height: 1.4; }
  .inline-add-btn { min-height: 44px; padding: 10px 2px; }
  .conditional-field { padding: 10px; }
  .confirm-card { padding: 20px 14px; }
  .confirm-card h3 { font-size: 23px; }
  .location-path { font-size: 16px; }
  .wizard-actions {
    position: sticky;
    bottom: calc(-14px - env(safe-area-inset-bottom));
    z-index: 3;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 18px -14px calc(-14px - env(safe-area-inset-bottom));
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.97);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -8px 22px rgba(15,23,42,.06);
  }
  .wizard-actions .btn { min-height: 48px; font-size: 15px; }
  #nextStepBtn, #saveObjectBtn { grid-column: 2; }

  .inventory-shell { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .inventory-topbar, .inventory-tools, .room-map-card, .inventory-results-card { padding: 14px; }
  .inventory-topbar { gap: 12px; }
  .inventory-search-row { gap: 8px; }
  .inventory-filters { gap: 10px; margin-top: 12px; }
  .inventory-summary-grid { gap: 7px; }
  .summary-card { padding: 12px 9px; min-width: 0; }
  .summary-card span { font-size: 22px; }
  .summary-card small { font-size: 10px; line-height: 1.2; overflow-wrap: anywhere; }
  .room-map { gap: 8px; }
  .room-tile { min-height: 82px; padding: 11px; }
  .room-tile strong { font-size: 15px; overflow-wrap: anywhere; }
  .inventory-item-card {
    grid-template-columns: 84px minmax(0,1fr);
    gap: 10px;
    padding: 10px;
    align-items: start;
  }
  .inventory-thumb { width: 84px; height: 76px; }
  .inventory-item-body h3 { font-size: 18px; overflow-wrap: anywhere; }
  .inventory-location-path { font-size: 14px; }
  .inventory-tags { gap: 5px; }
  .inventory-view-btn { grid-column: 1 / -1; width: 100%; }
  .item-detail-body { padding: 14px 14px calc(20px + env(safe-area-inset-bottom)); }
  .detail-photo { max-height: 300px; }
}

@media (max-width: 360px) {
  .app-shell { padding-left: 9px; padding-right: 9px; }
  .hero { padding-left: 13px; padding-right: 13px; }
  .room-map { grid-template-columns: 1fr; }
  .inventory-summary-grid { grid-template-columns: 1fr 1fr 1fr; }
  .selected-object-card { grid-template-columns: 82px 1fr; }
  #objectPreview { height: 78px; }
  .step small { display: none; }
  .stepper { padding-bottom: 8px; }
}


/* v11 simplified inventory cards */
.inventory-item-card {
  grid-template-columns: 96px minmax(0,1fr);
  align-items: center;
}
.inventory-thumb {
  width: 96px;
  height: 82px;
}
.inventory-item-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
}
.inventory-item-title {
  appearance: none;
  border: 0;
  background: transparent;
  color: #111827;
  padding: 3px 0;
  margin: 0;
  font: inherit;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.inventory-item-title:hover { text-decoration: underline; }
.inventory-item-title:focus-visible {
  outline: 3px solid rgba(79,70,229,.25);
  outline-offset: 4px;
  border-radius: 5px;
}
.inventory-item-hint {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}
/* Old pathway/tag/action elements are intentionally removed from card view. */
.inventory-location-path, .inventory-tags, .inventory-view-btn { display: none !important; }

@media (max-width: 420px) {
  .inventory-item-card {
    grid-template-columns: 78px minmax(0,1fr);
    gap: 11px;
    padding: 10px;
  }
  .inventory-thumb {
    width: 78px;
    height: 70px;
  }
  .inventory-item-title { font-size: 18px; }
  .inventory-item-hint { font-size: 11px; }
}


/* ===== StashMap v12 visual system ===== */
:root{
  --sm-ink:#172033;
  --sm-muted:#687386;
  --sm-bg:#f6f8fb;
  --sm-card:#ffffff;
  --sm-line:#e4e9f0;
  --sm-accent:#16a085;
  --sm-accent-dark:#0f7d69;
  --sm-accent-soft:#eaf8f4;
  --sm-navy:#172033;
  --sm-shadow:0 10px 30px rgba(23,32,51,.07);
  --sm-radius:22px;
}
html{background:var(--sm-bg)}
body{
  background:
    radial-gradient(circle at 90% -10%, rgba(22,160,133,.09), transparent 30rem),
    var(--sm-bg);
  color:var(--sm-ink);
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  letter-spacing:-.01em;
}
.app-shell{max-width:760px}
.card{
  background:rgba(255,255,255,.96);
  border:1px solid var(--sm-line);
  border-radius:var(--sm-radius);
  box-shadow:var(--sm-shadow);
}
.hero{
  position:relative;
  overflow:hidden;
  border-top:4px solid var(--sm-accent);
}
.hero:after{
  content:"";
  position:absolute;
  width:150px;height:150px;border-radius:999px;
  right:-75px;top:-85px;
  background:var(--sm-accent-soft);
  pointer-events:none;
}
h1,h2,h3,strong{color:var(--sm-ink)}
h1{
  font-size:clamp(2.25rem,9vw,3.5rem);
  letter-spacing:-.055em;
  line-height:.95;
  margin:.2rem 0 .7rem;
}
.sub{color:var(--sm-muted);font-size:1.04rem;line-height:1.5;max-width:34rem}
.eyebrow{
  color:var(--sm-accent-dark);
  font-size:.72rem;
  letter-spacing:.17em;
  font-weight:850;
}
.status{
  border:1px solid #cfece5;
  background:var(--sm-accent-soft);
  color:var(--sm-accent-dark);
}
.muted-status{background:#f3f5f8;color:var(--sm-muted);border-color:var(--sm-line)}
.btn{
  min-height:52px;
  border-radius:15px;
  border:1px solid var(--sm-line);
  background:#fff;
  color:var(--sm-ink);
  font-weight:780;
  box-shadow:none;
  transition:transform .12s ease,border-color .12s ease,background .12s ease;
}
.btn.primary,.inventory-nav-btn{
  background:var(--sm-navy);
  border-color:var(--sm-navy);
  color:#fff;
}
.inventory-nav-btn{
  background:var(--sm-accent);
  border-color:var(--sm-accent);
}
.btn.ghost{background:#f7f9fb}
.btn:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible{
  outline:3px solid rgba(22,160,133,.24);
  outline-offset:2px;
}
@media (hover:hover) and (pointer:fine){
  .btn:hover{transform:translateY(-1px);border-color:#cbd3de}
  .btn.primary:hover{background:#202c44}
  .inventory-nav-btn:hover{background:var(--sm-accent-dark)}
}
.workflow-message,.message{
  border-radius:14px;
  color:var(--sm-muted);
}
.stage{
  border-radius:18px;
  background:#eef2f6;
  border-color:var(--sm-line);
}
.empty-state{color:var(--sm-muted)}
.camera-icon{
  color:var(--sm-accent);
  background:var(--sm-accent-soft);
  border-radius:999px;
}
.location-panel,.camera-panel{
  border-radius:24px;
  box-shadow:0 28px 70px rgba(0,0,0,.24);
}
.step.active span,.step.done span{
  background:var(--sm-accent);
  border-color:var(--sm-accent);
}
input,select,textarea{
  border:1px solid #d8dee7;
  border-radius:14px;
  background:#fff;
  color:var(--sm-ink);
}
input:focus,select:focus,textarea:focus{border-color:var(--sm-accent)}
.privacy{
  color:var(--sm-muted);
  background:transparent;
  border-style:dashed;
  box-shadow:none;
}
.privacy strong{color:var(--sm-accent-dark)}

/* Inventory: restrained, scan-friendly cards */
.inventory-card,.item-card,.room-card,.summary-card{
  border-color:var(--sm-line)!important;
  box-shadow:none!important;
}
.item-card,.inventory-card{border-radius:18px!important}
.item-title,.item-name{
  color:var(--sm-ink)!important;
  font-weight:850!important;
}
.item-title button,.item-name button,a.item-title{
  color:var(--sm-ink)!important;
  text-decoration:none;
}
.item-title button:hover,.item-name button:hover,a.item-title:hover{color:var(--sm-accent-dark)!important}
.room-card.active,.room-card[aria-selected="true"]{
  border-color:var(--sm-accent)!important;
  background:var(--sm-accent-soft)!important;
}
.badge,.chip,.pill{
  background:#f0f3f7!important;
  color:#526074!important;
}
.search-wrap input,.filter-row select{
  background:#fff;
  border-color:var(--sm-line);
}

/* Phone-first polish */
@media (max-width:600px){
  body{background:var(--sm-bg)}
  .app-shell{padding:12px}
  .card{border-radius:18px;box-shadow:0 5px 18px rgba(23,32,51,.055)}
  .hero{padding:20px 18px}
  h1{font-size:2.55rem}
  .sub{font-size:.98rem}
  .controls,.viewer,.saved-preview,.privacy{padding:14px}
  .simple-actions{gap:10px}
  .btn{min-height:54px;font-size:1rem}
  .inventory-nav-btn{min-height:56px}
  .location-panel,.camera-panel{border-radius:20px 20px 0 0}
}


/* StashMap v13 release additions */
.inventory-top-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}
.backup-panel{max-width:560px}
.backup-body{
  display:grid;
  gap:14px;
  padding:4px 0 0;
}
.backup-option{
  padding:18px;
  border:1px solid var(--sm-line, #e4e9f0);
  border-radius:18px;
  background:#fff;
}
.backup-option h3{
  margin:0 0 6px;
  font-size:1.08rem;
}
.backup-option p{
  margin:0 0 14px;
  color:var(--sm-muted, #687386);
  line-height:1.45;
}
.backup-option .btn{width:100%}
@media (max-width:600px){
  .inventory-top-actions{width:100%}
  .inventory-top-actions .btn{flex:1 1 auto}
  .backup-option{padding:15px}
}


/* ===== StashMap v14.1 inventory selection ===== */
.bulk-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  margin:0 0 14px;
  box-shadow:none;
}
.bulk-left,.bulk-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:9px;
}
.bulk-count{
  color:var(--sm-muted,#687386);
  font-size:.9rem;
  font-weight:700;
}
.btn.danger{
  background:#b42318;
  border-color:#b42318;
  color:#fff;
}
.btn.danger:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.inventory-item-card{
  position:relative;
}
.item-select-control{
  position:absolute;
  top:10px;
  right:10px;
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  z-index:4;
  cursor:pointer;
}
.item-select-control input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.item-select-control span{
  width:27px;
  height:27px;
  border:2px solid #aab4c2;
  border-radius:9px;
  background:#fff;
  display:block;
  position:relative;
}
.item-select-control input:checked + span{
  background:var(--sm-accent,#16a085);
  border-color:var(--sm-accent,#16a085);
}
.item-select-control input:checked + span:after{
  content:"";
  position:absolute;
  left:7px;
  top:3px;
  width:7px;
  height:13px;
  border:solid #fff;
  border-width:0 3px 3px 0;
  transform:rotate(45deg);
}
.item-select-control input:focus-visible + span{
  outline:3px solid rgba(22,160,133,.24);
  outline-offset:2px;
}
@media (max-width:600px){
  .bulk-toolbar{
    align-items:stretch;
    flex-direction:column;
  }
  .bulk-left,.bulk-actions{width:100%}
  .bulk-left .btn{flex:1}
  .bulk-actions .btn{
    flex:1 1 calc(50% - 8px);
    min-width:0;
  }
  .bulk-actions .btn.danger{flex-basis:100%}
}


/* ===== StashMap v14.4 selection visibility ===== */
.inventory-item-card.is-selected{
  border-color:var(--sm-accent,#16a085)!important;
  background:var(--sm-accent-soft,#eaf8f4);
}
.inventory-item-card.is-selected .item-select-control span{
  box-shadow:0 0 0 3px rgba(22,160,133,.10);
}
