/* Web admin components (redesign; docs/admin-ui-audit.md §7). Tokens are in
   tokens.css. Everything here is in the "components" layer, which wins over
   the legacy layer (webadmin.css) whatever the selector specificity. */

@layer components {

/* ---------- page frame ---------- */

.container {
  max-width: var(--st-content-max);
  margin: 0 auto;
  padding: var(--st-space-5) var(--st-space-4) var(--st-space-7);
}
/* Wide pages (tables that need the whole window). */
.container.wide { max-width: none; padding-inline: var(--st-space-5); }

/* Skip link: hidden until it gets keyboard focus. */
.skip-link {
  position: absolute;
  left: var(--st-space-2);
  top: var(--st-space-2);
  z-index: var(--st-z-toast);
  padding: var(--st-space-2) var(--st-space-4);
  border-radius: var(--st-radius-md);
  background: var(--st-accent);
  color: var(--st-on-accent);
  font-weight: var(--st-weight-bold);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

/* Shared look of every chevron and line icon. */
.chevron, .shell svg, .toast svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chevron { width: 0.75rem; height: 0.75rem; flex: none; transition: transform var(--st-duration) var(--st-ease); }
details[open] > summary .chevron { transform: rotate(180deg); }

/* ---------- top bar ---------- */

.shell {
  position: relative;
  z-index: var(--st-z-menu);
  background: var(--st-surface);
  border-bottom: 1px solid var(--st-line);
}
.shell__bar {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  min-height: 3.5rem;
  padding: var(--st-space-2) var(--st-space-4);
}
.shell__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--st-space-2);
  flex: none;
  color: var(--st-ink);
  font-weight: var(--st-weight-bold);
  font-size: 1.0625rem;
  text-decoration: none;
}
.shell__brand img { display: block; border-radius: 8.5px; }
.shell__brand-name { display: none; }
/* Logged out (sign-up, invite, reset): nothing else in the bar, so the name fits. */
.shell__bar:not(:has(.shell__space)) .shell__brand-name { display: inline; }

/* Space switcher: the space is the context for everything below it. */
.shell__space { margin: 0; flex: 1 1 auto; min-width: 0; max-width: 16rem; }
.shell__space-button {
  display: flex;
  align-items: center;
  gap: var(--st-space-2);
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--st-space-3);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  color: var(--st-ink);
  font-weight: var(--st-weight-medium);
  cursor: pointer;
  list-style: none;
}
.shell__space-button::-webkit-details-marker { display: none; }
.shell__space-button:hover,
details[open] > .shell__space-button { border-color: var(--st-field); }
.shell__space-button .chevron { margin-left: auto; flex: none; }
.shell__space-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell__space-star { flex: none; color: var(--st-warning-ink); }
.shell__space-panel { width: max(100%, 17rem); max-height: min(28rem, calc(100vh - 6rem)); overflow-y: auto; }
.shell__space-panel .menu__heading { margin-top: var(--st-space-3); }
.shell__space-panel .menu__heading:first-of-type { margin-top: var(--st-space-1); }
.shell__space-panel .shell__space-item { gap: var(--st-space-2); justify-content: flex-start; }
.shell__space-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell__space-check { flex: none; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.shell__space-item.is-current { color: var(--st-accent); font-weight: var(--st-weight-bold); }
.shell__space-item.is-current .shell__space-check { visibility: visible; }
/* All spaces… / New space…: actions, set off from the spaces above. */
.shell__space-actions { margin-top: var(--st-space-2); padding-top: var(--st-space-1); border-top: 1px solid var(--st-line); }
.shell__space-panel .shell__space-action { gap: var(--st-space-2); justify-content: flex-start; color: var(--st-accent); }
.shell__space-action svg { flex: none; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
/* Account menu: Log out under a line. */
.menu__logout { margin: var(--st-space-1) 0 0; padding-top: var(--st-space-1); border-top: 1px solid var(--st-line); }

/* Daily pages and the menu buttons share one look. */
.shell__nav { display: none; align-items: center; gap: var(--st-space-1); }
.shell__menus { display: none; align-items: center; gap: var(--st-space-1); margin-left: auto; }
.shell .nav-link,
.shell__menu-button,
.shell__menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--st-space-2);
  min-height: 2.5rem;
  margin: 0;
  padding: 0 var(--st-space-3);
  border-radius: var(--st-radius-md);
  color: var(--st-ink-muted);
  font-weight: var(--st-weight-medium);
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.shell__menu-button::-webkit-details-marker,
.shell__menu-toggle::-webkit-details-marker { display: none; }
.shell .nav-link:hover,
.shell__menu-button:hover,
.shell__menu-toggle:hover,
details[open] > .shell__menu-button,
details[open] > .shell__menu-toggle { background: var(--st-surface-sunken); color: var(--st-ink); }
.shell .nav-link.active,
.shell__menu-button.active {
  background: var(--st-accent-soft);
  color: var(--st-accent);
  font-weight: var(--st-weight-bold);
}
.shell__account { max-width: 18rem; }
.shell__account-email { overflow: hidden; text-overflow: ellipsis; display: none; }
.shell__account-short { display: inline; }

/* Menu button (phones and tablets). */
.sheet { margin-left: auto; position: static; }
.shell__menu-toggle { color: var(--st-ink); border: 1px solid var(--st-line); }
.shell__menu-toggle svg { width: 1.25rem; height: 1.25rem; }

/* ---------- dropdown menus (Manage, Account) ---------- */

details.menu { position: relative; }
details.menu > summary { margin: 0; }
.menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--st-space-2));
  z-index: var(--st-z-menu);
  display: flex;
  flex-direction: column;
  min-width: 15rem;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: var(--st-space-2);
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow-menu);
  transition: opacity var(--st-duration) var(--st-ease), translate var(--st-duration) var(--st-ease);
}
@starting-style {
  details[open] > .menu__panel, details[open] > .sheet__panel { opacity: 0; translate: 0 -4px; }
}
.menu__panel form { margin: 0; }
.menu__heading {
  margin: var(--st-space-1) var(--st-space-3) var(--st-space-2);
  color: var(--st-ink-muted);
  font-size: var(--st-text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.5rem;
  padding: 0 var(--st-space-3);
  border: 0;
  border-radius: var(--st-radius-md);
  background: none;
  color: var(--st-ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu__item:hover { background: var(--st-surface-sunken); }
.menu__item + .menu__heading { margin-top: var(--st-space-3); }
.menu__item:focus-visible { outline: 2px solid var(--st-focus); outline-offset: -2px; }

/* ---------- Menu sheet (below 1024 px) ---------- */

.sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: var(--st-z-menu);
  max-height: calc(100dvh - 4rem);
  overflow-y: auto;
  padding: var(--st-space-3) var(--st-space-4) var(--st-space-5);
  background: var(--st-surface);
  border-bottom: 1px solid var(--st-line);
  box-shadow: var(--st-shadow-dialog);
  transition: opacity var(--st-duration) var(--st-ease), translate var(--st-duration) var(--st-ease);
}
.sheet__nav { display: flex; flex-direction: column; gap: var(--st-space-1); }
.sheet__nav .nav-link { min-height: 3rem; font-size: 1.0625rem; color: var(--st-ink); }
.sheet__group {
  display: flex;
  flex-direction: column;
  margin-top: var(--st-space-3);
  padding-top: var(--st-space-3);
  border-top: 1px solid var(--st-line);
}
.sheet__group .menu__item { min-height: 3rem; }
.sheet__group form { margin: 0; }

/* Tablets (768 px up): the Menu opens as a dropdown on the right, not full width. */
@media (min-width: 768px) {
  .shell__bar { gap: var(--st-space-4); padding-inline: var(--st-space-5); }
  .shell__brand-name { display: inline; }
  .sheet { position: relative; }
  .sheet__panel {
    left: auto;
    top: calc(100% + var(--st-space-2));
    width: 22rem;
    border: 1px solid var(--st-line);
    border-radius: var(--st-radius-lg);
    box-shadow: var(--st-shadow-menu);
  }
}
/* From 1024 px the bar has room for the daily pages and both menus (the
   whole row needs about 800 px); no Menu button. */
@media (min-width: 1024px) {
  .shell__space { flex: 0 1 14rem; min-width: 8rem; }
  .shell__nav, .shell__menus { display: flex; }
  .sheet { display: none; }
}
@media (min-width: 1280px) {
  .shell__account-email { display: inline; }
  .shell__account-short { display: none; }
}

/* ---------- toasts (Django messages) ---------- */

.toasts {
  display: flex;
  flex-direction: column;
  gap: var(--st-space-2);
  max-width: var(--st-content-max);
  margin: var(--st-space-4) auto 0;
  padding: 0 var(--st-space-4);
}
/* With JavaScript they float, so they're seen wherever the page scrolled to
   (saves on the thing page jump to their section). */
.js .toasts {
  position: fixed;
  z-index: var(--st-z-toast);
  left: var(--st-space-4);
  right: var(--st-space-4);
  bottom: max(var(--st-space-4), env(safe-area-inset-bottom));
  margin: 0;
  padding: 0;
  pointer-events: none;
}
@media (min-width: 768px) {
  .js .toasts { left: auto; right: var(--st-space-5); bottom: auto; top: 4.5rem; width: 26rem; }
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--st-space-3);
  padding: var(--st-space-3) var(--st-space-3) var(--st-space-3) var(--st-space-4);
  background: var(--st-surface);
  color: var(--st-ink);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow-dialog);
  pointer-events: auto;
  transition: opacity var(--st-duration) var(--st-ease), translate var(--st-duration) var(--st-ease);
}
@starting-style { .toast { opacity: 0; translate: 0 8px; } }
.toast.is-leaving { opacity: 0; translate: 0 8px; }
.toast__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.125rem;
  border-radius: var(--st-radius-pill);
  background: var(--st-success-soft);
  color: var(--st-success-ink);
  font-weight: var(--st-weight-bold);
}
.toast__icon svg { width: 1rem; height: 1rem; stroke-width: 2; }
.toast--error .toast__icon { background: var(--st-danger-soft); color: var(--st-danger); }
.toast--warning .toast__icon { background: var(--st-warning-soft); color: var(--st-warning-ink); }
.toast--error { border-color: color-mix(in srgb, var(--st-danger) 35%, var(--st-line)); }
.toast__text { flex: 1; margin: 0.125rem 0 0; overflow-wrap: break-word; min-width: 0; }
.toast__action { margin: 0; }
.toast__button, .toast__close {
  display: inline-grid;
  place-items: center;
  min-height: 2.25rem;
  border: 0;
  border-radius: var(--st-radius-md);
  background: none;
  font: inherit;
  cursor: pointer;
}
.toast__button { padding: 0 var(--st-space-3); color: var(--st-accent); font-weight: var(--st-weight-bold); }
.toast__button:hover { background: var(--st-accent-soft); }
.toast__close { width: 2.25rem; color: var(--st-ink-muted); }
.toast__close:hover { background: var(--st-surface-sunken); color: var(--st-ink); }
.toast__close svg { width: 1rem; height: 1rem; }

/* ---------- page header ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--st-space-1);
  min-height: 2.25rem;
  margin: 0 0 var(--st-space-2) calc(-1 * var(--st-space-2));
  padding: 0 var(--st-space-2);
  border-radius: var(--st-radius-md);
  color: var(--st-ink-muted);
  font-size: var(--st-text-sm);
  font-weight: var(--st-weight-medium);
  text-decoration: none;
}
.back-link::before { content: "\2190"; }
.back-link:hover { background: var(--st-surface-sunken); color: var(--st-ink); }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-space-3) var(--st-space-4);
  margin-bottom: var(--st-space-4);
}
.page-head h1 { margin: 0; }
main > h1:first-child, .back-link + h1 { margin-top: 0; }


/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--st-space-2);
  min-height: var(--st-control-h);
  margin: 0;
  padding: 0 var(--st-space-4);
  border: 1px solid color-mix(in srgb, var(--st-field) 45%, var(--st-line));
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  color: var(--st-ink);
  font: inherit;
  font-weight: var(--st-weight-medium);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: background-color var(--st-duration) var(--st-ease), border-color var(--st-duration) var(--st-ease);
}
.btn::-webkit-details-marker { display: none; }
.btn:hover { background: var(--st-surface-sunken); }
.btn--primary { background: var(--st-accent); border-color: var(--st-accent); color: var(--st-on-accent); font-weight: var(--st-weight-bold); }
.btn--primary:hover { background: var(--st-accent-hover); border-color: var(--st-accent-hover); }
.btn--danger { color: var(--st-danger); border-color: color-mix(in srgb, var(--st-danger) 40%, var(--st-line)); }
.btn--danger:hover { background: var(--st-danger-soft); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--st-accent); }
.btn--quiet:hover { background: var(--st-accent-soft); }
details[open] > summary.btn { background: var(--st-surface-sunken); }

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: var(--st-radius-pill);
  background: var(--st-accent);
  color: var(--st-on-accent);
  font-size: var(--st-text-xs);
  font-weight: var(--st-weight-bold);
  line-height: 1;
}

/* ---------- inputs ---------- */

.input {
  min-width: 0;
  max-width: 100%;
  min-height: var(--st-control-h);
  padding: 0 var(--st-space-3);
  border: 1px solid var(--st-field);
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  color: var(--st-ink);
  font: inherit;
}
.input::placeholder { color: var(--st-ink-muted); opacity: 1; }
.input:hover { border-color: var(--st-ink-muted); }
.input:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 1px; border-color: var(--st-accent); }
/* A date field's calendar button is its own Tab stop inside the field, and
   Chromium counts it only as :focus-within, so date fields ring on that. */
input[type=date]:focus-within { outline: 2px solid var(--st-focus); outline-offset: 1px; }
.input--search { flex: 1 1 16rem; }
.input--short { width: 9.5rem; }
.input--qty { width: 5.5rem; }
.field-inline { display: inline-flex; align-items: center; gap: var(--st-space-2); min-width: 0; }
.field-inline__label { color: var(--st-ink-muted); font-size: var(--st-text-sm); white-space: nowrap; }

/* Checkbox filters as toggle chips: the whole chip is the target. */
.toggles { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--st-space-2);
  min-height: 2.5rem;
  padding: 0 var(--st-space-3);
  border: 1px solid color-mix(in srgb, var(--st-field) 45%, var(--st-line));
  border-radius: var(--st-radius-pill);
  background: var(--st-surface);
  color: var(--st-ink);
  font-size: var(--st-text-sm);
  cursor: pointer;
  user-select: none;
}
.toggle input { width: 1rem; height: 1rem; margin: 0; }
.toggle:hover { background: var(--st-surface-sunken); }
.toggle:has(input:checked) { background: var(--st-accent-soft); border-color: var(--st-accent); color: var(--st-accent); font-weight: var(--st-weight-bold); }
.toggle:has(input:focus-visible) { outline: 2px solid var(--st-focus); outline-offset: 2px; }
.toggle__count { color: var(--st-ink-muted); font-size: var(--st-text-xs); font-weight: var(--st-weight-regular); }

/* ---------- filter panel (Things) ---------- */

.filter-panel {
  display: grid;
  gap: var(--st-space-3);
  margin-bottom: var(--st-space-4);
  padding: var(--st-space-4);
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
}
.filter-panel__top { display: flex; gap: var(--st-space-2); }
.filter-panel__more { display: grid; gap: var(--st-space-3); }
.filter-panel__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-3); }
.filter-panel__group { color: var(--st-ink-muted); font-weight: var(--st-weight-medium); }
.filter-panel__tags > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--st-space-2);
  min-height: 2.5rem;
  margin: 0;
  color: var(--st-ink);
  font-weight: var(--st-weight-medium);
}
.filter-panel__tags .toggles { margin-top: var(--st-space-2); }
.filter-panel__toggle { display: none; }
.columns-menu .menu__panel { max-height: 20rem; overflow-y: auto; }
.menu__panel--left { left: 0; right: auto; }
.menu__check { gap: var(--st-space-2); white-space: nowrap; }
.menu__check .toggle__count { margin-left: auto; }

@media (max-width: 767px) {
  .js .filter-panel__toggle { display: inline-flex; }
  .js .filter-panel__more:not(.is-open) { display: none; }
  .filter-panel__row > .field-inline, .filter-panel__row > .field-inline .input { flex: 1 1 100%; width: 100%; }
}

/* ---------- results head ---------- */

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--st-space-2) var(--st-space-3);
  min-height: 2rem;
  margin: 0 0 var(--st-space-3);
}
.results-head__count { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); font-weight: var(--st-weight-medium); }
.results-head__busy { display: inline-flex; align-items: center; gap: var(--st-space-2); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.results-head__clear { margin-left: auto; font-size: var(--st-text-sm); }
.spinner.spinner--small { width: 0.875rem; height: 0.875rem; margin: 0; border-width: 2px; }

/* ---------- status labels and chips ---------- */

.status {
  display: inline-flex;
  align-items: center;
  margin-left: var(--st-space-1);
  padding: 0.125rem var(--st-space-2);
  border-radius: var(--st-radius-pill);
  font-size: var(--st-text-xs);
  font-weight: var(--st-weight-bold);
  line-height: 1.4;
  vertical-align: 0.1em;
  white-space: nowrap;
}
.status--place { background: var(--st-accent-soft); color: var(--st-accent); }
.status--archived { background: var(--st-surface-sunken); color: var(--st-ink-muted); }
.status--tracker { gap: 0.25em; background: var(--st-surface-sunken); color: var(--st-ink); }
.status__icon { width: 0.85em; height: 0.85em; flex: none; }
.status--done { background: var(--st-success-soft); color: var(--st-success-ink); }
.status--warning { background: var(--st-warning-soft); color: var(--st-warning-ink); }
.status--danger { background: var(--st-danger-soft); color: var(--st-danger); }

/* A code, drawn as the label it is printed on: white tape with a punched hole. */
.code-tape {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin: 0.125rem 0.375rem 0.125rem 0;
  padding: 0.125rem var(--st-space-2) 0.125rem 0.375rem;
  background: var(--st-tape);
  color: var(--st-tape-ink);
  border: 1px solid var(--st-tape-edge);
  border-radius: var(--st-radius-sm);
  box-shadow: 0 1px 0 var(--st-tape-edge);
  font-family: var(--st-font-code);
  font-stretch: 87.5%;
  font-size: 0.8125rem;
  font-weight: var(--st-weight-medium);
  line-height: 1.4;
  white-space: nowrap;
}
.code-tape::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border: 1px solid var(--st-tape-edge);
  border-radius: 50%;
  background: var(--st-canvas);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  margin: 0.125rem 0.25rem 0.125rem 0;
  padding: 0 0.625rem;
  border: 0;
  border-radius: var(--st-radius-pill);
  background: var(--st-surface-sunken);
  color: var(--st-ink);
  font-size: var(--st-text-sm);
  text-decoration: none;
}
a.chip:hover { background: var(--st-accent-soft); color: var(--st-accent); }

/* ---------- empty states ---------- */

.empty-state {
  padding: var(--st-space-6) var(--st-space-5);
  background: var(--st-surface);
  border: 1px dashed color-mix(in srgb, var(--st-field) 45%, var(--st-line));
  border-radius: var(--st-radius-lg);
  color: var(--st-ink-muted);
  text-align: center;
}
.empty-state__title { margin: 0 0 var(--st-space-2); color: var(--st-ink); font-size: var(--st-text-lg); }
.empty-state__text { max-width: 36rem; margin: 0 auto; }
.empty-state--start { text-align: left; border-style: solid; }
.empty-state--start .empty-state__text { margin: 0; }
.start-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--st-space-3);
  margin: var(--st-space-5) 0 0;
  padding: 0;
  list-style: none;
}
.start-option {
  display: flex;
  flex-direction: column;
  gap: var(--st-space-1);
  height: 100%;
  padding: var(--st-space-4);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  background: var(--st-canvas);
  color: var(--st-ink-muted);
  font-size: var(--st-text-sm);
  text-decoration: none;
}
.start-option strong { color: var(--st-accent); font-size: var(--st-text-md); }
a.start-option:hover { border-color: var(--st-accent); background: var(--st-accent-soft); }
.start-option--static strong { color: var(--st-ink); }

/* ---------- things table ---------- */

.table-wrap:has(> .things) {
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
}
.things { width: 100%; border: 0; border-collapse: collapse; background: none; }
.things th, .things td {
  padding: var(--st-space-2) var(--st-space-3);
  border-bottom: 1px solid var(--st-line);
  vertical-align: middle;
  overflow-wrap: break-word;
  max-width: none;
}
.things th {
  color: var(--st-ink-muted);
  font-size: var(--st-text-sm);
  font-weight: var(--st-weight-medium);
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}
.things tbody tr:last-child td { border-bottom: 0; }
/* Column headers sort the list: click once for A to Z, again for Z to A. */
.sort-link { display: inline-flex; align-items: center; gap: var(--st-space-1); margin: calc(-1 * var(--st-space-1)) calc(-1 * var(--st-space-2)); padding: var(--st-space-1) var(--st-space-2); border-radius: var(--st-radius-sm); color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { background: var(--st-surface-sunken); color: var(--st-ink); }
.sort-link.is-sorted { color: var(--st-ink); }
.sort-link__icon { flex: none; width: 0.75rem; height: 0.75rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.45; }
.sort-link:hover .sort-link__icon { opacity: 1; }
.sort-link.is-sorted .sort-link__icon { opacity: 1; stroke: var(--st-accent); stroke-width: 1.75; }
.things tbody tr:not(.load-more):hover { background: color-mix(in srgb, var(--st-surface-sunken) 55%, transparent); }
.things th[data-col] { position: relative; }
/* Drag a header's right edge to change the column's width (columns.js). */
.col-resize { position: absolute; top: 0; right: 0; bottom: 0; z-index: 1; width: 8px; cursor: col-resize; touch-action: none; }
.col-resize::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 0; width: 1px; background: var(--st-line); }
.col-resize:hover::after, .col-resize:focus-visible::after, .is-resizing .col-resize:active::after { top: 0; bottom: 0; width: 2px; background: var(--st-accent); }
.col-resize:focus-visible { outline: none; }
html:not(.js) .col-resize { display: none; }
.things th[data-col]:last-child .col-resize:not(:hover, :focus-visible)::after { display: none; }
.things.is-resizing { cursor: col-resize; user-select: none; }
@media (min-width: 768px) {
  .things.is-sized { table-layout: fixed; width: var(--things-width); }
  /* A column narrower than its text cuts it off (whole words, chips and codes
     never break apart); a detail's full value is in its tooltip. */
  .things.is-sized th, .things.is-sized td { overflow: hidden; }
  .things.is-sized .chip, .things.is-sized .code-tape { white-space: nowrap; }
  .things.is-sized .attr-col { white-space: nowrap; text-overflow: ellipsis; }
}
.things .check-col { width: 2.75rem; padding-inline: var(--st-space-1); }
.things .thumb-col { width: 3.75rem; padding-inline: var(--st-space-1); }
/* Name gets a set width, 350 px (long names wrap), so the spare width goes to
   Codes, Tags and Where instead. */
.things .name-col { width: 350px; min-width: 11rem; overflow-wrap: break-word; }
.things .where-col { min-width: 12rem; }
/* Each place in Where opens that place's page (what's inside it). */
.where-link { color: var(--st-accent); font-weight: var(--st-weight-medium); text-decoration: none; }
.where-link:hover { text-decoration: underline; }
.things .thumb { width: 2.75rem; height: 2.75rem; border-radius: var(--st-radius-md); object-fit: cover; display: block; }
/* A thin frame, so photos on white don't melt into the white row. */
.things img.thumb { border: 1px solid var(--st-line); background: var(--st-surface); }
.things .thumb.empty { background: var(--st-surface-sunken); border: 0; }
.row-link { color: var(--st-accent); font-weight: var(--st-weight-bold); text-decoration: none; }
.row-link:hover { text-decoration: underline; }
.row-check { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: var(--st-radius-md); cursor: pointer; }
.row-check:hover { background: var(--st-surface-sunken); }
.row-check input { width: 1.125rem; height: 1.125rem; margin: 0; cursor: pointer; }
.row-check__text { display: none; }
.things tr:has([data-bulk-row]:checked) { background: var(--st-accent-soft); }
.load-more td { padding: var(--st-space-4); text-align: center; }

/* Phones: each row becomes a card. */
@media (max-width: 767px) {
  .table-wrap:has(> .things) { background: none; border: 0; overflow: visible; }
  .things, .things tbody { display: block; }
  .things thead { display: block; margin-bottom: var(--st-space-2); }
  .things thead tr { display: flex; }
  .things thead th { display: none; border: 0; padding: 0; }
  .things thead th.check-col { display: block; width: auto; }
  .things thead .row-check { width: auto; height: 2.75rem; grid-auto-flow: column; gap: var(--st-space-2); padding: 0 var(--st-space-3) 0 var(--st-space-2); }
  .things thead .row-check__text { display: inline; font-weight: var(--st-weight-medium); }
  /* A card: the tick box above a large photo in a left column of their own,
     the details beside them; the card is at least as tall as both. */
  .things tbody tr {
    --card-pad: var(--st-space-3);
    --card-thumb: 5rem;
    --card-check: 2.75rem;
    position: relative;
    display: block;
    min-height: calc(var(--card-check) + var(--card-thumb) + var(--st-space-2) + var(--card-pad));
    margin-bottom: var(--st-space-2);
    padding: var(--card-pad) var(--card-pad) var(--card-pad) calc(var(--card-pad) * 2 + var(--card-thumb));
    background: var(--st-surface);
    border: 1px solid var(--st-line);
    border-radius: var(--st-radius-lg);
  }
  .things tbody tr:not(.load-more):hover { background: var(--st-surface); }
  .things tr:has([data-bulk-row]:checked) { border-color: var(--st-accent); background: var(--st-accent-soft); }
  .things tbody td { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
  .things tbody td:not(.check-col, .thumb-col, .name-col) { margin-top: var(--st-space-1); }
  .things .name-col, .things .where-col { width: auto; min-width: 0; }
  .things tbody td.check-col { position: absolute; top: var(--st-space-2); left: var(--card-pad); }
  .things tbody td.thumb-col { position: absolute; top: calc(var(--st-space-2) + var(--card-check)); left: var(--card-pad); }
  /* The tap area stays 44 px; the box itself lines up with the photo's edge. */
  .things .row-check { width: var(--card-check); height: var(--card-check); margin-left: -0.8125rem; }
  .things .thumb { width: 5rem; height: 5rem; }
  .things .codes-col:not(:has(*)), .things .tags-col:not(:has(*)), .things .attr-col:empty { display: none; }
  .things .where-col { font-size: var(--st-text-sm); color: var(--st-ink-muted); }
  .things .attr-col { font-size: var(--st-text-sm); }
  .things .attr-col::before { content: attr(data-label) ": "; color: var(--st-ink-muted); }
  .things tbody tr.load-more { display: block; min-height: 0; padding: var(--st-space-3); }
  .things tbody tr.load-more td { display: block; padding: 0; }
}

/* ---------- bulk bar (things selected) ---------- */

.bulk-bar {
  position: sticky;
  top: var(--st-space-2);
  z-index: var(--st-z-sticky);
  display: grid;
  gap: var(--st-space-3);
  margin: 0 0 var(--st-space-3);
  padding: var(--st-space-3) var(--st-space-4);
  background: var(--st-surface);
  border: 1px solid var(--st-accent);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow-menu);
}
.bulk-bar__head { display: flex; align-items: center; gap: var(--st-space-2); }
.bulk-bar__head strong { margin-right: auto; }
.bulk-bar__toggle, .bulk-bar__clear { display: none; min-height: 2.5rem; }
.js .bulk-bar__clear { display: inline-flex; }
.bulk-bar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-3) var(--st-space-5); }
.bulk-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); }

/* Phones: a bar at the bottom; Actions opens the choices above it. */
@media (max-width: 767px) {
  .js .bulk-bar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    max-height: 70dvh;
    overflow-y: auto;
    padding: var(--st-space-3) var(--st-space-4) max(var(--st-space-3), env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: var(--st-radius-lg) var(--st-radius-lg) 0 0;
    box-shadow: var(--st-shadow-dialog);
  }
  .js .bulk-bar__toggle { display: inline-flex; }
  .js .bulk-bar__actions:not(.is-open) { display: none; }
  .bulk-bar__actions { flex-direction: column; align-items: stretch; }
  .bulk-group { border-top: 1px solid var(--st-line); padding-top: var(--st-space-3); }
  .bulk-group > .input, .bulk-group > .field-inline { flex: 1 1 8rem; }
  .bulk-group > .btn { flex: 1 1 auto; }
  /* Room under the last card, and toasts above the bar. */
  html.js:has(.bulk-bar:not([hidden])) main { padding-bottom: 6rem; }
  html.js:has(.bulk-bar:not([hidden])) .toasts { bottom: 5.5rem; }
}


/* ---------- form controls everywhere ----------
   Every button and field in the admin gets the .btn / .input look, also
   ones without those classes. :where() keeps these at zero specificity, so
   any component class above can adjust them.
   Not touched: the import preview's inline cell editor and column menu. */

:where(button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--st-space-2);
  min-height: var(--st-control-h);
  margin: 0;
  padding: 0 var(--st-space-4);
  border: 1px solid color-mix(in srgb, var(--st-field) 45%, var(--st-line));
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  color: var(--st-ink);
  font: inherit;
  font-weight: var(--st-weight-medium);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  transition: background-color var(--st-duration) var(--st-ease), border-color var(--st-duration) var(--st-ease);
}
:where(button):hover { background: var(--st-surface-sunken); }
:where(button):disabled { opacity: 0.55; cursor: not-allowed; }

.btn--small { min-height: 2.25rem; padding: 0 var(--st-space-3); font-size: var(--st-text-sm); }
/* The confirming button on "can't be undone" pages: solid red. */
.btn--danger-solid {
  background: var(--st-danger);
  border-color: var(--st-danger);
  color: var(--st-surface);
  font-weight: var(--st-weight-bold);
}
.btn--danger-solid:hover { background: color-mix(in srgb, var(--st-danger) 85%, var(--st-ink)); }
@media (prefers-color-scheme: dark) {
  .btn--danger-solid { color: var(--st-on-accent); }
}
:where(button).chip-x {
  min-height: 1.75rem;
  width: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--st-radius-pill);
  background: transparent;
  color: var(--st-ink-muted);
}
:where(button).chip-x:hover { background: var(--st-danger-soft); color: var(--st-danger); }
:where(button).menu-button {
  justify-content: flex-start;
  width: 100%;
  min-height: 2.25rem;
  padding: 0 var(--st-space-3);
  border: 0;
  background: none;
  font-weight: var(--st-weight-regular);
}
.btn--block { width: 100%; }

:where(input[type=text], input[type=search], input[type=email], input[type=password],
       input[type=url], input[type=number], input[type=date], select, textarea):where(:not(.cell-input, .case-menu input)) {
  min-width: 0;
  min-height: var(--st-control-h);
  padding: 0 var(--st-space-3);
  border: 1px solid var(--st-field);
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  color: var(--st-ink);
  font: inherit;
}
/* A long option must not make a dropdown wider than the screen (widths
   the pages set for text fields are left alone). */
:where(select) { max-width: 100%; }
:where(textarea):where(:not(.cell-input)) { padding: var(--st-space-2) var(--st-space-3); line-height: var(--st-leading-body); }
:where(input, select, textarea):where(:not(.cell-input, .case-menu input))::placeholder { color: var(--st-ink-muted); opacity: 1; }
:where(input[type=text], input[type=search], input[type=email], input[type=password],
       input[type=url], input[type=number], input[type=date], select, textarea):where(:not(.cell-input, .case-menu input)):hover { border-color: var(--st-ink-muted); }
:where(input, select, textarea):focus-visible { outline: 2px solid var(--st-focus); outline-offset: 1px; }
[aria-invalid=true] { border-color: var(--st-danger) !important; }

:where(input[type=checkbox], input[type=radio]) { width: 1.125rem; height: 1.125rem; margin: 0.125rem 0 0; flex: none; cursor: pointer; }

/* File picker: the button part looks like a button. */
:where(input[type=file]) { max-width: 100%; color: var(--st-ink-muted); font: inherit; font-size: var(--st-text-sm); }
:where(input[type=file])::file-selector-button {
  min-height: var(--st-control-h);
  margin-right: var(--st-space-3);
  padding: 0 var(--st-space-4);
  border: 1px solid color-mix(in srgb, var(--st-field) 45%, var(--st-line));
  border-radius: var(--st-radius-md);
  background: var(--st-surface);
  color: var(--st-ink);
  font: inherit;
  font-size: var(--st-text-md);
  font-weight: var(--st-weight-medium);
  cursor: pointer;
}
:where(input[type=file])::file-selector-button:hover { background: var(--st-surface-sunken); }

/* Checkbox with its label (and an optional hint under the label). */
.check { display: flex; align-items: flex-start; gap: var(--st-space-2); cursor: pointer; }
.check .field__hint { display: block; }

/* ---------- forms: fields, hints, errors ---------- */

.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--st-space-4); }
.form-card { padding: var(--st-space-5); }
.form-intro { margin: 0; color: var(--st-ink-muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); padding-top: var(--st-space-2); }
.field { display: grid; gap: var(--st-space-1); min-width: 0; }
.field > .input { width: 100%; max-width: 36rem; }
.field > .input--qty { width: 6rem; }
.field__label { color: var(--st-ink); font-weight: var(--st-weight-bold); }
.field__optional { color: var(--st-ink-muted); font-weight: var(--st-weight-regular); }
.field__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); }
.field__row > .input, .field__row > input[type=text] { flex: 1 1 12rem; max-width: 24rem; }
.field__hint { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); font-weight: var(--st-weight-regular); }
.field__error {
  display: flex;
  gap: var(--st-space-2);
  margin: 0;
  color: var(--st-danger);
  font-size: var(--st-text-sm);
  font-weight: var(--st-weight-medium);
}
.field__error::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: var(--st-danger);
  color: var(--st-surface);
  font-size: 0.75rem;
  font-weight: var(--st-weight-bold);
}
.field__error a { color: inherit; font-weight: var(--st-weight-bold); }
.field-group {
  display: grid;
  gap: var(--st-space-3);
  margin: 0;
  padding: var(--st-space-4);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
}
.field-group > legend { padding: 0 var(--st-space-1); }
.form-alert {
  margin: 0;
  padding: var(--st-space-3) var(--st-space-4);
  border-radius: var(--st-radius-md);
  background: var(--st-danger-soft);
  color: var(--st-danger);
  font-weight: var(--st-weight-medium);
}
.form-alert a { color: inherit; font-weight: var(--st-weight-bold); }

/* ---------- account pages (log in, sign up, invite, reset, messages) ---------- */

.auth-page {
  display: grid;
  place-items: start center;
  min-height: 100dvh;
  margin: 0;
  padding: var(--st-space-4);
  background: var(--st-canvas);
}
.auth-card {
  width: 100%;
  max-width: 28rem;
  margin: var(--st-space-6) auto;
  padding: var(--st-space-6) var(--st-space-5);
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
}
.auth-page .auth-card { margin-top: 10vh; }
.auth-card__brand {
  display: flex;
  align-items: center;
  gap: var(--st-space-2);
  margin: 0 0 var(--st-space-5);
  color: var(--st-ink);
  font-size: 1.125rem;
  font-weight: var(--st-weight-bold);
}
.auth-card__brand img { border-radius: 8px; }
.auth-card__title { margin: 0 0 var(--st-space-4); font-size: var(--st-text-xl); }
.auth-card__subtitle { margin: var(--st-space-5) 0 var(--st-space-3); font-size: var(--st-text-lg); }
.auth-card__lead { margin: 0 0 var(--st-space-4); }
.auth-card .form-alert { margin-bottom: var(--st-space-4); }
.auth-card .form > .btn--block { margin-top: var(--st-space-2); }
.auth-card__note { margin: var(--st-space-5) 0 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.auth-card__alt { margin-top: var(--st-space-5); padding-top: var(--st-space-2); border-top: 1px solid var(--st-line); }
.auth-card__alt p { margin: 0; }
.btn--google svg { flex: none; }
.auth-card__hint { margin: var(--st-space-2) 0 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.auth-card__or { display: flex; align-items: center; gap: var(--st-space-3); margin: var(--st-space-4) 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.auth-card__or::before, .auth-card__or::after { content: ""; flex: 1; border-top: 1px solid var(--st-line); }
@media (max-width: 479px) {
  .auth-card { padding: var(--st-space-5) var(--st-space-4); margin-top: var(--st-space-4); }
}


/* ---------- cards and sections ---------- */

.card {
  margin: 0 0 var(--st-space-4);
  padding: var(--st-space-5);
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
}
.card > h2:first-child, .card > summary:first-child { margin-top: 0; }
.card h2 { margin: 0 0 var(--st-space-4); font-size: var(--st-text-lg); }
.section__part { margin-top: var(--st-space-5); padding-top: var(--st-space-5); border-top: 1px solid var(--st-line); }
.section__empty { margin: 0 0 var(--st-space-3); color: var(--st-ink-muted); }
.section__inline { display: inline-block; margin: var(--st-space-2) 0 0; }
.section--quiet { background: transparent; border-style: dashed; }
.section-plain { margin: var(--st-space-6) 0 var(--st-space-4); }
.section-plain__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--st-space-2) var(--st-space-4); margin-bottom: var(--st-space-3); }
.section-plain__head h2 { margin: 0; font-size: var(--st-text-lg); }
@media (max-width: 479px) {
  .card { padding: var(--st-space-4); }
}

/* Small square button for an icon (←, →, ✕). */
.btn--icon { width: 2.25rem; padding: 0; }

/* A summary that opens a small form below it (Move…, Remove…, Change code). */
.disclosure > summary { margin: 0; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure[open] > summary { background: var(--st-accent-soft); }
.disclosure__body { margin-top: var(--st-space-3); padding: var(--st-space-4); background: var(--st-canvas); border: 1px solid var(--st-line); border-radius: var(--st-radius-md); }

/* A warning before something that can't be taken back (amber, not green). */
.warning {
  margin: 0;
  padding: var(--st-space-3) var(--st-space-4);
  border-radius: var(--st-radius-md);
  background: var(--st-warning-soft);
  color: var(--st-warning-ink);
}

/* ---------- thing page ---------- */

/* Summary card: photo on the left, the facts and main actions on the right;
   one column on a phone. */
.thing-summary { display: flex; flex-wrap: wrap; gap: var(--st-space-5) var(--st-space-6); }
.thing-summary__media { flex: 0 0 17.5rem; max-width: 100%; display: grid; gap: var(--st-space-2); align-content: start; }
.thing-summary__photos { display: grid; gap: var(--st-space-2); }
.thing-summary__main { display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--st-line); border-radius: var(--st-radius-md); background: var(--st-surface-sunken); cursor: zoom-in; }
.thing-summary__main img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thing-summary__strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--st-space-2); margin: 0; padding: 0; list-style: none; }
.thing-summary__strip a { display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--st-line); border-radius: var(--st-radius-sm); background: var(--st-surface-sunken); cursor: zoom-in; }
.thing-summary__strip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thing-summary__more-photos { font-size: var(--st-text-sm); }
.thing-summary__nophoto { display: grid; place-items: center; align-content: center; gap: var(--st-space-1); aspect-ratio: 1; border: 1px dashed var(--st-field); border-radius: var(--st-radius-md); background: var(--st-canvas); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.thing-summary__nophoto svg { width: 2.5rem; height: 2.5rem; fill: none; stroke: currentColor; stroke-width: 1.5; }
.thing-summary__facts { flex: 1 1 22rem; min-width: 0; display: grid; gap: var(--st-space-4); align-content: start; }
.thing-summary__head { display: grid; gap: var(--st-space-2); }
.thing-summary__title-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-3); }
.thing-summary__head.is-editing, .thing-summary__tagbox.is-editing { padding: var(--st-space-4); border: 2px solid var(--st-accent); border-radius: var(--st-radius-md); }
.thing-summary__tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); }
.thing-summary__tagbox .tag-list { margin-bottom: var(--st-space-3); }
.thing-summary h1 { margin: 0; overflow-wrap: break-word; }
.thing-summary__codes { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin: 0; }
.thing-summary__desc { margin: 0; max-width: 65ch; color: var(--st-ink-muted); white-space: pre-line; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.thing-summary__where { display: grid; gap: var(--st-space-1); padding: var(--st-space-3) var(--st-space-4); border-radius: var(--st-radius-md); background: var(--st-canvas); }
.thing-summary__where p { margin: 0; }
.thing-summary__label { color: var(--st-ink-muted); font-size: var(--st-text-xs); font-weight: var(--st-weight-bold); letter-spacing: 0.04em; text-transform: uppercase; }
.thing-summary__path { font-size: 1.0625rem; overflow-wrap: anywhere; }
.thing-summary__where-actions { margin-top: var(--st-space-1) !important; }
.thing-summary__details { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--st-space-3) var(--st-space-5); margin: 0; }
.thing-summary__details dt { color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.thing-summary__details dd { margin: 0; overflow-wrap: anywhere; }
.thing-summary__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
.thing-summary__more summary { display: inline-flex; align-items: center; gap: var(--st-space-1); }
.thing-summary__more .menu-list { left: 0; right: auto; }
.thing-summary__meta { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
@media (max-width: 599px) {
  .thing-summary__media { flex-basis: 100%; }
  .thing-summary__main { aspect-ratio: 4 / 3; }
  .thing-summary__details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--st-space-4);
  margin: 0 0 var(--st-space-4);
  padding: 0;
  list-style: none;
}
.photo-tile { position: relative; display: grid; gap: var(--st-space-2); align-content: start; }
.photo-tile__image { display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--st-line); border-radius: var(--st-radius-md); background: var(--st-surface-sunken); }
.photo-tile__image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-tile__main { position: absolute; top: var(--st-space-2); left: var(--st-space-2); margin: 0; box-shadow: 0 1px 2px rgb(0 0 0 / 0.15); }
.photo-tile__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-1); }
.photo-tile__actions form { margin: 0; }
.photo-add { display: grid; gap: var(--st-space-3); }
.photo-add__url { flex: 1 1 16rem !important; max-width: none !important; }
.dropzone {
  margin: 0;
  padding: var(--st-space-5);
  border: 2px dashed color-mix(in srgb, var(--st-field) 50%, var(--st-line));
  border-radius: var(--st-radius-lg);
  background: var(--st-canvas);
  color: var(--st-ink);
  text-align: center;
  line-height: 1.5;
}
.dropzone .muted { display: block; margin-top: var(--st-space-1); font-size: var(--st-text-sm); }
.dropzone.is-dragging { border-color: var(--st-accent); background: var(--st-accent-soft); }
/* Touch screens can't drag or paste files: the plain buttons are enough. */
@media (pointer: coarse) { .dropzone { display: none; } }

.tag-list { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin: 0 0 var(--st-space-4); }
.tag-list .section__empty { margin: 0; }
.chip-form { display: inline-flex; align-items: center; margin: 0; padding-right: 0.125rem; border-radius: var(--st-radius-pill); background: var(--st-surface-sunken); }
.chip-form .chip { margin: 0; background: transparent; }
.chip-form .chip-x { min-height: 1.75rem; width: 1.75rem; font-size: 0.75rem; }

.attr-rows { display: grid; gap: var(--st-space-2); }
.attr-row { display: grid; grid-template-columns: minmax(8rem, 14rem) minmax(0, 1fr) auto; gap: var(--st-space-2); align-items: center; margin: 0; }
.attr-row .input { width: 100%; max-width: none; }
@media (max-width: 479px) {
  .attr-row { grid-template-columns: minmax(0, 1fr) auto; }
  .attr-row .input:first-child { grid-column: 1 / -1; }
}

.code-list { display: grid; gap: var(--st-space-3); margin: 0 0 var(--st-space-2); }
.code-item { padding: 0 0 var(--st-space-3); border-bottom: 1px solid var(--st-line); }
.code-item:last-child { padding-bottom: 0; border-bottom: 0; }
.code-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-3); margin-bottom: var(--st-space-2); }
.code-line__type { color: var(--st-ink-muted); font-size: var(--st-text-xs); font-weight: var(--st-weight-bold); letter-spacing: 0.02em; }
.code-line__actions { display: inline-flex; gap: var(--st-space-2); margin-left: auto; }
.code-line__actions form { margin: 0; }
.code-tape--large { font-size: 0.9375rem; padding: 0.25rem var(--st-space-3) 0.25rem var(--st-space-2); }

.stock-row { display: grid; gap: var(--st-space-3); padding: var(--st-space-4) 0; border-bottom: 1px solid var(--st-line); }
.stock-row:first-of-type { padding-top: 0; }
.stock-where { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--st-space-1) var(--st-space-2); font-size: 1.0625rem; }
.stock-where__sep { color: var(--st-ink-muted); }
.stock-where__qty { font-variant-numeric: tabular-nums; }
.stock-where__browse { margin-left: auto; font-size: var(--st-text-sm); }
.stock-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--st-space-2) var(--st-space-3); margin: 0; }
.stock-actions > .disclosure[open] { flex-basis: 100%; }
.stock-actions__qty .note { flex: 1 1 12rem; max-width: 20rem; }
/* Quantity boxes keep their size inside a row of fields. */
.field__row > .input--qty { flex: none; width: 6rem; }
.add-stock { margin-top: var(--st-space-4); }
.section-plain__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-4); margin-left: auto; }
/* Put things here: a panel above what's inside, opened by the head's button. */
.inside-add { margin: 0 0 var(--st-space-4); padding: var(--st-space-4); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); }
.section-plain > [data-inside-toggle] + noscript + .inside-add, .section-plain > [data-inside-toggle] + .inside-add { margin-top: var(--st-space-3); }
.inside-add .inside-pick { background: var(--st-canvas); }
.inside-add .field > .input { max-width: 36rem; }
.inside-add .inside-add__show { display: flex; margin: var(--st-space-2) 0 0; }
.inside-add__more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-2); margin: calc(-1 * var(--st-space-2)) 0 var(--st-space-3); }
.inside-add form.js.has-pick .inside-add__show, .inside-add form.js.has-pick .inside-add__more { display: none; }
.inside-pick { margin: var(--st-space-2) 0 var(--st-space-3); padding: 0 var(--st-space-3); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); }
.inside-pick__item + .inside-pick__item { border-top: 1px solid var(--st-line); }
.inside-pick__row { display: grid; grid-template-columns: auto 2.75rem minmax(0, 1fr) auto; align-items: center; gap: var(--st-space-3); min-height: 3.5rem; padding: var(--st-space-2) 0; cursor: pointer; }
.inside-pick__row:hover .inside-pick__name { text-decoration: underline; }
.inside-pick__thumb .thumb { display: block; width: 2.75rem; height: 2.75rem; border-radius: var(--st-radius-sm); }
.inside-pick__main { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.inside-pick__name { overflow-wrap: anywhere; color: var(--st-accent); }
.inside-pick__name .code-tape { margin: 0; }
.inside-pick__where { color: var(--st-ink-muted); font-size: var(--st-text-sm); overflow-wrap: anywhere; }
.inside-pick__where .status { margin: 0; }
.inside-pick__codes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--st-space-1); }
.inside-pick__codes .code-tape { margin: 0; }
.inside-add form.js .inside-pick__row { grid-template-columns: 2.75rem minmax(0, 1fr) auto; }
.inside-add form.js .inside-pick__radio { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inside-add form.js .inside-pick__row:has(:focus-visible) { outline: 2px solid var(--st-accent); outline-offset: 2px; border-radius: var(--st-radius-sm); }
.inside-add form.js:not(.has-pick) .inside-add__rest { display: none; }
.inside-add form.js.has-pick .inside-pick__item:not(.is-picked) { display: none; }
.inside-add form.js.has-pick .inside-pick__row { cursor: default; }
.inside-add form.js.has-pick .field > .field__hint, .inside-add form.js.has-pick #inside-results .field__hint { display: none; }
.inside-add form.js.has-pick .inside-pick { margin-bottom: var(--st-space-1); }
.inside-add__change { margin: 0; display: flex; justify-content: flex-end; }
.inside-add__change .btn { padding-right: 0; }
.inside-add__change[hidden] { display: none; }
@media (max-width: 767px) {
  .inside-pick__row, .inside-add form.js .inside-pick__row { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .inside-add:not(:has(form.js)) .inside-pick__row { grid-template-columns: auto 2.5rem minmax(0, 1fr); }
  .inside-pick__thumb .thumb { width: 2.5rem; height: 2.5rem; }
  .inside-pick__codes { grid-column: 2 / -1; justify-content: flex-start; }
}
.inside-add fieldset { border: 0; padding: 0; margin: var(--st-space-3) 0; display: grid; gap: var(--st-space-1); }
.inside-add fieldset[hidden] { display: none; }

/* ---------- plain tables ---------- */

.table-wrap:has(> .table:not(.things)) {
  overflow-x: auto;
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
}
/* The things table and the import preview have their own rules. */
.table:not(.things, .import-table) { width: 100%; border: 0; border-collapse: collapse; background: var(--st-surface); }
.table-wrap > .table:not(.things, .import-table) { background: none; }
.table:not(.things, .import-table) :is(th, td) { padding: var(--st-space-3); border-bottom: 1px solid var(--st-line); text-align: left; vertical-align: middle; overflow-wrap: break-word; }
.table:not(.things, .import-table) th {
  color: var(--st-ink-muted);
  font-size: var(--st-text-sm);
  font-weight: var(--st-weight-medium);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.table:not(.things, .import-table) tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }


/* ---------- confirmations ---------- */

/* Pages that ask before something big happens (delete, merge, remove). */
.confirm { max-width: 40rem; margin: 0 auto; }
.confirm__card { padding: var(--st-space-6) var(--st-space-5); }
.confirm__title { margin: 0 0 var(--st-space-3); font-size: var(--st-text-xl); overflow-wrap: break-word; }
.confirm__subtitle { margin: var(--st-space-5) 0 var(--st-space-3); font-size: var(--st-text-md); }
.confirm__title + .confirm__subtitle { margin-top: var(--st-space-4); }
.confirm__lead { margin: 0 0 var(--st-space-4); }
.confirm__note, .confirm__meta { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.confirm__facts { display: grid; gap: var(--st-space-2); margin: 0 0 var(--st-space-4); }
.confirm__facts > div { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: var(--st-space-3); padding-bottom: var(--st-space-2); border-bottom: 1px solid var(--st-line); }
.confirm__facts dt { color: var(--st-ink-muted); font-weight: var(--st-weight-medium); }
.confirm__facts dd { margin: 0; }
.confirm__list { display: grid; gap: var(--st-space-1); margin: 0 0 var(--st-space-4); max-height: 24rem; overflow-y: auto; }
.confirm__list > li { display: grid; gap: 0.125rem; padding: var(--st-space-2) 0; border-bottom: 1px solid var(--st-line); }
.confirm__card .warning, .confirm__card .form-alert { margin: var(--st-space-4) 0; }
.confirm__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin: var(--st-space-5) 0 0; }
.confirm__step { margin-top: var(--st-space-4); }
@media (max-width: 479px) {
  .confirm__card { padding: var(--st-space-5) var(--st-space-4); }
  .confirm__actions > .btn { flex: 1 1 100%; }
}

/* The dialog that asks before a small destructive action. */
.dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  background: var(--st-surface);
  color: var(--st-ink);
  box-shadow: var(--st-shadow-dialog);
  transition: opacity var(--st-duration) var(--st-ease), translate var(--st-duration) var(--st-ease), overlay var(--st-duration) allow-discrete, display var(--st-duration) allow-discrete;
}
.dialog[open] { opacity: 1; translate: 0 0; }
@starting-style { .dialog[open] { opacity: 0; translate: 0 8px; } }
.dialog::backdrop { background: rgb(20 16 12 / 0.45); }
.dialog__body { display: grid; gap: var(--st-space-3); margin: 0; padding: var(--st-space-5); }
.dialog__title { margin: 0; font-size: var(--st-text-lg); overflow-wrap: break-word; }
.dialog__text { margin: 0; color: var(--st-ink-muted); }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--st-space-2); margin-top: var(--st-space-2); }
@media (max-width: 479px) {
  .dialog__actions { flex-direction: column-reverse; }
  .dialog__actions > .btn { width: 100%; }
}

/* Photo viewer (photo_viewer.js): a photo large over the page, on near-black in
   either theme so the photo's own colours read true. */
.photo-viewer {
  inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0;
  border: 0; background: rgb(12 10 8); color: #f4efe9;
  display: none; grid-template-rows: auto 1fr;
}
.photo-viewer[open] { display: grid; }
.photo-viewer::backdrop { background: rgb(12 10 8 / 0.6); }
html:has(.photo-viewer[open]) { overflow: hidden; }
.photo-viewer__bar {
  display: flex; align-items: center; gap: var(--st-space-3);
  padding: var(--st-space-2) var(--st-space-3) var(--st-space-2) var(--st-space-4);
  padding-top: calc(var(--st-space-2) + env(safe-area-inset-top));
}
.photo-viewer__title { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--st-weight-medium); }
.photo-viewer__count { margin-left: var(--st-space-2); color: rgb(244 239 233 / 0.65); font-weight: var(--st-weight-regular); }
.photo-viewer__original { flex: none; color: inherit; font-size: var(--st-text-sm); }
.photo-viewer__close, .photo-viewer__nav {
  display: grid; place-items: center; flex: none; padding: 0; border: 0; border-radius: 999px;
  background: rgb(255 255 255 / 0.12); color: inherit; font: inherit; cursor: pointer;
}
.photo-viewer__close { width: 2.75rem; height: 2.75rem; font-size: 1.1rem; }
.photo-viewer__close:hover, .photo-viewer__nav:hover { background: rgb(255 255 255 / 0.22); }
.photo-viewer :is(button, a):focus-visible { outline: 2px solid #f4efe9; outline-offset: 2px; }
.photo-viewer__stage {
  position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden;
  padding: 0 var(--st-space-3) calc(var(--st-space-3) + env(safe-area-inset-bottom));
}
.photo-viewer__img {
  /* Fit the screen: a percentage height doesn't resolve inside the grid row,
     so the bar's height (about 3.75rem) is taken off the viewport. */
  grid-area: 1 / 1; max-width: 100%;
  max-height: calc(100dvh - 3.75rem - var(--st-space-3) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  object-fit: contain;
  border-radius: var(--st-radius-sm); user-select: none; touch-action: pan-y pinch-zoom;
}
.photo-viewer.is-loading .photo-viewer__img, .photo-viewer.is-failed .photo-viewer__img { visibility: hidden; }
.photo-viewer__status { grid-area: 1 / 1; margin: 0; padding: 0 var(--st-space-5); text-align: center; color: rgb(244 239 233 / 0.75); }
.photo-viewer:not(.is-loading):not(.is-failed) .photo-viewer__status { display: none; }
.photo-viewer__nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 1;
  width: 3rem; height: 3rem; font-size: 2rem; line-height: 1;
}
.photo-viewer__nav[hidden] { display: none; }
.photo-viewer__nav--prev { left: var(--st-space-3); }
.photo-viewer__nav--next { right: var(--st-space-3); }
@media (max-width: 599px) {
  /* On a phone the photo gets the full width; swipe, or the buttons along the bottom. */
  .photo-viewer__nav { top: auto; bottom: calc(var(--st-space-3) + env(safe-area-inset-bottom)); translate: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .photo-viewer[open] { animation: photo-viewer-in var(--st-duration) var(--st-ease); }
  @keyframes photo-viewer-in { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- Locations: the place tree ---------- */

.page-intro { margin: calc(-1 * var(--st-space-2)) 0 var(--st-space-4); color: var(--st-ink-muted); }
.input--small { min-height: 2.25rem; padding-block: 0; font-size: var(--st-text-sm); }

.filter-panel__top > .toggle { flex: none; white-space: nowrap; }
.filter-panel__top > .input--search { min-width: 0; }
/* Locations: two toggles; below ~16rem of search they wrap under it. */
.filter-panel__top--wrap { flex-wrap: wrap; }
.filter-panel__top--wrap > .input--search { flex: 1 1 16rem; }
.filter-panel { grid-template-columns: minmax(0, 1fr); }
.loc-top { display: grid; gap: var(--st-space-2); }
.loc-section { margin: var(--st-space-6) 0 var(--st-space-3); font-size: var(--st-text-lg); }
.loc {
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  scroll-margin-top: var(--st-space-4);
}
.loc__head {
  display: flex;
  align-items: center;
  gap: var(--st-space-3);
  min-height: 3.25rem;
  margin: 0;
  padding: var(--st-space-2) var(--st-space-4) var(--st-space-2) var(--st-space-3);
  border-radius: inherit;
  color: var(--st-ink);
  list-style: none;
  cursor: pointer;
}
.loc__head::-webkit-details-marker { display: none; }
.loc__head:hover { background: color-mix(in srgb, var(--st-surface-sunken) 60%, transparent); }
.loc__head:focus-visible { outline: 2px solid var(--st-focus); outline-offset: -2px; }
.loc[open] > .loc__head { border-bottom: 1px solid var(--st-line); border-end-start-radius: 0; border-end-end-radius: 0; }
.loc__chevron {
  flex: none;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--st-ink-muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--st-duration) var(--st-ease);
}
.loc[open] > .loc__head > .loc__chevron { transform: rotate(90deg); }
.loc__title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-1) var(--st-space-2); flex: 1 1 auto; min-width: 0; }
.loc__title .code-tape, .loc__title .status { margin: 0; }
.loc__name { font-weight: var(--st-weight-bold); overflow-wrap: anywhere; }
.loc__count { flex: none; color: var(--st-ink-muted); font-size: var(--st-text-sm); white-space: nowrap; }
.loc__qty { flex: none; color: var(--st-ink-muted); font-size: var(--st-text-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Inside an open place: name and actions, then what is in it. */
.loc__body { display: grid; gap: var(--st-space-3); padding: var(--st-space-3) var(--st-space-4) var(--st-space-4); }
.loc__toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-2) var(--st-space-4); }
.loc__toolbar form { margin: 0; }
.loc__rename { display: flex; gap: var(--st-space-2); flex: 1 1 18rem; max-width: 28rem; }
.loc__rename .input { flex: 1 1 auto; min-width: 0; width: auto; }
.loc__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-1); }
.loc__loading, .loc__empty { display: flex; align-items: center; gap: var(--st-space-2); margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }

/* Things in a place, as on the Things list: photo, name (and where else it
   is), codes, tags, then the quantity here. The rows share one grid
   (subgrid), so the columns line up. Boxes in it open like places. */
.content-list > li + li { border-top: 1px solid var(--st-line); }
.content-list {
  display: grid;
  grid-template-columns: 2.75rem minmax(12rem, 2fr) minmax(7rem, 1fr) minmax(7rem, 1fr) minmax(3rem, auto);
  column-gap: var(--st-space-4);
}
.content-list > .content-list__row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; }
.content-list__row--box > .loc { grid-column: 1 / -1; }
/* On the thing page (Inside): the rows sit in a card. */
.content-list--card { padding: 0 var(--st-space-4); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); }
.loc-leaf__line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-1) var(--st-space-2); }
.loc-leaf__line .status { margin: 0; }
.loc-leaf { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; min-height: 3.5rem; padding: var(--st-space-2) 0; }
.loc-leaf__thumb { display: block; flex: none; }
.loc-leaf__thumb .thumb { width: 2.75rem; height: 2.75rem; border-radius: var(--st-radius-sm); }
.loc-leaf__main { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.loc-leaf__name { overflow-wrap: anywhere; }
.loc-leaf__name .code-tape { margin: 0; }
.loc-leaf__also { color: var(--st-ink-muted); font-size: var(--st-text-sm); font-weight: var(--st-weight-regular); overflow-wrap: anywhere; }
.loc__title .loc-leaf__also { flex-basis: 100%; }
.loc-leaf__codes, .loc-leaf__tags { display: flex; flex-wrap: wrap; gap: var(--st-space-1); min-width: 0; }
.loc-leaf__codes .code-tape, .loc-leaf__tags .chip { margin: 0; }
.loc-leaf > .loc__qty { justify-self: end; }
.loc__head > .loc-leaf__thumb .thumb { width: 2.25rem; height: 2.25rem; }
.loc--box { margin: var(--st-space-2) 0; background: var(--st-canvas); border-radius: var(--st-radius-md); }
.loc--box > .loc__head { min-height: 2.75rem; padding-inline: var(--st-space-2) var(--st-space-3); }
.loc--box > .loc__body { padding-inline: var(--st-space-3); }

@media (max-width: 639px) {
  .loc__head { padding-inline: var(--st-space-2) var(--st-space-3); }
  .loc__body { padding-inline: var(--st-space-3); }
  .loc__rename { flex-basis: 100%; max-width: none; }
  .loc__actions { margin-left: calc(-1 * var(--st-space-3)); }
  .loc--box > .loc__body { padding-inline: var(--st-space-2); }
}
/* Phones and small tablets: each thing is a card, photo on the left and
   name, codes and tags stacked beside it, the quantity top right. */
@media (max-width: 767px) {
  .content-list { grid-template-columns: minmax(0, 1fr); }
  .content-list--card { padding: 0 var(--st-space-3); }
  .loc-leaf {
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    grid-template-areas: "thumb main qty" "thumb codes codes" "thumb tags tags";
    column-gap: var(--st-space-3);
    row-gap: var(--st-space-1);
    align-items: start;
  }
  .loc-leaf__thumb { grid-area: thumb; }
  .loc-leaf__thumb .thumb { width: 2.5rem; height: 2.5rem; }
  .loc-leaf__main { grid-area: main; }
  .loc-leaf__codes { grid-area: codes; }
  .loc-leaf__tags { grid-area: tags; }
  .loc-leaf > .loc__qty { grid-area: qty; }
  .loc-leaf__codes:empty, .loc-leaf__tags:empty { display: none; }
}

/* The quantity of a thing in a place is a button: it opens the stock sheet. */
.stock-qty {
  min-height: 2.25rem;
  min-width: 3rem;
  padding: 0 var(--st-space-3);
  border: 1px solid color-mix(in srgb, var(--st-field) 35%, var(--st-line));
  border-radius: var(--st-radius-pill);
  background: var(--st-surface);
  color: var(--st-ink);
  font-size: var(--st-text-sm);
  font-weight: var(--st-weight-medium);
}
.stock-qty:hover { border-color: var(--st-accent); background: var(--st-accent-soft); color: var(--st-accent); }
.loc-leaf > .stock-qty { justify-self: end; }
/* In the Things list's Where column: one line per place, the name on the
   left and its quantity button in a right-hand column, so the quantities
   line up down the table (every cell in a column is as wide). */
.where-list { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--st-space-1) var(--st-space-2); }
.where-entry { display: contents; }
.where-holds { display: block; }
.where-holds + .where-list { margin-top: var(--st-space-1); }
.where-seen { display: block; margin-top: var(--st-space-1); color: var(--st-ink-muted); font-size: 0.875em; }
.where-seen--left { color: var(--st-warning-ink); }
.where-entry > .where-link { min-width: 0; overflow-wrap: anywhere; }
.where-entry > .stock-qty { justify-self: end; }
.stock-qty--inline { min-height: 1.75rem; min-width: 2.25rem; padding: 0 var(--st-space-2); font-size: var(--st-text-xs); }

/* The stock sheet: change quantity, move, open or remove, like the phone. */
.stock-sheet { width: min(32rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.stock-sheet .dialog__body { gap: 0; padding: var(--st-space-4) var(--st-space-5) var(--st-space-5); }
.stock-sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--st-space-3); padding-bottom: var(--st-space-3); }
.stock-sheet__where { margin: var(--st-space-1) 0 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.stock-sheet__where strong { color: var(--st-ink); font-weight: var(--st-weight-medium); }
.stock-sheet__close { flex: none; margin: calc(-1 * var(--st-space-1)) calc(-1 * var(--st-space-2)) 0 0; color: var(--st-ink-muted); }
.stock-sheet__close svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
.stock-sheet > .dialog__body > .form-alert { margin-bottom: var(--st-space-3); }
.stock-sheet__section { display: grid; gap: var(--st-space-3); margin: 0; padding: var(--st-space-4) 0; border-top: 1px solid var(--st-line); }
.stock-sheet__label { margin: 0; font-size: var(--st-text-md); }
.stock-sheet__note { flex: 1 1 10rem; min-width: 0; }
.stock-sheet__section .form-actions { padding-top: 0; }
.stock-sheet__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--st-space-2); padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
.stock-sheet__foot form { margin: 0; }
/* Phones: the sheet comes up from the bottom, like the app's. */
@media (max-width: 479px) {
  .stock-sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--st-radius-lg) var(--st-radius-lg) 0 0; border-bottom: 0; }
  .stock-sheet .dialog__body { padding: var(--st-space-4) var(--st-space-4) calc(var(--st-space-5) + env(safe-area-inset-bottom)); }
  .stock-sheet__foot > * { flex: 1 1 auto; }
  .stock-sheet__foot .btn { width: 100%; }
  .stock-sheet .form-actions .btn { width: 100%; }
}

/* ---------- settings pages: Tags, Members, Spaces ---------- */

.page-note { color: var(--st-ink-muted); }
.status--default { background: transparent; color: var(--st-accent); box-shadow: inset 0 0 0 1px var(--st-accent); }

/* A field and its button on one line (rename, create); wraps on phones. */
.row-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); margin: 0; }
.row-form > .input { flex: 1 1 12rem; min-width: 0; max-width: 24rem; width: auto; }
.table .row-form > .input { max-width: 16rem; }

.table td.table__actions.table__actions { text-align: right; white-space: nowrap; }
.table-wrap + .card, .table-wrap + .page-note { margin-top: var(--st-space-4); }
.table__actions > form { display: inline-block; margin: 0 0 0 var(--st-space-1); }
.table__actions > a, .table__actions > form { vertical-align: middle; }
/* Members: the role form puts its receiver places in a list under the
   role picker, so the row doesn't grow sideways. */
.member-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: var(--st-space-2); white-space: normal; }
.member-actions > form.role-form { display: flex; flex-wrap: wrap; justify-content: flex-end; max-width: 18rem; margin: 0; }
.table .role-form > .input { flex: 0 1 auto; width: auto; }
.role-form .row-details { flex-basis: 100%; text-align: left; white-space: normal; }
.role-form .row-details > summary { cursor: pointer; text-align: right; color: var(--st-ink-muted); font-size: 0.875em; }
.row-details__list { display: grid; gap: var(--st-space-1); margin-top: var(--st-space-2); max-height: 14rem; overflow-y: auto; }
.row-details__list > .toggle { justify-content: flex-start; }
.table__wrap { overflow-wrap: anywhere; }
/* Spaces: Switch to and Set as default keep their own column in every row. */
.space-actions { display: inline-grid; grid-template-columns: minmax(5.5rem, max-content) minmax(8.5rem, max-content) max-content; grid-template-areas: "switch default leave"; justify-items: start; gap: var(--st-space-2); }
.space-actions > form { margin: 0; }
.space-actions__switch { grid-area: switch; }
.space-actions__default { grid-area: default; }
.space-actions__leave { grid-area: leave; }
.table tr.is-current { background: color-mix(in srgb, var(--st-accent-soft) 45%, transparent); }

/* Phones: each row becomes a small block; cells with data-label get a label. */
@media (max-width: 639px) {
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table.table--stack td { max-width: none; }
  .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table.table--stack tr { padding: var(--st-space-3) var(--st-space-4); border-bottom: 1px solid var(--st-line); }
  .table.table--stack tbody tr:last-child { border-bottom: 0; }
  .table.table--stack :is(th, td) { padding: var(--st-space-1) 0; border: 0; text-align: left; }
  .table--stack td:empty { display: none; }
  .table--stack td[data-label] { display: flex; flex-wrap: wrap; gap: var(--st-space-1) var(--st-space-3); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
  .table--stack td[data-label]::before { content: attr(data-label); flex: none; min-width: 5.5rem; }
  .table--stack td[data-label] > * { color: var(--st-ink); }
  .table--stack .table__lead { font-weight: var(--st-weight-bold); }
  .table--stack td.table__actions.table__actions { text-align: left; }
  .table--stack .table__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); padding-top: var(--st-space-2); white-space: normal; }
  .table--stack .table__actions > form { margin: 0; }
  .member-actions { justify-content: flex-start; }
  .member-actions > form.role-form { justify-content: flex-start; max-width: none; }
  .space-actions { display: flex; flex-wrap: wrap; }
  .table .row-form > .input { max-width: none; }
}

.settings-card h3 { margin: 0 0 var(--st-space-2); font-size: var(--st-text-md); }
.invite-new { margin-bottom: var(--st-space-4); padding: var(--st-space-4); background: var(--st-accent-soft); border-radius: var(--st-radius-md); }
.invite-new .field__hint { margin: var(--st-space-2) 0 0; }
.invite-list > li + li { margin-top: var(--st-space-3); padding-top: var(--st-space-3); border-top: 1px solid var(--st-line); }
.invite-row__date { margin: 0 0 var(--st-space-2); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.invite-row__body { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); }
.invite-row__body > .link-box { flex: 1 1 18rem; }
.invite-row__body > form { margin: 0; }

/* A link to copy: the whole link in code type, Copy beside it. */
.link-box { display: flex; align-items: center; gap: var(--st-space-2); min-width: 0; margin: 0; }
.link-box__input { flex: 1 1 auto; min-width: 0; width: auto; min-height: 2.25rem; font-family: var(--st-font-code); font-size: var(--st-text-xs); background: var(--st-surface-sunken); }

.tags-table__unit { display: none; }
@media (max-width: 639px) {
  /* A tag: chip, count and Delete on one line; Rename on the line below. */
  .table.tags-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-1) var(--st-space-3); }
  .table.tags-table td { width: auto; }
  .tags-table__count { flex: 1 1 auto; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
  .tags-table__unit { display: inline; }
  .tags-table__plain { display: none; }
  .table.tags-table .table__actions { order: 3; padding-top: 0; }
  .table.tags-table .tags-table__rename { order: 4; flex: 1 1 100%; }
}
.feature-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-3) var(--st-space-5); margin: 0; }
.feature-row__text { flex: 1 1 20rem; }
.feature-row__title { display: flex; align-items: center; gap: var(--st-space-2); margin: 0 0 var(--st-space-1); }
.feature-row__title .status { margin: 0; }
.feature-row__desc { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); max-width: 38rem; }
.feature-row + .feature-row { margin-top: var(--st-space-4); padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
.settings-card__actions { margin: var(--st-space-3) 0 0; }
.export-rows { margin-top: var(--st-space-4); }

/* ---------- pick lists ---------- */

.section-title { margin: var(--st-space-6) 0 var(--st-space-3); font-size: var(--st-text-lg); }
.page-foot { margin-top: var(--st-space-6); padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
.page-foot form { margin: 0; }
.empty-state__action { margin: var(--st-space-4) 0 0; }
.table__nowrap { white-space: nowrap; }
.row-form--end { justify-content: flex-end; }
.row-form > .input--qty { flex: none; width: 5rem; }

/* Open / Closed: two tabs over the list. */
.tabs { display: flex; flex-wrap: wrap; gap: var(--st-space-1); margin: var(--st-space-5) 0 var(--st-space-3); border-bottom: 1px solid var(--st-line); }
.tabs__tab {
  margin-bottom: -1px;
  white-space: nowrap;
  padding: var(--st-space-2) var(--st-space-3);
  border-bottom: 2px solid transparent;
  color: var(--st-ink-muted);
  font-weight: var(--st-weight-medium);
  text-decoration: none;
}
.tabs__tab:hover { color: var(--st-ink); }
.tabs__tab.is-active { color: var(--st-accent); border-bottom-color: var(--st-accent); font-weight: var(--st-weight-bold); }

/* Progress: how much of the list is at the target. The text next to it says the same. */
.progress-cell { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-1) var(--st-space-3); }
.progress { display: inline-block; flex: none; width: 5rem; height: 0.375rem; overflow: hidden; border-radius: var(--st-radius-pill); background: var(--st-surface-sunken); }
.progress--large { width: 10rem; height: 0.5rem; }
.progress__bar { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--st-accent); }
.progress__bar--done { background: var(--st-success-ink); }

.pick-summary { display: grid; gap: var(--st-space-3); margin-bottom: var(--st-space-2); padding: var(--st-space-4) var(--st-space-5); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); }
.pick-summary__target { margin: 0; }
.pick-summary__edit > summary { justify-self: start; margin-left: calc(-1 * var(--st-space-3)); }
.pick-summary__edit .disclosure__body { max-width: 40rem; }
.page-head h1 .status { vertical-align: 0.3em; }

.pick-lines .thumb-col { width: 3.75rem; padding-inline: var(--st-space-2) var(--st-space-1); }
.pick-lines .thumb { width: 2.75rem; height: 2.75rem; border-radius: var(--st-radius-md); object-fit: cover; display: block; }
.pick-lines .thumb.empty { background: var(--st-surface-sunken); border: 0; }
.pick-lines__thing a { font-weight: var(--st-weight-medium); }
.pick-lines__codes { display: flex; align-items: center; gap: var(--st-space-1); margin-top: var(--st-space-1); }
.pick-lines__codes .code-tape { margin: 0; }
.pick-lines__more { color: var(--st-ink-muted); font-size: var(--st-text-xs); }
.pick-lines__picked { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-1) var(--st-space-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pick-lines__picked .status { margin: 0; }
.pick-lines__where { color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.pick-lines tr.is-done .thumb { opacity: 0.6; }

.pick-add { margin-top: var(--st-space-6); }
.pick-add > .row-form > .input--search { max-width: 28rem; }
.pick-add__results { margin-top: var(--st-space-4); }
.pick-add__none { margin: var(--st-space-3) 0 0; }

@media (max-width: 639px) {
  .pick-summary { padding: var(--st-space-4); }
  /* A line: photo on the left, the rest beside it. */
  .table.pick-lines tr { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); column-gap: var(--st-space-3); }
  .table.pick-lines tr > td { grid-column: 2; }
  .table.pick-lines tr > td.thumb-col { grid-column: 1; grid-row: 1 / span 3; width: auto; padding: var(--st-space-1) 0 0; }
  .pick-lines .thumb { width: 3.25rem; height: 3.25rem; }
  .table--stack td[data-label] > .row-form { flex-wrap: nowrap; }
  .pick-lines td[data-label]::before { min-width: 4.75rem; }
  .pick-lines .row-form > .input--qty { width: 4.25rem; }
  .row-form--end { justify-content: flex-start; }
}

/* ---------- History ---------- */

.page-intro--long { max-width: 52rem; }
.filter-panel__scope { margin: 0; padding: var(--st-space-2) var(--st-space-3); border-radius: var(--st-radius-md); background: var(--st-accent-soft); color: var(--st-ink); font-size: var(--st-text-sm); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: var(--st-space-4); }

.history-table :is(th, td) { font-size: var(--st-text-sm); }
.table.history-table td { vertical-align: top; }
.history-table .h-when { white-space: nowrap; color: var(--st-ink-muted); font-variant-numeric: tabular-nums; }
.history-table .h-thing { min-width: 10rem; }
.history-table .h-thing__name { font-weight: var(--st-weight-medium); }
.history-table .h-thing .status, .history-table .h-change .status { margin: 0 0 0 var(--st-space-1); }
.history-table .h-code { font-family: var(--st-font-code); font-stretch: 87.5%; font-size: 0.8125rem; white-space: nowrap; }
.history-table .h-change { white-space: nowrap; }
.history-table .h-change__kind { font-weight: var(--st-weight-medium); }
.history-table .h-qty { white-space: nowrap; font-variant-numeric: tabular-nums; }
.history-table .h-via { white-space: nowrap; color: var(--st-ink-muted); }
.history-table .h-note { min-width: 8rem; max-width: 22rem; overflow-wrap: anywhere; color: var(--st-ink-muted); }
/* Undone: struck through, except the change itself, which says "undone". */
.history-table tr.undone td { color: var(--st-ink-muted); }
.history-table tr.undone td:not(.h-change) { text-decoration: line-through; }

/* Below 1100 px (ten columns don't fit): each change is a small card.
   Thing and quantity first, then the change, from and to, then when · who · via. */
@media (max-width: 1099px) {
  .history-table, .history-table tbody { display: block; width: 100%; }
  .history-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table.history-table tr { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--st-space-1) var(--st-space-2); padding: var(--st-space-3) var(--st-space-4); border-bottom: 1px solid var(--st-line); }
  .table.history-table tbody tr:last-child { border-bottom: 0; }
  .table.history-table td { display: block; max-width: none; padding: 0; border: 0; text-align: left; }
  .table.history-table td.h-thing { padding-right: 4.5rem; }
  .table.history-table td:empty { display: none; }
  .history-table .h-thing { order: 1; flex: 0 0 100%; min-width: 0; padding-right: 4.5rem; font-size: var(--st-text-md); overflow-wrap: anywhere; }
  /* The quantity sits top right, beside the thing's name. */
  .table.history-table td.h-qty { position: absolute; top: var(--st-space-3); right: var(--st-space-4); font-size: var(--st-text-md); font-weight: var(--st-weight-bold); }
  .history-table .h-change { order: 3; }
  .history-table .h-code { order: 4; }
  .history-table .h-from { order: 5; flex-basis: 100%; }
  .history-table .h-to { order: 6; flex-basis: 100%; }
  .history-table .h-from::before, .history-table .h-to::before { content: attr(data-label); display: inline-block; min-width: 2.75rem; color: var(--st-ink-muted); }
  .history-table .h-when { order: 7; }
  .history-table .h-who { order: 8; color: var(--st-ink-muted); }
  .history-table .h-via { order: 9; }
  .history-table .h-who::before, .history-table .h-via::before { content: "·"; margin-right: var(--st-space-2); }
  .history-table .h-note { order: 10; flex-basis: 100%; max-width: none; padding-top: var(--st-space-1); }
  .history-table .h-when, .history-table .h-who, .history-table .h-via { font-size: var(--st-text-xs); }
}

/* ---------- Import ---------- */

/* Where you are in the four import steps. */
.steps { display: flex; flex-wrap: wrap; gap: var(--st-space-1) var(--st-space-4); margin: 0 0 var(--st-space-4); padding: 0; list-style: none; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.steps__step { display: inline-flex; align-items: center; gap: var(--st-space-2); }
.steps__n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border: 1px solid var(--st-line); border-radius: 50%; background: var(--st-surface); font-size: var(--st-text-xs); font-weight: var(--st-weight-bold); font-variant-numeric: tabular-nums; }
.steps__step.is-done .steps__n { border-color: var(--st-accent-soft); background: var(--st-accent-soft); color: var(--st-accent); }
.steps__step.is-current { color: var(--st-ink); font-weight: var(--st-weight-bold); }
.steps__step.is-current .steps__n { border-color: var(--st-accent); background: var(--st-accent); color: var(--st-on-accent); }
@media (max-width: 479px) {
  .steps__step:not(.is-current) { font-size: 0; gap: 0; }
  .steps__step:not(.is-current) .steps__n { font-size: var(--st-text-xs); }
  .steps { gap: var(--st-space-2); }
}

.help-text { margin: 0 0 var(--st-space-3); color: var(--st-ink-muted); font-size: var(--st-text-sm); max-width: 48rem; }
.help-text__label { margin: var(--st-space-4) 0 var(--st-space-2); font-weight: var(--st-weight-bold); font-size: var(--st-text-sm); }
.code-sample { margin: 0 0 var(--st-space-3); padding: var(--st-space-3) var(--st-space-4); overflow-x: auto; background: var(--st-surface-sunken); border-radius: var(--st-radius-md); font-family: var(--st-font-code); font-size: var(--st-text-xs); line-height: 1.6; white-space: pre; }

/* File picker as a drop area: the whole box opens the picker. */
.file-drop { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--st-space-2); justify-items: start; padding: var(--st-space-5); border: 1.5px dashed color-mix(in srgb, var(--st-field) 60%, var(--st-line)); border-radius: var(--st-radius-lg); background: var(--st-canvas); cursor: pointer; }
.file-drop:hover, .file-drop.is-over { border-color: var(--st-accent); background: var(--st-accent-soft); }
.file-drop:has(input:focus-visible) { outline: 2px solid var(--st-focus); outline-offset: 2px; }
.paste-box { width: 100%; font-family: var(--st-font-code); font-size: var(--st-text-sm); white-space: pre; overflow-x: auto; resize: vertical; }
.file-drop.has-file { border-style: solid; border-color: var(--st-accent); }
.file-drop__title { font-weight: var(--st-weight-bold); }
.file-drop__hint { color: var(--st-ink-muted); font-size: var(--st-text-sm); overflow-wrap: anywhere; }
.file-drop.has-file .file-drop__hint { color: var(--st-accent); font-weight: var(--st-weight-bold); }
.file-drop input[type=file] { max-width: 100%; }

/* Buttons at the end of a step: back on the left, next on the right. */
.page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-3); margin-top: var(--st-space-5); padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
.page-actions--start { justify-content: flex-start; }
.page-actions__note { color: var(--st-ink-muted); font-size: var(--st-text-sm); }

.map-table .table__lead { font-weight: var(--st-weight-bold); }
.map-table__samples { color: var(--st-ink-muted); max-width: 28rem; }
.map-table__field .input { width: 100%; max-width: 16rem; }
.map-table__control { display: flex; align-items: center; gap: var(--st-space-2); }
/* Skip only works with JavaScript, so it's hidden without it (the menu still has "skip"). */
.map-table__skip { display: none; flex: none; }
.js .map-table__skip { display: inline-flex; }
@media (max-width: 639px) {
  .map-table__field .input { max-width: none; }
}
.import-tags { display: grid; gap: var(--st-space-3); margin-top: var(--st-space-4); }
.import-tags .help-text { margin: 0; }
.import-tags__legend { float: left; width: 100%; margin: 0; padding: 0; font-size: var(--st-text-lg); font-weight: var(--st-weight-bold); }
.import-tags .field .input { max-width: 28rem; }

.stat-strip { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin: 0 0 var(--st-space-4); }
.stat { display: inline-flex; align-items: baseline; gap: var(--st-space-1); padding: var(--st-space-2) var(--st-space-3); border: 1px solid var(--st-line); border-radius: var(--st-radius-md); background: var(--st-surface); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.stat strong { color: var(--st-ink); font-size: var(--st-text-lg); font-variant-numeric: tabular-nums; }
.stat--done strong { color: var(--st-success-ink); }
.stat--warning { border-color: color-mix(in srgb, var(--st-warning-ink) 30%, var(--st-line)); background: var(--st-warning-soft); }
.stat--warning strong { color: var(--st-warning-ink); }
.import-note { margin: 0 0 var(--st-space-3); }
.import-note .chip { margin: 0 var(--st-space-1) 0 0; }
.import-note--muted { color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.import-codes {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-3);
  padding: var(--st-space-3); border-radius: var(--st-radius-md);
  background: var(--st-warning-soft); color: var(--st-warning-ink);
}
.import-codes p { margin: 0; flex: 1 1 24rem; }
/* Columns mapped to skip: shown, but left out of the import. */
.import-table .col-skipped, .import-table .cell-skipped { color: var(--st-ink-muted); opacity: 0.55; }

.import-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-3); margin: var(--st-space-4) 0 var(--st-space-3); }
.import-tools__hint { flex: 1 1 100%; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.import-tools__buttons { display: flex; gap: var(--st-space-1); margin-left: calc(-1 * var(--st-space-3)); }
.import-tools .import-tools__filter { flex: 0 1 14rem; width: auto; }

/* The preview spreadsheet: header row and the tick column stay put while it scrolls. */
.import-rows { max-height: max(32rem, calc(100vh - 20rem)); overflow: auto; background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); }
.import-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--st-text-sm); }
.import-table :is(th, td) { padding: var(--st-space-2) var(--st-space-3); border-bottom: 1px solid var(--st-line); text-align: left; vertical-align: top; }
.import-table tbody tr:last-child td { border-bottom: 0; }
.import-table td:not(.cell) { overflow-wrap: normal; }
.import-table thead th { white-space: nowrap; }
.import-table thead th { position: sticky; top: 0; z-index: 3; background: var(--st-surface); color: var(--st-ink-muted); font-weight: var(--st-weight-medium); letter-spacing: 0; text-transform: none; }
/* The tick box and the Thing column stay pinned on the left while the
   file's columns scroll sideways under them. */
.import-table :is(th, td):is(.import-pick, :first-child) { position: sticky; left: 0; z-index: 2; width: 3.5rem; min-width: 3.5rem; background: var(--st-surface); }
.import-table :is(th, td).import-thing { position: sticky; left: 3.5rem; z-index: 2; width: 18rem; min-width: 14rem; max-width: 18rem; background: var(--st-surface); box-shadow: 1px 0 0 var(--st-line), 6px 0 8px -6px rgb(40 30 22 / 0.18); }
.import-table thead th:is(.import-pick, .import-thing) { z-index: 4; }
.import-table td:first-child input { width: 1.25rem; height: 1.25rem; }
.import-table td.import-thing { display: table-cell; }
.import-thing__media { float: left; width: 2.75rem; height: 2.75rem; margin-right: var(--st-space-3); overflow: hidden; border-radius: var(--st-radius-sm); background: var(--st-surface-sunken); }
.import-thing__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.import-thing__text { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; overflow: hidden; }
.import-thing__name { color: var(--st-ink); font-weight: var(--st-weight-bold); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.import-thing__name.is-empty { color: var(--st-ink-muted); font-weight: var(--st-weight-regular); font-style: italic; }
.import-thing__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--st-space-2); color: var(--st-ink-muted); font-size: var(--st-text-xs); }
.import-thing__code { color: var(--st-ink); overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .import-table :is(th, td).import-thing { width: 11rem; min-width: 11rem; max-width: 11rem; }
  .import-thing__media { width: 2.25rem; height: 2.25rem; margin-right: var(--st-space-2); }
}
.import-table .col-name { display: block; color: var(--st-ink); font-weight: var(--st-weight-bold); }
.import-table .col-field { display: block; color: var(--st-ink-muted); font-size: var(--st-text-xs); }
/* Cells keep whole words and get room (the sheet scrolls sideways under the
   pinned columns instead of squeezing every column to the page width). */
.import-table td.cell { min-width: 7rem; overflow-wrap: break-word; }
.import-table td.cell:not(.cell-url) { max-width: 20rem; }
.import-table td.cell-long { min-width: 14rem; }
.import-table td.cell:hover { outline: 1px dashed var(--st-field); outline-offset: -2px; }
.import-table td.cell:focus-visible { outline: 2px solid var(--st-focus); outline-offset: -2px; }
.import-table td.cell.edited { background: var(--st-accent-soft); }
/* Unticked rows fade; the pinned Thing cell fades by colour instead, since
   a see-through pinned cell would show the columns scrolling under it. */
.import-table tr.excluded td:not(:first-child, .import-thing) { opacity: 0.45; }
.import-table tr.excluded td.import-thing :is(.import-thing__name, .import-thing__code) { color: var(--st-ink-muted); }
.import-table tr.excluded .import-thing__media { opacity: 0.45; }
.import-table .status { margin: 0; }
.case-menu summary { margin-left: calc(-1 * var(--st-space-2)); padding: 0.125rem var(--st-space-2); border-radius: var(--st-radius-sm); color: var(--st-accent); font-weight: var(--st-weight-bold); }
.case-menu summary::-webkit-details-marker { display: none; }
.case-menu summary:hover, .case-menu[open] summary { background: var(--st-accent-soft); }
.case-menu .menu-list { padding: var(--st-space-1); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-md); box-shadow: var(--st-shadow-menu); color: var(--st-ink); }
.case-menu .menu-button { display: block; width: 100%; min-height: 2.25rem; padding: 0 var(--st-space-3); border: 0; border-radius: var(--st-radius-sm); background: none; color: var(--st-ink); font: inherit; text-align: left; cursor: pointer; }
.case-menu .menu-button:hover { background: var(--st-surface-sunken); }
.case-menu .affix { border-top-color: var(--st-line); }
.case-menu .affix-title { color: var(--st-ink-muted); }
.case-menu .affix input { min-height: 2rem; border: 1px solid var(--st-field); border-radius: var(--st-radius-sm); background: var(--st-surface); color: var(--st-ink); }
.cell-input { border-color: var(--st-accent); background: var(--st-surface); color: var(--st-ink); }
.row-problem { color: var(--st-warning-ink); }
.stale-note { margin: var(--st-space-3) 0 0; padding: var(--st-space-2) var(--st-space-3); border-radius: var(--st-radius-md); background: var(--st-accent-soft); color: var(--st-ink); font-size: var(--st-text-sm); }
.warning-card { margin-top: var(--st-space-4); border-color: color-mix(in srgb, var(--st-warning-ink) 30%, var(--st-line)); background: var(--st-warning-soft); }
.warning-card h2 { color: var(--st-warning-ink); }
.problem-list { display: grid; gap: var(--st-space-1); font-size: var(--st-text-sm); }
.busy-dialog { max-width: 26rem; padding: var(--st-space-6); text-align: center; }
.busy-dialog p { margin: var(--st-space-2) 0 0; }

/* ---------- Labels ---------- */

.btn--quiet.btn--danger { color: var(--st-danger); border-color: transparent; }
.btn--quiet.btn--danger:hover { background: var(--st-danger-soft); }

.label-section { margin-bottom: var(--st-space-5); }
/* The Labels page: each format's templates, the active one marked, and a
   form for a new one under the list. */
.label-list .status { margin-left: var(--st-space-1); }
.label-list tr.is-current { background: var(--st-accent-soft); }
.label-new { display: grid; gap: var(--st-space-2); margin: var(--st-space-4) 0 0; padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
.label-new__title { margin: 0; font-weight: var(--st-weight-bold); }
.label-new .row-form > select.input { flex: 0 1 18rem; min-width: 0; }
.label-section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--st-space-1) var(--st-space-4); margin-bottom: var(--st-space-4); }
.label-section__head h2 { margin: 0; }
.label-section__meta { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
/* Each format's two size slots (Small, Large), one list each. */
.label-subject + .label-subject { margin-top: var(--st-space-5); padding-top: var(--st-space-5); border-top: 1px solid var(--st-line); }
.label-subject__title { margin: 0; font-size: var(--st-text-lg); }
.label-subject__intro { margin: var(--st-space-1) 0 var(--st-space-4); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.label-size-slot + .label-size-slot { margin-top: var(--st-space-5); }
.label-size-slot__title { margin: 0 0 var(--st-space-2); font-size: var(--st-text-md); }
.label-new__sizes { display: flex; flex-wrap: wrap; gap: var(--st-space-2) var(--st-space-4); margin: 0; padding: 0; border: 0; }
.label-preview__note { margin: 0; font-size: var(--st-text-sm); }

/* Editor on the left, preview on the right; one column below 1024 px. */
.label-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--st-space-5); margin: 0; }
.label-editor__edit, .label-editor__preview { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--st-space-3); }
.label-editor__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
@media (min-width: 1024px) {
  .label-editor { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: var(--st-space-6); }
  .label-editor__actions { grid-column: 1 / -1; }
}

.label-size { display: flex; flex-wrap: wrap; gap: var(--st-space-2) var(--st-space-4); }
.label-note { margin: 0; padding: 0; border: 0; min-width: 0; }
.label-note .field__hint { margin-top: var(--st-space-1); }
.label-note__settings { display: grid; gap: var(--st-space-2); justify-items: start; margin-top: var(--st-space-3); }
.label-note__settings[hidden] { display: none; }
.label-note__settings .input { width: 100%; }
.label-body.input { width: 100%; min-height: 14rem; padding: var(--st-space-3); font-family: var(--st-font-code); font-size: var(--st-text-sm); line-height: 1.55; resize: vertical; }
.label-fields-group { display: grid; gap: var(--st-space-2); }
.label-fields__title { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); font-weight: var(--st-weight-medium); }
.label-fields { display: flex; flex-wrap: wrap; gap: var(--st-space-1); margin: 0 0 var(--st-space-2); }
/* A field to insert: code type, like what it writes. */
:where(button).field-chip {
  min-height: 2rem;
  padding: 0 var(--st-space-2);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-sm);
  background: var(--st-surface);
  color: var(--st-ink);
  font-family: var(--st-font-code);
  font-size: var(--st-text-xs);
  cursor: pointer;
}
:where(button).field-chip:hover { border-color: var(--st-accent); background: var(--st-accent-soft); color: var(--st-accent); }
:where(button).field-chip:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 1px; }

.label-pick { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }
.label-pick > .input { flex: 1 1 12rem; min-width: 0; width: auto; }
.label-preview { display: grid; place-items: center; min-height: 10rem; padding: var(--st-space-4); overflow: auto; background: var(--st-surface-sunken); border-radius: var(--st-radius-md); }
.label-preview > .form-alert, .label-preview > .help-text { justify-self: stretch; margin: 0; }
.label-preview--zpl { place-items: stretch; align-content: start; gap: var(--st-space-3); }
/* The Zebra label as a picture (labelary.com), drawn as paper like the
   AirPrint preview; the ZPL text folds away under it. */
.label-picture { display: grid; justify-items: center; gap: var(--st-space-2); }
.label-picture__img { display: block; width: auto; height: auto; max-width: 100%; image-rendering: pixelated; }
.label-picture__note { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-xs); text-align: center; }
.label-picture__loading { display: flex; align-items: center; gap: var(--st-space-2); min-height: 6rem; margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.label-picture > .help-text { margin: 0; justify-self: stretch; }
.label-zpl-toggle > summary { margin: 0 0 var(--st-space-2); font-size: var(--st-text-sm); font-weight: var(--st-weight-medium); }
/* The paper label is drawn as paper: white, with a soft shadow. */
.label-frame { max-width: 100%; border: 0; border-radius: 2px; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 4px 12px rgb(0 0 0 / 0.08); }
.label-zpl { margin: 0; padding: var(--st-space-3); overflow-x: auto; background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-sm); font-family: var(--st-font-code); font-size: var(--st-text-xs); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- error pages, no space, Print QR ---------- */

.error-card__code { margin: var(--st-space-4) 0 var(--st-space-1); color: var(--st-ink-muted); font-family: var(--st-font-code); font-size: var(--st-text-xs); }
.error-card__text { margin: 0 0 var(--st-space-5); color: var(--st-ink-muted); }
.error-card__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }

.no-space { max-width: 36rem; margin-top: var(--st-space-4); }
.no-space h1.empty-state__title { font-size: var(--st-text-xl); }
.no-space .empty-state__text { margin-bottom: var(--st-space-4); }

.print-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-2) var(--st-space-4); padding: var(--st-space-3) var(--st-space-4); background: var(--st-surface); border-bottom: 1px solid var(--st-line); color: var(--st-ink); font-family: var(--st-font); }
.print-toolbar .back-link { margin: 0; }
.print-toolbar__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); }
.print-toolbar__hint { flex: 1 1 100%; color: var(--st-ink-muted); font-size: var(--st-text-sm); text-align: center; }
@media (min-width: 900px) {
  .print-toolbar__hint { flex: 0 1 auto; order: 3; text-align: right; }
}

/* Thing page: place or not, with one button that asks first. */
.place-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-3) var(--st-space-4); margin: 0; }
.place-switch > .form-alert { flex-basis: 100%; }
.place-switch__text { flex: 1 1 18rem; min-width: 0; }
.place-switch__title { margin: 0 0 var(--st-space-1); font-weight: var(--st-weight-bold); }
.place-switch__text .field__hint { margin: 0; }

/* ---------- operator tools (superusers) ---------- */

.settings-card .operator-subhead { margin: var(--st-space-5) 0 var(--st-space-3); padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
.invite-row__title { color: var(--st-ink); }
.beta-table__note { min-width: 12rem; }

/* Page content editor: one row per text or image the landing templates declare. */
.content-pages { display: grid; gap: var(--st-space-2); }
.content-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-2) var(--st-space-4); margin: var(--st-space-5) 0 var(--st-space-2); }
.content-head h2 { margin: 0; }
.content-intro { max-width: 60rem; margin: 0 0 var(--st-space-4); color: var(--st-ink-muted); }
.content-warning { margin-bottom: var(--st-space-4); }
.content-warning p { margin: var(--st-space-1) 0; }
.content-toc { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin: 0 0 var(--st-space-5); }
.content-toc .chip { background: var(--st-surface); }
.content-group { scroll-margin-top: var(--st-space-4); }
.content-key { margin-left: var(--st-space-2); color: var(--st-ink-muted); font-size: var(--st-text-xs); font-weight: var(--st-weight-regular); vertical-align: 0.15em; }
.content-section { margin: var(--st-space-5) 0 0; padding-bottom: var(--st-space-2); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.content-row { display: grid; grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr); gap: var(--st-space-2) var(--st-space-5); padding: var(--st-space-4) 0; border-top: 1px solid var(--st-line); }
.content-label { display: flex; flex-direction: column; align-items: flex-start; gap: var(--st-space-1); min-width: 0; overflow-wrap: anywhere; }
.content-label code { font-size: var(--st-text-xs); }
.content-meta { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-xs); }
.content-field { display: flex; flex-direction: column; gap: var(--st-space-2); min-width: 0; }
.content-field > .input { width: 100%; max-width: 64rem; }
textarea.input { padding: var(--st-space-2) var(--st-space-3); line-height: var(--st-leading-body); resize: vertical; }
/* Long texts grow to show all their lines (where the browser supports it). */
.content-field > textarea.input { field-sizing: content; min-height: 4.5rem; max-height: 24rem; }
.content-default { margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); white-space: pre-wrap; }
.content-actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }
.content-actions form { margin: 0; }
.content-modes { display: flex; flex-wrap: wrap; gap: var(--st-space-5); }
.content-mode { display: flex; gap: var(--st-space-4); align-items: flex-start; margin: 0; min-width: 0; }
.content-mode-info { display: flex; flex-direction: column; gap: var(--st-space-2); align-items: flex-start; min-width: 0; max-width: 18rem; }
.content-mode-info .row { gap: var(--st-space-2); }
.content-mode-info input[type=file]::file-selector-button { min-height: 2.25rem; padding: 0 var(--st-space-3); font-size: var(--st-text-sm); }
.content-thumb { display: block; flex: none; width: 96px; overflow: hidden; border: 1px solid var(--st-line); border-radius: var(--st-radius-md); }
.content-thumb img { display: block; width: 100%; height: auto; }
.content-thumb--none { display: grid; place-items: center; height: 72px; color: var(--st-ink-muted); font-size: .8125rem; border-style: dashed; }
/* The landing page's own light and dark backgrounds (--paper in
   landing.css), so a transparent image shows as it will there. */
.content-thumb-light { background: #f5f2ee; }
.content-thumb-dark { background: #24211e; }
.content-save { display: flex; justify-content: flex-end; padding-top: var(--st-space-4); border-top: 1px solid var(--st-line); }
@media (max-width: 767px) {
  .content-row { grid-template-columns: minmax(0, 1fr); }
  .content-mode { flex-direction: column; }
  .content-save .btn { width: 100%; }
}

/* ---------- overview (the space's home page) ---------- */

.ov-hello { margin: 0 0 var(--st-space-4); font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: var(--st-leading-tight); letter-spacing: -0.01em; }
.ov-spaces { display: flex; flex-wrap: wrap; gap: var(--st-space-3) var(--st-space-6); margin: 0 0 var(--st-space-5); }
.ov-spaces__group { display: flex; flex-direction: column; gap: var(--st-space-2); min-width: 0; }
.ov-spaces__title { display: flex; align-items: center; gap: var(--st-space-2); margin: 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.ov-spaces__row { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }
.ov-spaces__btn { padding: var(--st-space-2) var(--st-space-4); border: 1px solid var(--st-line); border-radius: var(--st-radius-pill); background: var(--st-surface); color: var(--st-ink); font: inherit; font-size: var(--st-text-sm); font-weight: var(--st-weight-medium); cursor: pointer; }
.ov-spaces__btn:hover { border-color: var(--st-accent); }
.ov-spaces__btn:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 2px; }
.ov-spaces__btn[aria-current="true"] { background: var(--st-accent); border-color: var(--st-accent); color: var(--st-on-accent); }
.ov-space { margin: 0 0 var(--st-space-1); font-size: var(--st-text-lg); }
.ov-facts > * + *::before { content: "·"; display: inline-block; margin-right: var(--st-space-4); color: var(--st-field); text-decoration: none; }
.ov-facts { display: flex; flex-wrap: wrap; gap: var(--st-space-2) var(--st-space-4); margin: 0 0 var(--st-space-5); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.ov-start { margin-top: var(--st-space-4); }
.ov-section + .ov-section { margin-top: var(--st-space-5); }
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--st-space-3); }
.ov-tile { position: relative; display: flex; flex-direction: column; gap: var(--st-space-1); padding: var(--st-space-4); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); color: var(--st-ink); text-decoration: none; }
a.ov-tile:hover { border-color: var(--st-accent); }
.ov-tile__n { font-size: var(--st-text-xl); font-weight: var(--st-weight-bold); line-height: var(--st-leading-tight); font-variant-numeric: tabular-nums; }
.ov-tile__label { color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.ov-tile__icon { position: absolute; top: var(--st-space-3); right: var(--st-space-3); display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: var(--st-radius-md); }
.ov-tile__icon svg { width: 1.05rem; height: 1.05rem; }
.ov-tile--1 .ov-tile__icon { color: var(--st-chart-1); background: color-mix(in srgb, var(--st-chart-1) 15%, transparent); }
.ov-tile--2 .ov-tile__icon { color: var(--st-chart-2); background: color-mix(in srgb, var(--st-chart-2) 15%, transparent); }
.ov-tile--3 .ov-tile__icon { color: var(--st-chart-3); background: color-mix(in srgb, var(--st-chart-3) 15%, transparent); }
.ov-tile--4 .ov-tile__icon { color: var(--st-chart-4); background: color-mix(in srgb, var(--st-chart-4) 15%, transparent); }
.ov-note { margin: var(--st-space-2) 0 0; color: var(--st-ink-muted); font-size: var(--st-text-sm); }

/* How complete | Where your stock is / Needs attention */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "cov where" "att where"; gap: var(--st-space-4); align-items: start; margin-top: var(--st-space-5); }
.ov-grid__cov { grid-area: cov; }
.ov-grid__att { grid-area: att; }
.ov-grid__where { grid-area: where; align-self: stretch; }
.ov-grid + .ov-card { margin-top: var(--st-space-4); }

.ov-meters { display: grid; gap: var(--st-space-3); margin: 0; }
.ov-meter { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); align-items: center; gap: var(--st-space-3); }
.ov-meter dt { color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.ov-meter dd { display: grid; grid-template-columns: minmax(0, 1fr) 3.25rem 8.25rem; align-items: center; gap: var(--st-space-3); margin: 0; }
.ov-meter__track { height: 0.625rem; background: var(--st-surface-sunken); border-radius: var(--st-radius-pill); overflow: hidden; }
.ov-meter__fill { display: block; height: 100%; border-radius: var(--st-radius-pill); transform-origin: left center; }
.ov-meter__n { font-size: var(--st-text-sm); font-weight: var(--st-weight-bold); text-align: right; font-variant-numeric: tabular-nums; }
.ov-meter__word { display: inline-flex; align-items: center; gap: 0.3rem; justify-self: start; padding: 0.1rem 0.55rem 0.1rem 0.4rem; border-radius: var(--st-radius-pill); font-size: var(--st-text-xs); font-weight: var(--st-weight-bold); white-space: nowrap; }
.ov-meter__word svg { width: 0.75rem; height: 0.75rem; }
.ov-meter--good .ov-meter__fill { background: var(--st-good); }
.ov-meter--good .ov-meter__word { color: var(--st-good); background: var(--st-good-soft); }
.ov-meter--fair .ov-meter__fill { background: var(--st-fair); }
.ov-meter--fair .ov-meter__word { color: var(--st-fair); background: var(--st-fair-soft); }
.ov-meter--poor .ov-meter__fill { background: var(--st-poor); }
.ov-meter--poor .ov-meter__word { color: var(--st-poor); background: var(--st-poor-soft); }

.ov-attention a { display: inline-flex; align-items: center; gap: var(--st-space-2); }
.ov-attention__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }
.ov-attention--poor .ov-attention__dot { background: var(--st-poor); }
.ov-attention--fair .ov-attention__dot { background: var(--st-fair); }

.ov-chart-box { position: relative; }
.ov-donut { display: flex; flex-direction: column; align-items: center; gap: var(--st-space-4); }
.ov-donut__svg { display: block; width: 11.5rem; height: 11.5rem; }
.ov-donut__seg { fill: none; stroke-width: 24; transition: opacity var(--st-duration) var(--st-ease); }
.ov-donut__seg--1 { stroke: var(--st-chart-1); } .ov-donut__seg--2 { stroke: var(--st-chart-2); } .ov-donut__seg--3 { stroke: var(--st-chart-3); }
.ov-donut__seg--4 { stroke: var(--st-chart-4); } .ov-donut__seg--5 { stroke: var(--st-chart-5); } .ov-donut__seg--6 { stroke: var(--st-chart-6); }
.ov-donut__svg.is-hovering .ov-donut__seg:not(.is-hot) { opacity: 0.3; }
.ov-donut__total { fill: var(--st-ink); font-size: 22px; font-weight: var(--st-weight-bold); }
.ov-donut__sub { fill: var(--st-ink-muted); font-size: 11px; }
.ov-donut__total, .ov-donut__sub { pointer-events: none; }
.ov-legend { display: grid; gap: var(--st-space-2); width: 100%; font-size: var(--st-text-sm); }
.ov-legend li { border-radius: var(--st-radius-sm); }
.ov-legend__link { display: grid; grid-template-columns: 0.75rem minmax(0, 1fr) auto 2.75rem; align-items: center; gap: var(--st-space-2); color: inherit; text-decoration: none; border-radius: inherit; }
.ov-legend__link:hover .ov-legend__name { text-decoration: underline; }
.ov-legend__link:focus-visible { outline: 2px solid var(--st-focus); outline-offset: 2px; }
.ov-donut__link { cursor: pointer; }
.ov-donut__link:focus-visible { outline: none; }
.ov-donut__link:focus-visible .ov-donut__seg { stroke-width: 30; }
.ov-legend li.is-hot { background: var(--st-surface-sunken); }
.ov-legend__key { width: 0.75rem; height: 0.75rem; border-radius: 3px; }
.ov-legend__key--1 { background: var(--st-chart-1); } .ov-legend__key--2 { background: var(--st-chart-2); } .ov-legend__key--3 { background: var(--st-chart-3); }
.ov-legend__key--4 { background: var(--st-chart-4); } .ov-legend__key--5 { background: var(--st-chart-5); } .ov-legend__key--6 { background: var(--st-chart-6); }
.ov-legend__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-legend__n { font-weight: var(--st-weight-bold); font-variant-numeric: tabular-nums; }
.ov-legend__pct { color: var(--st-ink-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Last 30 days: changes per day, stacked by where they were made */
.ov-sources { display: flex; flex-wrap: wrap; gap: var(--st-space-4); margin: 0 0 var(--st-space-2); color: var(--st-ink-muted); font-size: var(--st-text-xs); }
.ov-sources > span { display: inline-flex; align-items: center; gap: 0.4rem; }
.ov-sources__key { width: 0.625rem; height: 0.625rem; border-radius: 3px; }
.ov-sources__key--mobile { background: var(--st-chart-1); } .ov-sources__key--web { background: var(--st-chart-2); } .ov-sources__key--import { background: var(--st-chart-3); } .ov-sources__key--ai { background: var(--st-chart-4); }
.ov-chart { display: block; width: 100%; height: 7rem; overflow: visible; }
.ov-bar { transform-box: fill-box; transform-origin: bottom; }
.ov-bar--mobile { fill: var(--st-chart-1); } .ov-bar--web { fill: var(--st-chart-2); } .ov-bar--import { fill: var(--st-chart-3); } .ov-bar--ai { fill: var(--st-chart-4); }
.ov-chart__hit { fill: transparent; }
.ov-tip { position: absolute; z-index: var(--st-z-menu); padding: 0.35rem 0.6rem; border-radius: var(--st-radius-sm); background: var(--st-ink); color: var(--st-canvas); font-size: var(--st-text-xs); white-space: nowrap; pointer-events: none; transform: translate(-50%, calc(-100% - 8px)); box-shadow: var(--st-shadow-menu); }

/* Bars build in once on load; nothing moves for "reduce motion". */
@media (prefers-reduced-motion: no-preference) {
  .ov-meter__fill { animation: ov-grow-x 700ms var(--st-ease) both; }
  .ov-meter:nth-child(2) .ov-meter__fill { animation-delay: 90ms; }
  .ov-meter:nth-child(3) .ov-meter__fill { animation-delay: 180ms; }
  .ov-bar { animation: ov-grow-y 520ms var(--st-ease) both; animation-delay: calc(var(--i) * 18ms + 150ms); }
  .ov-donut__seg { animation: ov-draw 800ms var(--st-ease) both; animation-delay: calc(var(--i) * 70ms + 100ms); }
}
@keyframes ov-grow-x { from { transform: scaleX(0); } }
@keyframes ov-grow-y { from { transform: scaleY(0); } }
@keyframes ov-draw { from { stroke-dasharray: 0 400; } }

.ov-card { padding: var(--st-space-4) var(--st-space-5); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); min-width: 0; }
.ov-card h2 { margin: 0 0 var(--st-space-3); font-size: var(--st-text-md); }
.ov-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--st-space-3); }
.ov-card__head a { font-size: var(--st-text-sm); }
.ov-attention { display: grid; gap: var(--st-space-2); margin: 0; }
.ov-clear { margin: 0; color: var(--st-ink-muted); }
.ov-usage { margin: 0 0 var(--st-space-3); color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.ov-chart__ends { display: flex; justify-content: space-between; margin: var(--st-space-1) 0 0; color: var(--st-ink-muted); font-size: var(--st-text-xs); }
.ov-chart__base { stroke: var(--st-line); stroke-width: 1; vector-effect: non-scaling-stroke; }

@media (max-width: 767px) {
  .ov-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cov" "where" "att"; }
}

@media (max-width: 479px) {
  /* The facts line wraps here: a line starting with "·" looks broken. */
  .ov-facts > * + *::before { content: none; }
  .ov-tiles { grid-template-columns: 1fr 1fr; }
  .ov-meter { grid-template-columns: minmax(0, 1fr); gap: var(--st-space-1); }
  .ov-meter dd { grid-template-columns: minmax(0, 1fr) 3rem auto; gap: var(--st-space-2); }
  .ov-card { padding: var(--st-space-4); }
}

/* ---------- footer (every page) and the Privacy / Terms pages ---------- */

/* Short pages keep the footer at the bottom of the window; it never sticks
   over content. */
body:has(> .site-footer):not(.auth-page) {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body:has(> .site-footer) > main { flex: 1 0 auto; width: 100%; }
.auth-page:has(> .site-footer) { grid-template-rows: 1fr auto; }

.site-footer {
  width: 100%;
  border-top: 1px solid var(--st-line);
  color: var(--st-ink-muted);
  font-size: var(--st-text-sm);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--st-space-1) var(--st-space-4);
  max-width: var(--st-content-max);
  margin: 0 auto;
  padding: var(--st-space-4);
}
.site-footer a { color: inherit; text-underline-offset: 0.2em; }
.site-footer a:hover { color: var(--st-accent); }
.site-footer__rev { font-family: var(--st-font-code); font-size: var(--st-text-xs); }
.auth-page .site-footer { border-top: 0; }
@media print { .site-footer { display: none; } }

.legal { max-width: 42rem; }
.legal h2 { margin-top: var(--st-space-6); }
.legal p { margin: 0 0 var(--st-space-3); }
.legal__list { margin: 0 0 var(--st-space-3); padding-left: 1.25rem; }
.legal__list li + li { margin-top: var(--st-space-2); }
.legal__updated { color: var(--st-ink-muted); font-size: var(--st-text-sm); }
.legal__intro { font-size: var(--st-text-lg); line-height: 1.4; }

/* ---------- Help & feedback ---------- */

.help__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-space-3);
  margin-bottom: var(--st-space-5);
}
.help__head h1 { margin: 0; }
.help__mine { margin-bottom: var(--st-space-6); }
.help__mine h2 { margin-top: 0; }

.help-list li + li { border-top: 1px solid var(--st-line); }
.help-list__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--st-space-1) var(--st-space-3);
  padding: var(--st-space-3) 0;
  color: inherit;
  text-decoration: none;
}
.help-list__row:hover .help-list__subject { color: var(--st-accent); text-decoration: underline; }
.help-list__subject { flex: 1 1 12rem; font-weight: var(--st-weight-medium); min-width: 0; overflow-wrap: anywhere; }
.help-list__when { font-size: var(--st-text-sm); }

.help-kind, .help-status, .help-new {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: var(--st-radius-pill);
  font-size: var(--st-text-xs);
  font-weight: var(--st-weight-medium);
  white-space: nowrap;
}
.help-kind--help { background: var(--st-accent-soft); color: var(--st-accent); }
.help-kind--feedback { background: var(--st-surface-sunken); color: var(--st-ink); }
.help-status--open { background: var(--st-warning-soft); color: var(--st-warning-ink); }
.help-status--answered { background: var(--st-success-soft); color: var(--st-success-ink); }
.help-status--closed { background: var(--st-surface-sunken); color: var(--st-ink-muted); }
.help-new { background: var(--st-accent); color: var(--st-on-accent); }

.guide {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--st-space-6);
  align-items: start;
}
.guide__toc { position: sticky; top: var(--st-space-4); }
.guide__toc-title { margin: 0 0 var(--st-space-2); font-weight: var(--st-weight-bold); }
.guide__search { width: 100%; margin-bottom: var(--st-space-3); }
.guide__toc li { padding: var(--st-space-1) 0; }
.guide__toc a { color: var(--st-ink-muted); text-decoration: none; }
.guide__toc a:hover { color: var(--st-accent); text-decoration: underline; }
.guide__body { max-width: 42rem; }
.guide__topic { scroll-margin-top: var(--st-space-4); }
.guide__topic + .guide__topic { margin-top: var(--st-space-6); }
.guide__topic h2 { margin: 0 0 var(--st-space-3); }
.guide__topic p { margin: 0 0 var(--st-space-3); }
@media (max-width: 767px) {
  .guide { grid-template-columns: 1fr; gap: var(--st-space-5); }
  .guide__toc { position: static; }
}

.help-form { max-width: 44rem; }
.help-kinds { border: 0; margin: 0 0 var(--st-space-4); padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--st-space-3); }
.help-kinds legend { grid-column: 1 / -1; padding: 0; margin-bottom: var(--st-space-2); }
.help-kinds__option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 var(--st-space-2);
  padding: var(--st-space-3) var(--st-space-4);
  border: 1px solid var(--st-field);
  border-radius: var(--st-radius-md);
  align-content: start;
  cursor: pointer;
}
.help-kinds__option:has(input:checked) { border-color: var(--st-accent); box-shadow: inset 0 0 0 1px var(--st-accent); background: var(--st-accent-soft); }
.help-kinds__option input { margin-top: 0.3em; accent-color: var(--st-accent); }
.help-kinds__word { font-weight: var(--st-weight-bold); }
.help-kinds__hint { grid-column: 2; font-size: var(--st-text-sm); }
.help-item .input[type=search] { width: 100%; }
.help-item__chosen { display: flex; align-items: center; gap: var(--st-space-2); margin: 0; font-weight: var(--st-weight-medium); }
.help-item__list { max-height: 18rem; overflow-y: auto; margin-top: var(--st-space-2); border: 1px solid var(--st-line); border-radius: var(--st-radius-md); overflow-x: hidden; overscroll-behavior: contain; }
.help-item__option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--st-space-2);
  width: 100%;
  padding: var(--st-space-2) var(--st-space-3);
  border: 0;
  background: var(--st-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  justify-content: flex-start;
  cursor: pointer;
}
.help-item__more { margin: var(--st-space-1) 0 0; font-size: var(--st-text-sm); }
.help-item__list li + li .help-item__option { border-top: 1px solid var(--st-line); }
.help-item__option:hover, .help-item__option:focus-visible { background: var(--st-surface-sunken); }
.help-drop { padding: var(--st-space-4); border: 1.5px dashed var(--st-field); border-radius: var(--st-radius-md); }
.help-drop.is-over { border-color: var(--st-accent); background: var(--st-accent-soft); }
.help-drop__hint { margin: var(--st-space-2) 0 0; font-size: var(--st-text-sm); }
.help-drop__list li { display: flex; align-items: center; justify-content: space-between; gap: var(--st-space-2); padding-top: var(--st-space-2); overflow-wrap: anywhere; }
.warning-text { color: var(--st-warning-ink); }
.help-form__actions { display: flex; gap: var(--st-space-2); margin-top: var(--st-space-5); }
@media (max-width: 479px) {
  .help-kinds { grid-template-columns: 1fr; }
  .help-form__actions .btn--primary { flex: 1; }
}

.help-ticket__head h1 { margin-bottom: var(--st-space-2); overflow-wrap: anywhere; }
.help-ticket__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-1) var(--st-space-3); margin: 0 0 var(--st-space-5); font-size: var(--st-text-sm); }
.help-thread { list-style: none; padding: 0; max-width: 48rem; display: grid; gap: var(--st-space-3); margin-bottom: var(--st-space-5); }
.help-msg { padding: var(--st-space-4); background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); }
.help-msg--staff { background: var(--st-accent-soft); border-color: transparent; }
.help-msg__who { display: flex; align-items: center; gap: var(--st-space-1); margin: 0 0 var(--st-space-2); font-size: var(--st-text-sm); font-weight: var(--st-weight-bold); }
.help-msg__who img { border-radius: 5px; }
.help-msg__body { overflow-wrap: anywhere; }
.help-msg__body p { margin: 0 0 var(--st-space-2); }
.help-msg__body p:last-child { margin-bottom: 0; }
.help-files { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin-top: var(--st-space-3); }
.help-files__thumb img { display: block; width: 8rem; height: 6rem; object-fit: cover; border-radius: var(--st-radius-sm); border: 1px solid var(--st-line); background: var(--st-surface-sunken); }
.help-files__chip { display: inline-flex; gap: var(--st-space-1); padding: var(--st-space-2) var(--st-space-3); border: 1px solid var(--st-field); border-radius: var(--st-radius-pill); font-size: var(--st-text-sm); overflow-wrap: anywhere; }
.help-reply { max-width: 48rem; }
.help-ticket__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }

.help-dot { display: inline-block; width: 0.5rem; height: 0.5rem; margin-left: 0.3rem; border-radius: 50%; background: var(--st-danger); vertical-align: 0.15em; }
.help-count { display: inline-block; min-width: 1.3rem; padding: 0 0.35rem; margin-left: 0.25rem; border-radius: var(--st-radius-pill); background: var(--st-danger); color: #fff; font-size: var(--st-text-xs); font-weight: var(--st-weight-bold); line-height: 1.3rem; text-align: center; }
.help-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-3); margin: var(--st-space-4) 0; }
.help-filters .chip.is-active { background: var(--st-accent); color: var(--st-on-accent); }
.help-filters__status { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }

} /* @layer components */

/* Tracker section on the thing page */
.tracker-seen { display: grid; gap: var(--st-space-4); margin-bottom: var(--st-space-4); }
.tracker-history-map { margin-top: var(--st-space-3); }
.tracker-history-more { margin-top: var(--st-space-2); display: flex; align-items: center; gap: var(--st-space-2); }
.tracker-history-more[hidden], .tracker-history tr[hidden] { display: none; }
.tracker-history-map .tracker-map { margin-top: var(--st-space-2); }
.tracker-pin { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--st-accent); color: var(--st-on-accent); font-size: 0.75rem; font-weight: 600; border: 2px solid var(--st-surface); box-shadow: 0 1px 3px rgb(0 0 0 / 0.35); }
.tracker-pin--on { background: var(--st-danger); transform: scale(1.25); }
tr.is-picked > td { background: var(--st-accent-soft); }
.tracker-history tr[data-point] { cursor: pointer; }
.tracker-map { height: 16rem; border-radius: var(--st-radius-md); border: 1px solid var(--st-line); z-index: 0; }
@media (min-width: 48rem) { .tracker-seen:has(.tracker-map) { grid-template-columns: 1fr 1fr; align-items: start; } }

/* Operator tools: users and spaces grouped by account (an account's root and everyone invited from it). */
.account-groups { display: grid; gap: var(--st-space-3); }
.account { border: 1px solid var(--st-line); border-radius: var(--st-radius-md); background: var(--st-surface); }
.account > .table-wrap { margin: 0 var(--st-space-3) var(--st-space-3); }
.account__head { list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--st-space-1) var(--st-space-3); padding: var(--st-space-3) var(--st-space-4); cursor: pointer; }
.account__name { font-weight: var(--st-weight-bold); font-size: var(--st-text-lg); }
.account__meta { color: var(--st-ink-muted); font-size: var(--st-text-sm); font-variant-numeric: tabular-nums; }
.account__people { display: grid; margin: 0; padding: 0 var(--st-space-4) var(--st-space-3); border-top: 1px solid var(--st-line); }
.account__person { display: grid; gap: 0.125rem; padding: var(--st-space-2) 0 var(--st-space-2) calc(var(--depth, 0) * 1.5rem); border-bottom: 1px solid var(--st-line); min-width: 0; }
.account__person:last-child { border-bottom: 0; }
.account__who { overflow-wrap: anywhere; }
.account__branch { margin-right: 0.4rem; color: var(--st-ink-muted); }
.account__facts { font-size: var(--st-text-sm); overflow-wrap: anywhere; }
.account__head::-webkit-details-marker { display: none; }
.account__head::before { content: ""; align-self: center; width: 0.5rem; height: 0.5rem; border-right: 2px solid var(--st-ink-muted); border-bottom: 2px solid var(--st-ink-muted); transform: rotate(-45deg); transition: transform 0.15s; }
.account[open] > .account__head::before { transform: rotate(45deg); }
.help-filters .input--search { flex: 0 1 22rem; min-width: 0; }
@media (prefers-reduced-motion: reduce) { .account__head::before { transition: none; } }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin-top: var(--st-space-3); }
.row-actions form { margin: 0; }
.sign-ins li { align-items: center; justify-content: space-between; }
.operator-log { display: grid; gap: var(--st-space-2); margin: 0; }
.account > .account__people:first-child { border-top: 0; padding-top: var(--st-space-1); }

/* History → People (beta accounts step 6) */
@layer pages {
  .people-history summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--st-space-2); }
  .people-history__title { display: inline; margin: 0; font-size: var(--st-text-lg); }
  .people-history__list { margin: var(--st-space-3) 0 0; display: grid; gap: var(--st-space-2); }
}

/* View only (beta accounts step 5): the services refuse a viewer's changes;
   these hide the controls for them. Forms a viewer may still send carry
   data-viewer-ok (switch space, log out, help, leave a space...). */
@layer pages {
  .is-viewer form[method="post"]:not([data-viewer-ok]),
  .is-viewer [data-edit] { display: none !important; }
  .viewer-note { margin: 0 0 var(--st-space-4); padding: var(--st-space-3) var(--st-space-4); border-radius: var(--st-radius-md, 8px); background: var(--st-accent-soft); color: var(--st-ink); }
}
/* Thing page cards (card_edit.js): the content shows first; Edit swaps in the
   card's form (.is-editing), Cancel or Done swaps it back. View only members
   never get the forms. */
@layer pages {
  [data-card]:not(.is-editing) [data-card-form],
  [data-card].is-editing [data-card-read],
  [data-card].is-editing [data-card-open] { display: none; }
  .card-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-3); margin: 0 0 var(--st-space-4); }
  .card-head h2 { margin: 0 auto 0 0; }
  .card-head__count { margin-left: var(--st-space-1); color: var(--st-ink-muted); font-size: var(--st-text-md); font-weight: var(--st-weight-regular); }
  .card.is-editing { border-color: var(--st-accent); box-shadow: 0 0 0 1px var(--st-accent); }
  .attr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: var(--st-space-3) var(--st-space-5); margin: 0; }
  .attr-list dt { color: var(--st-ink-muted); font-size: var(--st-text-sm); }
  .attr-list dd { margin: 0; overflow-wrap: anywhere; }
  .photo-grid--small { grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); gap: var(--st-space-3); margin: 0; }
  .jump-links { display: flex; flex-wrap: wrap; gap: var(--st-space-1) var(--st-space-5); margin: 0 0 var(--st-space-4); padding: 0 var(--st-space-1); font-size: var(--st-text-sm); }
  .thing-summary__where.is-editing { padding: var(--st-space-4); border: 2px solid var(--st-accent); background: var(--st-surface); }
  .thing-summary__stock { display: grid; gap: var(--st-space-2); }
  .thing-summary__stock .stock-row:last-of-type { border-bottom: 0; }
  /* Phone width: the cards' links become a list to tap. */
  @media (max-width: 599px) {
    .jump-links { flex-direction: column; gap: 0; padding: 0; background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); font-size: var(--st-text-md); }
    .jump-links a { display: flex; align-items: center; min-height: 3rem; padding: 0 var(--st-space-4); color: var(--st-ink); text-decoration: none; }
    .jump-links a + a { border-top: 1px solid var(--st-line); }
    .jump-links a::after { content: "›"; margin-left: auto; color: var(--st-ink-muted); }
  }
  .dropzone--compact { margin-top: var(--st-space-4); padding: var(--st-space-3) var(--st-space-4); font-size: var(--st-text-sm); }
}
@layer pages {
  .delete-list { display: grid; gap: var(--st-space-2); margin: 0 0 var(--st-space-4); padding-left: var(--st-space-4); list-style: disc; }
}

/* An invitation waiting for the logged-in person (top of every page). */
@layer pages {
  .pending-invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-3) var(--st-space-4); margin: 0 0 var(--st-space-4); padding: var(--st-space-3) var(--st-space-4); border: 1px solid var(--st-accent); border-radius: var(--st-radius-md, 8px); background: var(--st-accent-soft); color: var(--st-ink); }
  .pending-invite__text { flex: 1 1 18rem; margin: 0; }
  .pending-invite__note { color: var(--st-ink-muted); }
  .pending-invite__actions { display: flex; gap: var(--st-space-2); }
  .pending-invite__actions form { margin: 0; }
}

/* Team spaces on Manage → Team and the operator's team page. */
@layer pages {
  .team-spaces { display: grid; gap: var(--st-space-2); margin: 0 0 var(--st-space-4); }
  .team-spaces__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--st-space-2); }
  .team-spaces__row form { margin: 0; }
  .team-spaces__actions { display: flex; flex-wrap: wrap; gap: var(--st-space-2); }
}

/* AI connections page */
.ai-card { padding-bottom: var(--st-space-4); }
.ai-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2) var(--st-space-4); }
.ai-card__head h2 { margin: 0.75rem 0 0; }
.ai-card__tags { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin-top: 0.75rem; }
.ai-card__facts { margin: var(--st-space-3) 0; display: grid; gap: var(--st-space-2); }
.ai-card__facts div { display: flex; flex-wrap: wrap; gap: var(--st-space-1) var(--st-space-4); }
.ai-card__facts dt { flex: 0 0 6rem; color: var(--st-ink-muted); }
.ai-card__facts dd { margin: 0; flex: 1 1 12rem; display: flex; flex-wrap: wrap; gap: var(--st-space-1) var(--st-space-3); }
.ai-card__actions { margin: 0 0 var(--st-space-3); }
.ai-card__actions summary { cursor: pointer; font-weight: var(--st-weight-bold); }
.ai-card__actions ul { margin: var(--st-space-2) 0 0; }
.ai-action { padding: var(--st-space-2) 0; border-bottom: 1px solid var(--st-line); }
.ai-action:last-child { border-bottom: 0; }
.ai-action__text { overflow-wrap: anywhere; }
.ai-action__meta { display: block; font-size: var(--st-text-sm); color: var(--st-ink-muted); }
.ai-url { display: block; padding: var(--st-space-2) var(--st-space-3); background: var(--st-surface-sunken); border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
.feature-row--after, .feature-row + .feature-row--after { margin-top: var(--st-space-3); padding-top: 0; border-top: 0; }

/* Operator tools → Page content → Emails → Preview emails */
@layer pages {
  .email-preview { margin-bottom: var(--st-space-5); }
  .email-preview__subject { margin: 0 0 var(--st-space-3); }
  .email-preview__html { display: block; width: 100%; height: 34rem; border: 1px solid var(--st-line); border-radius: var(--st-radius-md); background: #f5f2ee; }
  .email-preview__text { margin: var(--st-space-3) 0 0; white-space: pre-wrap; font-size: var(--st-text-sm); }
  @media (max-width: 767px) { .email-preview__html { height: 52rem; } }
}

/* Receiver pages (webadmin/receiver/): Your items, an item, the report form. Phone first. */
@layer pages {
  .rcv-space { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--st-ink-muted); font-size: var(--st-text-sm); }
  .rcv-head { margin-bottom: var(--st-space-4); }
  .rcv-head h1 { margin: 0 0 var(--st-space-1); overflow-wrap: anywhere; }
  .rcv-head .page-intro { margin: 0; }
  .rcv-head__codes { margin: var(--st-space-2) 0 0; }
  .rcv-filter { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin-bottom: var(--st-space-5); }
  .rcv-filter__place { flex: 1 1 12rem; min-width: 0; }
  .rcv-filter__sort { flex: 1 1 12rem; min-width: 0; }
  .rcv-filter__q { flex: 1 1 10rem; min-width: 0; }
  .rcv-row__detail { display: block; font-size: var(--st-text-sm); color: var(--st-ink-muted); overflow-wrap: anywhere; }
  .rcv-section { margin-bottom: var(--st-space-6); }
  .rcv-section h2 { margin: 0 0 var(--st-space-2); font-size: var(--st-text-lg); }
  .rcv-list { list-style: none; margin: 0; padding: 0; background: var(--st-surface); border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); overflow: hidden; }
  .rcv-list li + li { border-top: 1px solid var(--st-line); }
  .rcv-row { display: flex; align-items: center; gap: var(--st-space-3); min-height: 4.5rem; padding: var(--st-space-3); color: var(--st-ink); text-decoration: none; }
  .rcv-row:hover { background: var(--st-surface-sunken); }
  .rcv-row__thumb { flex: none; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; overflow: hidden; border-radius: var(--st-radius-md); background: var(--st-surface-sunken); color: var(--st-ink-muted); }
  .rcv-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
  .rcv-row__thumb svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
  .rcv-row__main { flex: 1 1 auto; min-width: 0; display: grid; gap: 0.125rem; }
  .rcv-row__name { font-weight: var(--st-weight-bold); overflow-wrap: anywhere; }
  .rcv-row__codes .code-tape { font-size: var(--st-text-xs); }
  .rcv-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-1) var(--st-space-2); font-size: var(--st-text-sm); }
  .rcv-row__meta .status { margin-left: 0; }
  .rcv-row__qty { color: var(--st-ink-muted); }
  .rcv-row__none { color: var(--st-ink-muted); font-style: italic; }
  .rcv-row__chevron { flex: none; width: 0.75rem; height: 0.75rem; fill: none; stroke: var(--st-ink-muted); stroke-width: 1.5; }

  .rcv-outcome { gap: 0.3em; margin-left: 0; font-weight: var(--st-weight-bold); }
  .rcv-outcome svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .rcv-outcome--ok { background: var(--st-success-soft); color: var(--st-success-ink); }
  .rcv-outcome--damaged { background: var(--st-danger-soft); color: var(--st-danger); }
  .rcv-outcome--other { background: var(--st-warning-soft); color: var(--st-warning-ink); }

  .rcv-photos { display: flex; gap: var(--st-space-2); margin: 0 0 var(--st-space-4); padding: 0 0 var(--st-space-1); list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; }
  .rcv-photos li { flex: none; scroll-snap-align: start; }
  .rcv-photos img { display: block; width: 10rem; height: 10rem; object-fit: cover; border: 1px solid var(--st-line); border-radius: var(--st-radius-md); background: var(--st-surface-sunken); }
  .rcv-card { padding-bottom: var(--st-space-4); }
  .rcv-card h2 { font-size: var(--st-text-md); }
  .rcv-at { list-style: none; margin: 0; padding: 0; }
  .rcv-at li { display: flex; justify-content: space-between; gap: var(--st-space-3); padding: var(--st-space-2) 0; }
  .rcv-at li + li { border-top: 1px solid var(--st-line); }
  .rcv-at__qty { flex: none; font-weight: var(--st-weight-bold); }
  .rcv-note { margin: 0; overflow-wrap: anywhere; }
  .rcv-details { display: grid; gap: var(--st-space-2); margin: 0; }
  .rcv-details div { display: flex; flex-wrap: wrap; gap: 0 var(--st-space-3); }
  .rcv-details dt { flex: 0 0 8rem; color: var(--st-ink-muted); }
  .rcv-details dd { flex: 1 1 10rem; margin: 0; overflow-wrap: anywhere; }
  .rcv-reports { list-style: none; margin: 0; padding: 0; }
  .rcv-report { padding: var(--st-space-3) 0; }
  .rcv-report + .rcv-report { border-top: 1px solid var(--st-line); }
  /* After saving, the page opens at the new report (#report-<pk>); it glows briefly. */
  .rcv-report { scroll-margin-top: var(--st-space-6); }
  .rcv-report:target { animation: rcv-report-new 2.4s ease-out; border-radius: var(--st-radius-sm); }
  @keyframes rcv-report-new {
    from { background: color-mix(in srgb, var(--st-accent) 22%, transparent); box-shadow: 0 0 0 var(--st-space-2) color-mix(in srgb, var(--st-accent) 22%, transparent); }
    to { background: transparent; box-shadow: 0 0 0 var(--st-space-2) transparent; }
  }
  @media (prefers-reduced-motion: reduce) { .rcv-report:target { animation: none; outline: 2px solid var(--st-accent); outline-offset: 2px; } }
  .rcv-report__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); margin: 0; }
  .rcv-report__comment { margin: var(--st-space-2) 0 0; overflow-wrap: anywhere; }
  .rcv-report__photos { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin: var(--st-space-2) 0 0; padding: 0; list-style: none; }
  .rcv-report__photos img { display: block; width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: var(--st-radius-sm); border: 1px solid var(--st-line); }
  .reports-table .rcv-report__photos { flex-wrap: nowrap; margin: 0; }
  .reports-table .rcv-report__photos img { width: 3rem; height: 3rem; }
  .reports-table__comment { min-width: 14rem; overflow-wrap: anywhere; }
  .review-summary { margin: var(--st-space-4) 0 var(--st-space-2); }
  .review-filters { display: flex; flex-wrap: wrap; gap: var(--st-space-2); margin-bottom: var(--st-space-4); }
  .review-filter { padding: var(--st-space-1) var(--st-space-3); border: 1px solid var(--st-line); border-radius: 999px; color: var(--st-ink); text-decoration: none; font-size: var(--st-text-sm); background: var(--st-surface); }
  .review-filter:hover { background: var(--st-surface-sunken); }
  .review-filter.is-active { border-color: var(--st-accent); box-shadow: inset 0 0 0 1px var(--st-accent); font-weight: 600; }
  .review-more { margin-top: var(--st-space-1); padding: 0; border: 0; background: none; color: var(--st-accent); font: inherit; font-size: var(--st-text-sm); cursor: pointer; text-decoration: underline; }
  .review-more::after { content: " \25B8"; }
  .review-more[aria-expanded="true"]::after { content: " \25BE"; }
  .review-earlier-row td { color: var(--st-ink-muted); border-top: 1px dashed var(--st-line); }
  .review-earlier-row td:nth-child(3) { padding-left: var(--st-space-5); }
  .rcv-report__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--st-space-2); margin: var(--st-space-2) 0 0; font-size: var(--st-text-sm); }

  /* The main action: large, at the bottom, in reach of a thumb. */
  .rcv-bottom { position: sticky; bottom: 0; z-index: var(--st-z-sticky); margin: var(--st-space-5) calc(-1 * var(--st-space-4)) 0; padding: var(--st-space-3) var(--st-space-4) calc(var(--st-space-3) + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--st-canvas) 92%, transparent); border-top: 1px solid var(--st-line); backdrop-filter: blur(6px); }
  .rcv-bottom__button { min-height: 3.25rem; font-size: var(--st-text-lg); }
  @media (min-width: 768px) { .rcv-bottom { position: static; margin-inline: 0; padding-inline: 0; background: none; border-top: 0; backdrop-filter: none; } .rcv-bottom__button { width: auto; min-width: 16rem; } }

  .rcv-form { max-width: 36rem; }
  .rcv-form__date { max-width: 12rem; }
  .rcv-form__photos { display: block; max-width: 100%; padding: var(--st-space-2) 0; }
  .report-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: var(--st-space-2); margin: var(--st-space-2) 0; padding: 0; list-style: none; }
  .report-photos:empty { display: none; }
  .report-photo { position: relative; aspect-ratio: 1; border: 1px solid var(--st-line); border-radius: var(--st-radius-md); background: var(--st-surface-sunken); overflow: hidden; }
  .report-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .report-photo.is-preparing::before { content: ""; position: absolute; inset: 0; margin: auto; width: 1.5rem; height: 1.5rem; border: 2px solid var(--st-line); border-top-color: var(--st-accent); border-radius: 50%; animation: report-photo-spin 0.8s linear infinite; }
  .report-photo.is-unreadable::before { content: attr(data-name); position: absolute; inset: var(--st-space-1); font-size: var(--st-text-xs); overflow-wrap: anywhere; color: var(--st-ink-muted); }
  .report-photo__remove { position: absolute; top: 0.25rem; right: 0.25rem; display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 1.75rem; height: 1.75rem; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.6); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
  .report-photos__add { margin-top: var(--st-space-1); }
  .report-photos__status { margin: var(--st-space-1) 0 0; font-size: var(--st-text-sm); color: var(--st-ink-muted); }
  .report-photos__status:empty { display: none; }
  @keyframes report-photo-spin { to { transform: rotate(360deg); } }
  /* Saving a report can take a while on a phone (photos uploading): the button spins. */
  .btn.is-saving, .btn.is-saving:disabled { display: inline-flex; align-items: center; justify-content: center; gap: var(--st-space-2); opacity: 1; cursor: progress; }
  .btn.is-saving::before { content: ""; flex: none; width: 1.1em; height: 1.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: report-photo-spin 0.7s linear infinite; }
  .btn--block.is-saving { display: flex; }
  @media (prefers-reduced-motion: reduce) { .btn.is-saving::before { animation-duration: 2s; } }
  @media (prefers-reduced-motion: reduce) { .report-photo.is-preparing::before { animation: none; } }
  .rcv-outcomes { border: 0; margin: 0 0 var(--st-space-4); padding: 0; min-width: 0; }
  .rcv-outcomes__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--st-space-2); }
  .rcv-choice { position: relative; display: block; cursor: pointer; }
  .rcv-choice, .rcv-choice__box { height: 100%; }
  .rcv-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
  .rcv-choice__box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--st-space-1); min-height: 5rem; padding: var(--st-space-2); text-align: center; font-weight: var(--st-weight-bold); line-height: var(--st-leading-tight); background: var(--st-surface); border: 2px solid var(--st-line); border-radius: var(--st-radius-lg); color: var(--st-ink); }
  .rcv-choice__box svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .rcv-choice:hover .rcv-choice__box { background: var(--st-surface-sunken); }
  .rcv-choice input:focus-visible + .rcv-choice__box { outline: 3px solid var(--st-focus); outline-offset: 2px; }
  .rcv-choice--ok input:checked + .rcv-choice__box { background: var(--st-success-soft); border-color: var(--st-success-ink); color: var(--st-success-ink); }
  .rcv-choice--damaged input:checked + .rcv-choice__box { background: var(--st-danger-soft); border-color: var(--st-danger); color: var(--st-danger); }
  .rcv-choice--other input:checked + .rcv-choice__box { background: var(--st-warning-soft); border-color: var(--st-warning-ink); color: var(--st-warning-ink); }
  .rcv-sheet-group { margin-top: 0; padding-top: 0; border-top: 0; }
}
