* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --body: #fcefbb;
  --ink: #753f25;
  --muted: #825b43;
  --paper: #fffaf0;
  --border: #e6ce91;
  --butter: #f8d974;
  --sage: #e7eddb;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--body);
}
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #8c4c28; outline-offset: 3px; }
button[hidden], [hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font: 700 clamp(2.2rem, 6vw, 4.6rem)/1.03 Georgia, serif; letter-spacing: -.045em; }
h2 { font: 700 1.5rem/1.2 Georgia, serif; }
h3 { margin: 1rem 0 .5rem; font-size: 1rem; }
p, small, .small { color: var(--muted); }
p { line-height: 1.55; }
small, .small { font-size: .82rem; }
code { overflow-wrap: anywhere; font-size: .8rem; }
.loading { padding: 2rem; }
.shell { max-width: 1320px; margin: auto; padding: 0 clamp(14px, 4vw, 46px) 110px; }
.masthead { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--border); }
.identity, .mast-actions, .actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.identity { flex-wrap: nowrap; }
.identity img { width: 48px; height: 48px; border-radius: 12px; }
.identity strong { font: 700 1.35rem Georgia, serif; display: block; white-space: nowrap; }
.identity span, #sync-status { font-size: .8rem; color: var(--muted); }
.mast-actions { justify-content: flex-end; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: clamp(1.5rem, 5vw, 3.4rem) 0 1.35rem; }
.page-heading p { margin-top: .55rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid var(--border); border-radius: 10px; padding: .47rem .82rem; background: var(--paper); color: var(--ink); font-weight: 650; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.selected { background: var(--butter); border-color: #dbb854; }
.btn.danger { color: #8a352b; }
.btn.light { color: var(--ink); }
.btn.tag { min-height: 30px; padding: .2rem .55rem; border-radius: 50px; background: var(--sage); font-size: .78rem; }
.tabs { display: flex; gap: .45rem; margin: 0 0 .85rem; }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: 16px; padding: clamp(.85rem, 2.3vw, 1.45rem); margin-bottom: 1rem; }
.filter-tools { display: grid; grid-template-columns: 2fr repeat(3,minmax(105px,1fr)); gap: .55rem; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; background: #fffdf7; color: var(--ink); min-height: 42px; border-radius: 8px; border: 1px solid var(--border); padding: .5rem .6rem; }
input[type="checkbox"] { accent-color: var(--ink); width: 18px; height: 18px; }
.filter-actions, .section-heading, .dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.filter-actions { margin-top: .75rem; flex-wrap: wrap; }
.section-heading { margin-bottom: .8rem; }
.empty { padding: 1rem; border: 1px dashed #d7ba76; border-radius: 12px; background: #fff9e7; margin: .55rem 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(210px, 45%),1fr)); gap: .75rem; }
.item { min-width: 0; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; background: var(--paper); }
.item-open { display: block; width: 100%; padding: 0; background: transparent; border: 0; text-align: left; color: inherit; }
.item-open:hover .item-details strong { text-decoration: underline; }
.item-photo { display: flex; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden; background: #f8edc7; }
.item-photo img { width: 100%; height: 100%; object-fit: cover; }
.item-photo img.placeholder { object-fit: contain; width: 45%; mix-blend-mode: multiply; opacity: .65; }
.item-details { display: grid; gap: .24rem; padding: .72rem; overflow-wrap: anywhere; }
.item-stock { display: flex; justify-content: space-between; gap: .25rem; margin-top: .35rem; font-size: .82rem; }
.tag-row { padding: 0 .72rem .72rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.compact-list { display: grid; gap: .45rem; }
.compact-list .item-open { display: flex; align-items: stretch; }
.compact-list .item-photo { width: 78px; align-self: stretch; flex: 0 0 78px; }
.compact-list .item-details { flex: 1; }
.compact-list .tag-row { padding-left: calc(78px + .72rem); }
.nav { position: fixed; z-index: 2; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 580px); display: flex; justify-content: space-around; gap: .4rem; background: #fff9e5; border: 1px solid var(--border); border-radius: 20px 20px 0 0; padding: .45rem .7rem max(.52rem, env(safe-area-inset-bottom)); box-shadow: 0 -5px 24px #753f251d; }
.nav-link { border: 0; background: transparent; color: var(--ink); flex: 1; min-height: 55px; border-radius: 13px; display: grid; justify-items: center; align-content: center; gap: .14rem; font-size: .87rem; font-weight: 650; }
.nav-link.current { background: var(--butter); }
.nav-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; width: 100%; padding: .68rem .25rem; border: 0; border-top: 1px solid var(--border); text-align: left; background: transparent; color: inherit; overflow-wrap: anywhere; }
.list-row small, .restock-row small { display: block; margin-top: .18rem; }
.list-row input { max-width: 5rem; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .5rem; }
.stat { background: var(--sage); padding: .65rem; border-radius: 10px; }
.stat small { display: block; margin: 0 0 .18rem; }
.stat strong { font-size: 1.15rem; overflow-wrap: anywhere; }
.restock-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,2fr) auto; align-items: center; gap: .7rem; padding: .8rem 0; border-top: 1px solid var(--border); }
.restock-row:first-of-type { margin-top: .6rem; }
dialog { width: min(calc(100% - 1.35rem), 540px); max-height: min(88dvh, 880px); overflow: auto; border: 1px solid var(--border); border-radius: 17px; padding: 1rem; background: var(--paper); color: var(--ink); }
dialog.wide { width: min(calc(100% - 1.35rem), 720px); }
dialog::backdrop { background: #2f1b14a9; }
.dialog-heading { margin-bottom: .8rem; }
.dialog-actions { display: flex; justify-content: space-between; gap: .5rem; margin-top: .85rem; }
dialog p { margin: .5rem 0; }
#dialog-feedback:empty, #scan-result:empty { display: none; }
.field { display: grid; gap: .26rem; margin: 0 0 .65rem; }
.field span { font-size: .86rem; font-weight: 650; }
.form-grid { display: flex; gap: .5rem; flex-wrap: wrap; }
.form-grid .field { flex: 1 1 100px; }
.form-submit { margin: .15rem 0 .6rem; }
.toggle { display: flex; align-items: center; gap: .4rem; margin: .5rem 0 .68rem; }
.barcode-card { display: grid; justify-items: center; gap: .25rem; margin: .4rem 0 1rem; }
.barcode-card svg { max-width: 100%; width: 290px; height: 65px; background: white; }
.editor-photo { display: block; width: min(100%,250px); border-radius: 10px; }
.category-list, .label-choices { margin-top: .65rem; }
#scan-video { width: 100%; max-height: 35dvh; border-radius: 10px; margin-top: .7rem; background: #3d251a; }
#toast { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 1rem); z-index: 3; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); border-radius: 11px; padding: .66rem .9rem; box-shadow: 0 4px 20px #3e25194d; pointer-events: auto; }
body:has(dialog[open]) #toast { display: none; }
.auth { min-height: 100dvh; padding: 1rem; display: grid; place-items: center; }
.auth-card { width: min(100%, 440px); text-align: center; }
.auth-card > img { width: 158px; border-radius: 12px; margin: 0 0 .7rem; }
.auth-card h1 { font-size: clamp(1.7rem, 6vw, 2.6rem); }
.auth-card p { margin: .6rem 0; }
.auth-card form { text-align: left; margin-top: 1rem; }
@media (max-width: 670px) {
  .page-heading { display: grid; align-items: start; }
  .filter-tools { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .filter-tools input { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .restock-row { grid-template-columns: 1fr; }
  .restock-row > button { justify-self: start; }
  .masthead { min-height: 70px; }
  .mast-actions { gap: .25rem; }
  #sync-status { text-align: right; font-size: .74rem; max-width: 145px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

