/* A familiar home, with one clear next step. Shared by every application view. */
:root {
  --background: #f5f6f8;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --text: #2b3038;
  --muted: #5c6572;
  --faint: #78818e;
  --border: #d9dfe7;
  --accent: #243e5c;
  --accent-dark: #192d45;
  --accent-soft: #e8edf4;
  --blue-soft: #e8edf4;
  --shadow: 0 5px 22px #243e5c08;
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-size: 16px;
}
body { padding: 0; background: var(--background); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
button:disabled { cursor: not-allowed; }
.app-shell { max-width: 1160px; min-height: 100vh; margin: auto; border: 0; border-radius: 0; box-shadow: none; }
.topbar { min-height: 100px; padding: max(22px, env(safe-area-inset-top)) 42px 20px; background: transparent; border-bottom: 1px solid var(--border); }
.wordmark { display: flex; align-items: center; gap: 12px; margin: 0; padding: 0; text-align: left; }
.wordmark .brand-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--accent); color: #ffffff; }
.brand-icon svg { width: 31px; stroke-width: 1.8; }
.wordmark .brand-name { color: var(--text); font-size: 22px; letter-spacing: -1.2px; font-weight: 750; }
.wordmark .brand-name > span { color: var(--accent); }
.settings-button { width: auto; min-height: 48px; padding: 0 12px; gap: 10px; display: flex; border: 0; border-radius: 12px; font-size: 14px; color: var(--text); }
.settings-button svg { width: 20px; }
.back-button { position: static; width: auto; min-height: 48px; gap: 8px; padding: 8px 16px; display: flex; border-radius: 12px; font-size: 15px; }
.topbar:has(.back-button:not([hidden])) .wordmark { margin-left: auto; opacity: 1; pointer-events: auto; }
.screen { max-width: 760px; margin: auto; padding: 42px 32px 64px; animation-duration: .18s; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.home-screen { max-width: none; padding: 36px 42px 44px; }
.eyebrow { color: var(--accent); font-size: 12px; line-height: 1.5; font-weight: 550; letter-spacing: 1.6px; }
.home-illustration, .camera-illustration, .room-illustration { display: block; width: 100%; height: auto; fill: none; stroke: none; }
.home-illustration path, .room-illustration path, .camera-illustration path { stroke-linecap: round; stroke-linejoin: round; }
.home-screen .search-form { margin: 0; }
.search-box, .home-screen .search-box { height: 72px; padding: 10px 12px 10px 20px; gap: 14px; border: 1px solid #9eacbd; border-radius: 17px; background: var(--surface); box-shadow: 0 4px 14px #243e5c05; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #243e5c19; transform: none; }
.search-box > svg { width: 24px; color: var(--accent); }
.search-box input, .home-screen .search-box input { font-size: 16px; min-width: 0; }
.search-box input::placeholder { color: #5c6572; opacity: 1; }
.home-search-submit { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; color: white; background: var(--accent); }
.home-search-submit:hover { color: white; background: var(--accent-dark); }
.home-screen .clear-search, .clear-search { min-width: 44px; width: 44px; height: 44px; flex: 0 0 44px; font-size: 22px; }
.search-suggestions { border-radius: 14px; background: var(--surface); box-shadow: 0 12px 34px #243e5c1a; }
.search-suggestion { min-height: 82px; padding: 14px; }
.search-suggestion strong { font-size: 15px; }
.search-suggestion small, .search-suggestion-location { font-size: 14px; }
.add-home-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.scan-home-button, #add-manual-item { display: flex; justify-content: center; align-items: center; gap: 14px; width: 100%; min-height: 64px; margin: 0; padding: 17px 20px; border: 1px solid transparent; border-radius: 14px; font-size: 16px; line-height: 1.5; font-weight: 550; text-align: left; cursor: pointer; }
.scan-home-button { background: var(--accent); color: white; }
.scan-home-button:hover { background: var(--accent-dark); }
#add-manual-item { background: var(--surface); border-color: var(--border); color: var(--accent); }
#add-manual-item:hover { background: var(--accent-soft); border-color: var(--accent); }
.scan-home-button > svg, #add-manual-item > svg { flex: none; width: 24px; height: 24px; }
.queue-home-button { grid-template-columns: 32px 1fr 20px; min-height: 80px; margin-top: 20px; padding: 18px 22px; border: 1px solid #d3dce7; border-radius: 15px; background: #edf1f6; gap: 16px; }
.queue-home-button:hover { background: #e4eaf2; }
.queue-home-symbol { display: grid; place-items: center; width: 32px; height: 32px; color: #415b77; }
.queue-home-symbol svg { width: 26px; }
.queue-home-copy { display: grid; gap: 5px; }
.queue-home-copy strong { font-size: 15px; font-weight: 500; color: var(--text); }
.queue-home-copy > span { font-size: 14px; color: var(--muted); }
.home-places { margin-top: 48px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.section-heading h2 { font-size: 20px; letter-spacing: -.6px; font-weight: 550; line-height: 1.3; }
.section-heading > button, .text-action { min-height: 48px; flex-shrink: 0; padding: 10px 0; border: 0; background: transparent; color: var(--accent); font-size: 15px; font-weight: 550; text-align: left; cursor: pointer; }
.section-heading > button:hover, .text-action:hover { text-decoration: underline; text-underline-offset: 4px; }
.section-heading > button > span { padding-left: 8px; }
.room-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.room-card { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; padding: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.room-card:hover { border-color: #8195ad; box-shadow: 0 6px 20px #243e5c0c; }
.room-card-art { display: block; width: 100%; background: #edf1f5; }
.room-card:nth-child(3n + 2) .room-card-art { background: #eef0f3; }
.room-card:nth-child(3n + 3) .room-card-art { background: #e8eef4; }
.room-card-copy { display: grid; gap: 7px; width: 100%; padding: 22px 38px 22px 20px; }
.room-card-copy strong { font-size: 16px; letter-spacing: -.4px; font-weight: 500; overflow-wrap: anywhere; }
.room-card-copy > span { color: var(--muted); font-size: 14px; line-height: 1.6; }
.room-card > .chevron { position: absolute; bottom: 43px; right: 15px; color: var(--accent); width: 18px; }
.inventory-home-button { width: 100%; max-width: 100%; min-height: 48px; margin: 0; padding: 12px; border: 0; border-radius: 10px; background: transparent; grid-template-columns: 1fr auto 17px; gap: 14px; }
.inventory-home-button > span:first-child { font-size: 15px; font-weight: 550; color: var(--accent); }
.inventory-home-button > span:nth-child(2) { padding: 2px 9px; background: var(--accent-soft); border-radius: 6px; font-size: 14px; }
.inventory-home-button:hover { background: var(--accent-soft); }
.home-rooms-empty { padding: 28px; border: 1px dashed #b8c4d1; border-radius: 18px; }
.home-rooms-empty h3 { margin: 0 0 10px; font-size: 18px; font-weight: 500; }
.home-rooms-empty p { font-size: 15px; color: var(--muted); }
.home-rooms-empty button { margin-top: 14px; }
.rooms-load-state { padding: 30px; color: var(--muted); text-align: center; }
.home-help { margin-top: 32px; border-top: 1px solid var(--border); }
.home-help > summary { min-height: 76px; display: flex; gap: 16px; align-items: center; font-size: 15px; cursor: pointer; list-style: none; }
.home-help > summary::-webkit-details-marker { display: none; }
.home-help > summary > .chevron { margin-left: auto; flex-shrink: 0; }
.home-help[open] > summary > .chevron { transform: rotate(90deg); }
.help-symbol { width: 28px; height: 28px; display: grid; place-items: center; flex: none; border: 1px solid #9aaabd; border-radius: 50%; color: var(--accent); font-size: 15px; }
.home-help ol { list-style: none; padding: 8px 0 26px; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.home-help li { display: flex; gap: 14px; align-items: flex-start; }
.home-help li > span { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; }
.home-help li strong { display: block; font-size: 15px; font-weight: 500; }
.home-help li p { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* Restrained type sizes and consistent controls throughout the app. */
.screen-intro h1, .results-heading h1, .detail-heading h1, .auth-copy h1, .empty-copy h1 { font-size: 22px; line-height: 1.2; font-weight: 550; letter-spacing: -1px; }
.screen-intro .eyebrow { margin-bottom: 12px; }
.intro-copy, .queue-intro .intro-copy, .inventory-intro .intro-copy { color: var(--muted); font-size: 15px; line-height: 1.65; }
.primary-button, .secondary-button { min-height: 58px; padding: 14px 20px; border-radius: 14px; font-size: 15px; line-height: 1.45; font-weight: 500; box-shadow: none; }
.primary-button:hover { background: var(--accent-dark); box-shadow: none; transform: none; }
.primary-button:disabled { background: #e2e7ed; color: #5f6875; }
.secondary-button { background: var(--surface); }
.secondary-button:hover { background: var(--accent-soft); }
.helper-text, .scan-model-note, .scan-save-state, .scan-subtitle, .recognition-status, .scan-queue-summary, .detail-description { font-size: 15px; line-height: 1.6; }
.auth-field, .field-label, .saved-location-label, .compact-field > span, .detail-editor-section-label { font-size: 15px; color: var(--text); }
.auth-field input, .editor-input, .compact-field select, .location-level select, .location-level input { min-height: 56px; border-radius: 12px; font-size: 16px; }
.auth-field input:focus, .editor-input:focus { box-shadow: 0 0 0 3px #243e5c19; border-color: var(--accent); }
.auth-error, .recognition-error, .detail-save-error, .data-load-status { font-size: 15px; line-height: 1.6; }
.choose-photo-button, .retake-button, .scan-text-button, .detail-edit-button, .inventory-box-open, .detail-organize-actions button { min-height: 52px; padding: 12px 16px; border-radius: 12px; font-size: 15px; }
.scan-text-button, .retake-button { border-color: transparent; background: transparent; color: var(--muted); }
.delete-item-button, .inventory-delete-action, .scan-queue-delete { font-size: 14px; }
.screen-intro { margin-bottom: 28px; }
.auth-screen { max-width: 520px; padding-top: 20px; }
.auth-art { width: 250px; max-width: 80%; margin: 0 auto 4px; }
.auth-copy { text-align: center; }
.auth-copy h1 { font-size: 22px; }
.auth-copy p { font-size: 15px; }
.auth-form { margin-top: 30px; gap: 20px; }
.auth-form input { height: 58px; }
.account-card { padding: 24px; border-radius: 18px; }
.account-card small, .admin-heading p, .admin-user-header small { font-size: 15px; }
.account-card strong { font-size: 20px; }
.admin-user-card, .admin-create-form { border-radius: 18px; }
.admin-text-button, .admin-password-form button { min-height: 48px; font-size: 14px; }
.admin-password-form { grid-template-columns: minmax(0, 1fr) auto; }
.admin-password-form input { font-size: 15px; }
.data-load-status { margin: 24px 32px 0; border-radius: 14px; }

/* Finding: recognisable pictures and a visible path back to the object. */
.result-list, .location-result-list { gap: 14px; }
.item-card { grid-template-columns: 100px minmax(0, 1fr) 20px; gap: 20px; padding: 16px; border-radius: 18px; }
.item-visual { width: 100px; height: 100px; border-radius: 12px; }
.item-copy strong { font-size: 18px; font-weight: 500; margin-bottom: 8px; }
.item-description { margin: 6px 0 0; font-size: 14px; }
.path, .search-result-location > span, .search-result-location b { font-size: 14px; line-height: 1.5; }
.search-section-title { margin: 28px 0 14px; font-size: 16px; }
.location-result { padding: 20px; border-radius: 17px; }
.location-result strong { font-size: 16px; }
.location-result-copy > span, .location-result-copy > small { font-size: 14px; }
.results-heading > p { font-size: 15px; }
.compact-search-wrap { margin-bottom: 32px; }
.detail-heading { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.detail-edit-button { margin-left: auto; flex: none; background: transparent; }
.detail-photo-button { width: min(100%, 360px); margin: 0 auto 24px; }
.detail-photo-button .hero-image { border-radius: 21px; background-color: #eceff3; }
.detail-location-card { padding: 24px; border: 1px solid #c5d0dd; border-radius: 18px; background: var(--accent-soft); }
.detail-location-card h2 { margin-bottom: 8px; font-size: 15px; font-weight: 500; color: var(--accent); }
.detail-location-card > strong { font-size: 20px; line-height: 1.4; font-weight: 550; }
.detail-location-card p { margin-top: 10px; font-size: 15px; }
.detail-organize-actions { margin-top: 16px; }
.detail-organize-actions #detail-open-box { min-height: 58px; font-size: 15px; border-radius: 14px; }
.detail-organize-actions button:not(#detail-open-box) { background: transparent; border: 0; text-align: left; }
.detail-inline-editor h2 { font-size: 20px; }
.editor-fields { gap: 12px; }
.detail-editor-actions { gap: 12px; }
.detail-editor-actions .primary-button, .detail-editor-actions .secondary-button { min-height: 56px; font-size: 15px; border-radius: 12px; }
.photo-preview-close { min-width: 48px; min-height: 48px; border-radius: 12px; }

/* Rooms in the inventory retain the complete, existing organisation tools. */
.inventory-screen { max-width: 940px; }
.inventory-tree { gap: 20px; }
.inventory-place { border-radius: 19px; }
.inventory-place > summary { grid-template-columns: 128px minmax(0, 1fr) auto 20px; min-height: 105px; padding: 12px 22px 12px 12px; gap: 18px; }
.inventory-room-art { width: 128px; background: #edf1f5; border-radius: 12px; }
.inventory-place > summary strong { font-size: 20px; font-weight: 500; }
.inventory-tree summary > span:not(.inventory-room-art) { font-size: 14px; white-space: normal; }
.inventory-furniture > summary { min-height: 68px; padding-left: 24px; }
.inventory-furniture > summary strong { font-size: 16px; }
.inventory-furniture-content { padding: 0 20px 20px 24px; }
.inventory-storage > summary { min-height: 66px; }
.inventory-storage > summary strong { font-size: 16px; }
.inventory-item { grid-template-columns: 68px minmax(0, 1fr) 20px; gap: 16px; min-height: 90px; padding: 12px 4px; }
.inventory-item .inventory-item-thumb { width: 68px; height: 68px; border-radius: 12px; }
.inventory-item-copy strong { font-size: 16px; white-space: normal; }
.inventory-item-copy small { font-size: 14px; white-space: normal; }
.inventory-empty p, .inventory-storage-empty { font-size: 15px; }

/* Photograph, check, remember: the same three steps remain in view. */
.scan-step { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.capture-progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; margin: 0 0 38px; padding: 0; }
.capture-progress li { position: relative; display: grid; justify-items: center; gap: 10px; min-width: 0; text-align: center; color: var(--muted); }
.capture-progress li::before { content: ''; position: absolute; top: 25px; left: -50%; right: 50%; height: 1px; background: #cbd4df; }
.capture-progress li:first-child::before { display: none; }
.capture-progress li > span { position: relative; z-index: 1; display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid #c3cedb; border-radius: 50%; background: var(--background); }
.capture-progress svg { width: 24px; }
.capture-progress strong { font-size: 14px; line-height: 1.4; font-weight: 500; }
.capture-progress .is-current { color: var(--accent-dark); }
.capture-progress .is-current > span { border-color: var(--accent); background: var(--accent); color: white; }
.capture-progress .is-current strong { font-weight: 600; }
.capture-progress .is-complete > span { background: var(--accent-soft); border-color: #7b91ab; color: var(--accent); }
.camera-card { height: auto; min-height: 300px; padding: 15px 24px 27px; border: 1px solid #bccada; border-radius: 24px; background: var(--accent-soft); }
.camera-card:before { display: none; }
.capture-art { width: 220px; max-width: 80%; }
.camera-circle { display: none; }
.camera-card strong { display: block; padding: 12px 22px; border-radius: 12px; background: var(--accent); color: white; font-size: 16px; }
.camera-card small { margin-top: 13px; font-size: 15px; }
.camera-card:hover { border-color: var(--accent); background: #dfe7f0; }
.scan-start-screen .helper-text { margin: 22px 10px; }
.choose-photo-button { margin-top: 14px; min-height: 56px; background: var(--surface); }
.captured-photo { border-radius: 22px; }
.model-field { padding: 14px 18px; background: #eff1f4; border: 1px solid var(--border); border-radius: 14px; }
.model-field summary { min-height: 44px; font-size: 15px; cursor: pointer; }
.model-field summary span { font-size: 14px; }
.model-field-heading label, .model-field-heading span { font-size: 14px; }
.model-field select { font-size: 15px; }
.review-actions { gap: 8px; }
.result-meta > span { font-size: 14px; }
.detected-item { border-radius: 18px; }
.detected-item strong, .detected-title { font-size: 16px; }
.detected-description, .detected-uncertainty { font-size: 14px; }
.scan-photo-summary { border-radius: 16px; }
.scan-photo-summary small { font-size: 14px; }
.scan-photo-summary strong { font-size: 15px; }
.scan-selection-summary { font-size: 15px; }
.location-builder { border-radius: 20px; }
.location-level { min-height: 98px; }
.level-control small { font-size: 15px; }
.level-index { background: var(--accent-soft); color: var(--accent); }
.scan-location-preview { padding: 18px; font-size: 15px; }
.sticky-action { position: sticky; bottom: max(16px, env(safe-area-inset-bottom)); width: 100%; max-width: none; left: auto; transform: none; margin-top: 28px; box-shadow: 0 0 0 8px var(--background); }
.sticky-action:hover, .primary-button.sticky-action:disabled { transform: none; }
.scan-location-screen, .scan-result-screen { padding-bottom: 50px; }
.scan-queue-open { grid-template-columns: 92px minmax(0, 1fr) 20px; padding: 14px; gap: 18px; }
.scan-queue-open img { width: 92px; height: 92px; border-radius: 12px; }
.scan-queue-open strong { font-size: 16px; }
.scan-queue-open small { font-size: 14px; }
.scan-queue-card { border-radius: 18px; }
.toast { max-width: calc(100% - 32px); border-radius: 14px; background: var(--accent-dark); }
.toast p { font-size: 15px; }

/* Dialogs are spacious, but retain the exact print-sheet geometry. */
@media screen {
  .org-dialog { width: min(740px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 30px; border-radius: 24px; background: var(--surface); }
  .org-dialog::backdrop { background: #202b3a70; backdrop-filter: blur(5px); }
  .org-heading { font-size: 22px; font-weight: 550; letter-spacing: -.7px; }
  .org-close { min-width: 48px; min-height: 48px; border-radius: 50%; background: var(--accent-soft); }
  .org-intro { font-size: 15px; line-height: 1.6; }
  .org-field > label { font-size: 15px; font-weight: 500; }
  .org-input { min-height: 58px; border-radius: 12px; font-size: 16px; }
  .org-button { min-height: 56px; border-radius: 13px; font-size: 15px; }
  .org-inline-button { min-height: 48px; font-size: 15px; padding: 10px 8px; }
  .org-hint, .org-destination, .org-message { font-size: 15px; line-height: 1.6; }
  .org-manual-dialog .org-destination, .org-manual-dialog .org-hint { font-size: 14px; line-height: 1.6; }
  .org-destination { border-radius: 13px; }
  .org-room-art { max-width: 280px; margin: -10px auto 22px; border-radius: 18px; background: var(--background); }
  .org-box-list { gap: 14px; }
  .org-box-card { grid-template-columns: 96px minmax(0, 1fr) 20px; padding: 16px; gap: 18px; border-radius: 17px; }
  .org-box-thumb, .org-box-placeholder { width: 96px; height: 96px; border-radius: 12px; background: var(--accent-soft); }
  .org-box-placeholder .room-illustration { width: 100%; height: auto; }
  .org-eyebrow { font-size: 13px; }
  .org-box-card-name { font-size: 18px; }
  .org-box-card-path, .org-box-card-count { font-size: 14px; }
  .org-box-hero { margin-bottom: 26px; padding: 22px; border: 1px solid #cbd5e1; border-radius: 18px; background: var(--accent-soft); }
  .org-box-number { font-size: 14px; letter-spacing: .06em; }
  .org-box-name { font-size: 22px; font-weight: 550; }
  .org-box-path { font-size: 15px; }
  .org-box-hero .org-inline-button { font-size: 14px; min-height: 48px; border-radius: 10px; }
  .org-section-heading h2, .org-photo-heading { font-size: 18px; }
  .org-item-list { border-radius: 16px; }
  .org-item-row { grid-template-columns: 44px minmax(0, 1fr) 48px; padding: 14px 10px; }
  .org-item-list:not(.is-selecting) .org-item-row { grid-template-columns: minmax(0, 1fr); }
  .org-item-open { width: 100%; }
  .org-item-copy { flex: 1; }
  .org-item-chevron { width: 18px; color: var(--accent); margin-left: auto; }
  .is-selecting .org-item-chevron { display: none; }
  .org-select-mode { margin: 6px 0 14px; color: var(--accent); }
  .org-select-mode[aria-expanded="true"] { font-weight: 550; }
  .org-optional-fields { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .org-optional-fields > summary { padding: 14px 0; min-height: 54px; font-size: 15px; color: var(--accent); cursor: pointer; }
  .org-optional-fields > .org-field { margin-bottom: 20px; }
  .org-location-dialog .org-heading { font-size: 15px; }
  .org-item-copy strong { font-size: 16px; }
  .org-item-copy small { font-size: 14px; }
  .org-item-thumb { width: 58px; height: 62px; border-radius: 10px; }
  .org-move-one { grid-column: 3; }
  .org-count { font-size: 15px; background: var(--accent-soft); color: var(--accent); }
  .org-empty { font-size: 15px; }
  .org-location-photo { grid-template-columns: 110px minmax(0, 1fr); gap: 0 20px; padding-top: 24px; margin-top: 26px; }
  .org-photo-open { width: 110px; border-radius: 12px; }
  .org-photo-open img { height: 94px; width: 110px; }
  .org-photo-open span { font-size: 14px; padding: 8px; }
  .org-location-photo .org-inline-button { font-size: 14px; }
  .org-photo-empty { font-size: 15px; border-radius: 14px; }
  .org-label-row strong { font-size: 15px; }
  .org-label-row small, .org-printed-labels > summary, .org-print-confirmation, .org-move-summary > p { font-size: 14px; }
  .org-move-summary > strong { font-size: 16px; }
  .org-actions-compact { gap: 12px; }
}
@media (max-width: 760px) {
  .topbar { min-height: 83px; padding: max(15px, env(safe-area-inset-top)) 24px 15px; }
  .screen { padding: 32px 24px 48px; }
  .home-help ol { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 580px) {
  .topbar { padding-left: 20px; padding-right: 20px; }
  .wordmark .brand-name { font-size: 22px; }
  .wordmark .brand-icon { width: 41px; height: 41px; border-radius: 13px; }
  .settings-button { font-size: 14px; padding-right: 0; gap: 7px; }
  .search-box, .home-screen .search-box { height: 64px; padding-left: 12px; gap: 8px; }
  .home-search-submit { width: 44px; height: 44px; flex-basis: 44px; }
  .search-box > svg { width: 20px; }
  .home-help > summary { font-size: 15px; }
  .screen-intro h1, .results-heading h1, .detail-heading h1 { font-size: 22px; }
  .detail-heading { gap: 10px; }
  .detail-edit-button { padding: 10px; font-size: 14px; }
  .item-card { grid-template-columns: 76px minmax(0, 1fr) 16px; gap: 12px; padding: 12px; }
  .item-visual { width: 76px; height: 86px; }
  .item-copy strong { font-size: 16px; }
  .path, .search-result-location > span, .search-result-location b { font-size: 14px; }
  .item-description { font-size: 14px; }
  .inventory-place > summary { grid-template-columns: 74px minmax(0, 1fr) 17px; padding: 12px; gap: 12px; }
  .inventory-room-art { width: 74px; grid-row: 1 / 3; }
  .inventory-place > summary strong { font-size: 18px; }
  .inventory-place > summary > span:not(.inventory-room-art) { grid-row: 2; grid-column: 2; font-size: 14px; }
  .inventory-place > summary .chevron { grid-column: 3; grid-row: 1 / 3; }
  .inventory-furniture > summary { padding-left: 16px; gap: 8px; }
  .inventory-furniture-content { padding: 0 12px 16px; }
  .inventory-furniture > summary strong { font-size: 16px; }
  .inventory-storage > summary { grid-template-columns: minmax(0, 1fr) auto 16px; gap: 8px; }
  .inventory-storage > summary strong { font-size: 15px; }
  .inventory-tree summary > span:not(.inventory-room-art) { font-size: 14px; }
  .inventory-item { grid-template-columns: 52px minmax(0, 1fr) 16px; gap: 10px; }
  .inventory-item .inventory-item-thumb { width: 52px; height: 56px; }
  .inventory-item-copy strong { font-size: 15px; }
  .capture-progress { margin-bottom: 30px; }
  .capture-progress strong { font-size: 13px; }
  .capture-progress li > span { width: 46px; height: 46px; }
  .capture-progress li::before { top: 23px; }
  .camera-card { min-height: 290px; }
  .camera-card small { font-size: 14px; text-align: center; }
  .scan-queue-open { grid-template-columns: 74px minmax(0, 1fr) 17px; gap: 12px; }
  .scan-queue-open img { width: 74px; height: 80px; }
  .auth-art { width: 210px; }
  .org-dialog { padding: 22px 18px; border-radius: 20px; max-height: calc(100dvh - 24px); width: calc(100% - 20px); }
  .org-heading { font-size: 20px; }
  .org-box-card { grid-template-columns: 70px minmax(0, 1fr) 16px; gap: 12px; padding: 12px; }
  .org-box-thumb, .org-box-placeholder { width: 70px; height: 80px; }
  .org-box-card-name { font-size: 16px; }
  .org-box-card-path, .org-box-card-count { font-size: 14px; }
  .org-box-hero { padding: 18px; }
  .org-box-name { font-size: 20px; }
  .org-box-hero .org-actions { grid-template-columns: 1fr; }
  .org-item-row { grid-template-columns: 34px minmax(0, 1fr) 44px; gap: 4px; padding: 12px 6px; }
  .org-select-hit { width: 34px; }
  .org-item-open { gap: 9px; }
  .org-item-thumb { width: 40px; height: 48px; }
  .org-item-copy strong { font-size: 15px; }
  .org-item-copy small { font-size: 14px; }
  .org-item-row .org-move-one { width: 44px; min-width: 0; }
  .org-item-list + .org-hint { font-size: 14px; }
  .org-location-photo { grid-template-columns: 90px minmax(0, 1fr); gap: 0 14px; }
  .org-photo-open, .org-photo-open img { width: 90px; }
  .org-actions { gap: 12px; }
}
@media (max-width: 360px) {
  .screen { padding-left: 18px; padding-right: 18px; }
  .search-box > svg { display: none; }
  .settings-button { gap: 5px; font-size: 13px; }
  .settings-button svg { width: 18px; }
  .detail-heading { flex-wrap: wrap; }
  .detail-edit-button { margin-left: 0; }
  .item-card { grid-template-columns: 58px minmax(0, 1fr) 14px; }
  .item-visual { width: 58px; height: 74px; }
  .capture-progress strong { font-size: 12px; }
  .model-field { padding: 12px; }
  .model-field-heading { flex-wrap: wrap; gap: 8px; }
  .org-location-photo { display: block; }
  .org-photo-open { margin-bottom: 16px; }
}
/* The phone opens straight into search; each action has its own breathing room. */
@media (max-width: 760px) {
  .home-screen { padding-top: 28px; }
  .room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-actions { gap: 14px; }
  .detail-organize-actions { gap: 14px; }
  .org-form { gap: 20px; }
  .org-actions, .org-actions-compact, .org-box-hero .org-actions { gap: 14px; }
}
@media (max-width: 580px) {
  .home-screen { padding: 24px 24px 36px; }
  .home-screen .search-box { height: 72px; padding: 10px 12px 10px 16px; gap: 10px; }
  .home-screen .search-box input { font-size: 16px; }
  .add-home-panel { grid-template-columns: 1fr; margin-top: 28px; gap: 14px; }
  .scan-home-button, #add-manual-item { min-height: 62px; padding: 16px 20px; }
  .queue-home-button { margin-top: 22px; padding: 18px; }
  .home-places { margin-top: 40px; }
  .section-heading { gap: 8px 16px; margin-bottom: 20px; }
  .section-heading h2 { font-size: 18px; }
  .section-heading > button { font-size: 14px; }
  .room-grid { grid-template-columns: 1fr; gap: 16px; }
  .room-card { display: grid; grid-template-columns: 84px minmax(0, 1fr) 18px; align-items: center; gap: 18px; padding: 16px; border-radius: 16px; }
  .room-card-art { border-radius: 10px; }
  .room-card-copy { padding: 0; gap: 6px; }
  .room-card-copy strong { font-size: 16px; }
  .room-card-copy > span { font-size: 14px; }
  .room-card > .chevron { position: static; width: 18px; }
  .home-rooms-empty { padding: 24px; }
  .inventory-home-button { margin-top: 24px; }
}
@media (max-width: 360px) {
  .home-screen { padding-left: 20px; padding-right: 20px; }
  .home-screen .search-box { gap: 6px; }
  .home-screen .search-box > svg { display: block; width: 20px; }
  .home-screen .search-box input { font-size: 16px; }
  .scan-home-button, #add-manual-item { gap: 12px; font-size: 15px; padding: 16px; }
  .room-card { grid-template-columns: 64px minmax(0, 1fr) 16px; gap: 14px; padding: 16px 14px; }
  .room-card-copy strong { font-size: 16px; }
  .section-heading > button { font-size: 14px; }
}

/* Shared alignment: all content uses the same gutters and full-width action rows. */
:root { --page-gutter: 28px; }
@media screen {
  .app-shell { max-width: 1040px; }
  .app-shell .topbar { min-height: 80px; padding: max(16px, env(safe-area-inset-top)) var(--page-gutter) 16px; }
  .app-shell .screen { max-width: none; width: 100%; margin: 0; padding: 28px var(--page-gutter) 48px; }
  .wordmark .brand-name { font-size: 24px; font-weight: 600; letter-spacing: -.6px; }
  .wordmark .brand-icon { width: 38px; height: 38px; border-radius: 11px; }
  .brand-icon svg { width: 27px; }
  .screen-intro h1, .results-heading h1, .detail-heading h1, .auth-copy h1, .empty-copy h1,
  .org-heading, .org-manual-dialog .org-heading { font-size: 22px; font-weight: 550; letter-spacing: -.4px; line-height: 1.35; }
  .section-heading h2, .inventory-place > summary strong, .org-box-name,
  .detail-location-card > strong, .detail-inline-editor h2 { font-size: 18px; font-weight: 550; letter-spacing: -.2px; }
  .room-card-copy strong, .item-copy strong, .org-box-card-name { font-size: 16px; font-weight: 550; letter-spacing: 0; }
  .screen h3 { font-size: 17px; font-weight: 550; }
  .primary-button, .secondary-button, .scan-home-button, #add-manual-item, .org-button,
  .detail-organize-actions #detail-open-box { min-height: 48px; padding: 13px 16px; font-size: 15px; font-weight: 500; border-radius: 12px; }
  .auth-field input, .editor-input, .compact-field select, .org-input, .location-level select,
  .location-level input, .search-box input, .home-screen .search-box input { font-size: 16px; }
  .search-box, .home-screen .search-box { height: 64px; padding: 8px 10px 8px 16px; border-radius: 12px; }
  .home-places { margin-top: 32px; }
  .section-heading { margin-bottom: 16px; }
  .add-home-panel, .home-browse-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
  .home-browse-actions > button { width: 100%; min-width: 0; min-height: 48px; margin: 0; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--accent); font-size: 15px; font-weight: 500; cursor: pointer; }
  .home-browse-actions > button:hover { background: var(--accent-soft); }
  #open-boxes { display: grid; grid-template-columns: minmax(0, 1fr) 17px; align-items: center; gap: 14px; text-align: left; }
  .inventory-home-button > span:first-child { font-size: 15px; font-weight: 500; }
  .home-help > summary { min-height: 56px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; }
  .home-help { border: 0; margin-top: 24px; }
  .home-help ol { padding-top: 20px; }
  .room-grid { gap: 16px; }
  .room-card-copy { padding: 18px 36px 18px 18px; }
  .room-card-copy > span { font-size: 13px; }
  .room-card > .chevron { bottom: 36px; }
  .detail-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 20px; }
  .detail-edit-button { width: 100%; min-height: 48px; margin: 0; text-align: center; }
  .detail-photo-button { width: 100%; margin: 0 0 20px; }
  .detail-photo-button .hero-image { width: 100%; height: 260px; aspect-ratio: auto; border-radius: 12px; }
  .real-detail-photo img { object-fit: contain; }
  .detail-organize-actions button { width: 100%; margin: 0; text-align: center; border: 1px solid var(--border); background: var(--surface); }
  .detail-organize-actions button:not(#detail-open-box) { border: 1px solid var(--border); background: var(--surface); text-align: center; }
  .detail-editor-actions, .editor-actions, .inline-editor-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .detail-editor-actions > button, .editor-actions > button, .inline-editor-actions > button { width: 100%; min-width: 0; margin: 0; }
  .screen > button:not(.clear-search), .inventory-storage-content > button, .inventory-furniture-content > button,
  .home-rooms-empty button, .org-content > button, .org-footer > button, .org-form > button,
  .org-field > button { width: 100%; max-width: none; margin-left: 0; margin-right: 0; }
  .org-actions, .org-actions-compact, .org-box-hero .org-actions,
  .org-location-dialog .org-content > .org-actions, .org-location-photo .org-actions {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 14px;
  }
  .org-actions > button { width: 100%; min-width: 0; height: 100%; margin: 0; }
  .org-actions > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .org-select-mode { width: 100%; }
  .org-input { min-height: 50px; }
  .org-box-hero { padding: 18px; }
  .org-location-photo, .org-location-photo:not(.has-photo) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; text-align: left; }
  .org-location-photo .org-photo-heading, .org-location-photo .org-photo-open,
  .org-location-photo .org-actions { grid-column: 1; grid-row: auto; margin: 0; width: 100%; }
  .org-location-photo .org-photo-heading { font-size: 17px; font-weight: 550; }
  .org-photo-open img { width: 100%; height: 180px; object-fit: contain; }
  .org-photo-empty { padding: 16px; text-align: left; }
  .org-location-photo:not(.has-photo) .org-actions { justify-content: stretch; }
  .org-inline-button { font-size: 14px; font-weight: 500; }
  .org-location-dialog .org-content > .org-actions > :first-child { font-weight: 500; }
  .org-box-hero .org-inline-button { font-size: 14px; }
  .org-box-number { font-size: 13px; font-weight: 500; }
  .org-label-reset { display: block; width: calc(100% - 32px); margin: 0 16px 12px; }
  .org-sheet-heading { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .org-sheet-heading .org-inline-button { width: 100%; text-align: center; }

  /* Lists stay on one line; their full location opens in the detail view. */
  .location-result-copy, .search-suggestion-location, .search-result-location { display: grid; min-width: 0; width: 100%; gap: 4px; }
  .location-trail, .location-result-copy > b, .search-suggestion-location > b,
  .search-result-location > b, .org-box-card-path { display: block; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .org-box-card-copy { min-width: 0; }
  .location-path { min-width: 0; width: 100%; margin: 0; font-size: 14px; line-height: 1.5; }
  .location-path > summary { display: grid; grid-template-columns: minmax(0, 1fr) 18px; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; color: var(--muted); }
  .location-path > summary::-webkit-details-marker { display: none; }
  .location-path-line { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .location-path > summary > svg { width: 18px; }
  .location-path[open] > summary > svg { transform: rotate(90deg); }
  .location-path dl { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 12px; margin: 0; padding: 16px 0 4px; border-top: 1px solid var(--border); }
  .location-path dt { color: var(--muted); font-weight: 400; }
  .location-path dd { min-width: 0; margin: 0; color: var(--text); overflow-wrap: anywhere; font-weight: 450; }
  .org-destination:has(.location-path) { padding: 0 12px; }
  #detail-location-path { margin-top: 8px; }
}
@media screen and (max-width: 580px) {
  :root { --page-gutter: 20px; }
  .add-home-panel, .home-browse-actions { grid-template-columns: minmax(0, 1fr); }
  .room-card { grid-template-columns: 64px minmax(0, 1fr) 16px; gap: 16px; padding: 16px; }
  .room-card-copy { padding: 0; gap: 5px; }
  .room-card-copy strong { font-size: 16px; }
  .room-card-copy > span { font-size: 13px; }
  .room-card > .chevron { position: static; }
  .section-heading h2 { font-size: 18px; }
  .org-dialog { padding: 20px; }
  .org-actions, .org-actions-compact, .org-box-hero .org-actions,
  .org-location-dialog .org-content > .org-actions, .org-location-photo .org-actions,
  .detail-editor-actions, .editor-actions, .inline-editor-actions { grid-template-columns: minmax(0, 1fr); }
  .org-box-card { grid-template-columns: 64px minmax(0, 1fr) 16px; padding: 14px; gap: 14px; }
  .org-box-thumb, .org-box-placeholder { width: 64px; height: 70px; }
  .org-box-card-name { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
