

/* Inventory */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--spacer);
}
/* The photo runs edge to edge: the card has no padding of its own (kempo-ui's --card_padding), only the text below it does. */
.item-card { display: block; overflow: hidden; --card_padding: 0; --card_margin: 0; }
.item-card > .p { padding: var(--spacer_h); }
.item-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--item-ratio, 4 / 3);
  background: var(--c_bg__alt);
  color: var(--tc_muted, inherit);
}
.item-photo img { width: 100%; height: 100%; object-fit: cover; }
.item-photo k-icon { width: 3rem; height: 3rem; opacity: 0.4; }
.item-name { text-decoration: none; }
.item-qty { font-size: 1.75rem; font-weight: bold; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--spacer);
}
.stat-value { font-size: 2rem; font-weight: bold; }
.gallery { display: flex; flex-wrap: wrap; gap: var(--spacer_h); }
.gallery img { height: 8rem; width: auto; aspect-ratio: var(--item-ratio, 4 / 3); object-fit: cover; border-radius: var(--radius); border: 1px solid var(--c_border); }
.mb-lg { margin-bottom: calc(2 * var(--spacer)); }
.mt-lg { margin-top: calc(2 * var(--spacer)); }
.py-sm { padding-top: var(--spacer_h); padding-bottom: var(--spacer_h); }
#fields { margin: 0 0 calc(2 * var(--spacer)); align-items: baseline; }
#fields dt { border: 0; padding: 0; margin: 0; }
#fields dd { border: 0; padding: 0; margin: 0; }
.mt-sm { margin-top: var(--spacer_h); }

/* kempo-css sets display on buttons and containers, which would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

/* Scan page */
.scan-result {
  display: flex;
  gap: var(--spacer);
  align-items: center;
  padding: var(--spacer);
  margin: var(--spacer) 0;
  border: 1px solid var(--c_border);
  border-left-width: 0.5rem;
  border-radius: var(--radius);
}
.scan-result.found { border-left-color: #2e7d32; }
.scan-result.none { border-left-color: #f9a825; }
.scan-result.missing { border-left-color: #c62828; }
.scan-photo { width: 5rem; aspect-ratio: var(--item-ratio, 4 / 3); object-fit: cover; border-radius: var(--radius); }
.scan-name { font-size: 1.25rem; font-weight: bold; }
.scan-count { font-size: 1.5rem; }
[aria-pressed="true"].btn { font-weight: bold; }

/* Categories (home) */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: var(--spacer);
}
.cat-card {
  display: block;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--c_border);
  border-radius: var(--radius);
  background: var(--c_bg);
}
.cat-card:focus-visible { box-shadow: var(--focus_shadow); outline: none; }
.cat-image {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--category-ratio, 4 / 3);
  background: var(--c_bg__alt);
}
.cat-image img { width: 100%; height: 100%; object-fit: cover; }
.cat-image k-icon { width: 3rem; height: 3rem; opacity: 0.4; }
.cat-body { display: flex; flex-direction: column; padding: var(--spacer_h) var(--spacer); }

/* Keeps the footer at the bottom of short pages. */
body { display: flex; flex-direction: column; min-height: 100vh; }
#main { flex: 1; width: 100%; box-sizing: border-box; }

/* Standalone on a notched phone: keep content out from under the notch and the home bar. */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
#main-footer { padding-bottom: calc(var(--spacer) + env(safe-area-inset-bottom)); }

/* Tags */
.tag-list { display: flex; flex-wrap: wrap; gap: var(--spacer_q); margin: var(--spacer_q) 0; }
.tag-chip { text-transform: lowercase; display: inline-block; padding: 0 0.6rem; border: 1px solid var(--c_border); border-radius: 1rem; background: var(--c_bg__alt); font-size: 0.85rem; line-height: 1.6; text-decoration: none; }
button.tag-chip { cursor: pointer; font: inherit; font-size: 0.85rem; }
