:root {
  --bg: #f7f3ec;
  --surface: #ffffff;
  --surface-soft: #fbf8f1;
  --line: #e8dfd3;
  --line-strong: #d7c9b8;
  --text: #261f18;
  --muted: #74695d;
  --accent: #7b4e2a;
  --accent-strong: #5f391d;
  --accent-soft: #f2e6d8;
  --green: #1f7a45;
  --green-soft: #eaf7ef;
  --amber: #a26416;
  --amber-soft: #fff4e6;
  --red: #b42318;
  --shadow: 0 18px 55px rgba(72, 50, 28, .10);
}

* { box-sizing: border-box; }

html {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Aptos, "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(123, 78, 42, .10), transparent 30%),
    linear-gradient(180deg, #fff, #f7f3ec);
}

.login-screen.is-hidden { display: none; }

.login-card {
  width: min(430px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 230px;
  height: 82px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.login-subtitle {
  margin: 6px 0 26px;
  color: var(--muted);
}

.login-form, .dialog-card {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.field-block {
  display: grid;
  gap: 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(10, 30px);
  gap: 8px;
  width: max-content;
  max-width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf4;
  box-shadow: 0 12px 30px rgba(72, 50, 28, .12);
}

.color-palette.is-hidden {
  display: none;
}

.color-picker-button {
  width: fit-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  padding: 5px 11px 5px 6px;
  color: var(--text);
  font-weight: 600;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--line-strong);
  padding: 0;
}

.swatch.is-selected {
  box-shadow: 0 0 0 3px rgba(123, 78, 42, .24), 0 0 0 1px var(--accent);
}

.swatch-warm { background: #d8b992; }
.swatch-sand { background: #cfc09d; }
.swatch-cream { background: #ead9b8; }
.swatch-taupe { background: #b5a18c; }
.swatch-gold { background: #c99a38; }
.swatch-mustard { background: #b98925; }
.swatch-ochre { background: #c17f32; }
.swatch-green { background: #79ad82; }
.swatch-olive { background: #8d965c; }
.swatch-moss { background: #6f8354; }
.swatch-mint { background: #9fc8ac; }
.swatch-sage { background: #9aaa8b; }
.swatch-teal { background: #5f9a94; }
.swatch-cyan { background: #6aaeb0; }
.swatch-blue { background: #8493a5; }
.swatch-sky { background: #8ea9c5; }
.swatch-navy { background: #53627c; }
.swatch-indigo { background: #62608f; }
.swatch-lavender { background: #a596be; }
.swatch-violet { background: #8370a5; }
.swatch-mauve { background: #b08aa2; }
.swatch-rose { background: #b46a61; }
.swatch-burgundy { background: #8e4d54; }
.swatch-plum { background: #76506f; }
.swatch-clay { background: #b87956; }
.swatch-rust { background: #a85d37; }
.swatch-copper { background: #b36f43; }
.swatch-blush { background: #cf9387; }
.swatch-slate { background: #78818a; }
.swatch-gray { background: #9b968c; }
.swatch-charcoal { background: #64605a; }
.swatch-ivory { background: #eee5cf; }
.swatch-wheat { background: #d7c28d; }
.swatch-apricot { background: #d99a6c; }
.swatch-terracotta { background: #a9583f; }
.swatch-forest { background: #4f6f4a; }
.swatch-sea { background: #4f8f9a; }
.swatch-denim { background: #5d7898; }
.swatch-orchid { background: #9b76a9; }
.swatch-graphite { background: #55585c; }

.inline-check {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.inline-check input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
}

input, select, textarea {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--text);
  outline: 0;
  padding: 9px 11px;
}

textarea { min-height: 96px; resize: vertical; }
select[multiple] {
  min-height: 132px;
  padding: 6px;
}

select[multiple] option {
  border-radius: 5px;
  padding: 7px 8px;
  margin: 2px 0;
}
input:focus, select:focus, textarea:focus { border-color: #b9895d; box-shadow: 0 0 0 3px rgba(123, 78, 42, .12); }

.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  overflow: hidden;
}

.app-shell.is-hidden {
  display: none !important;
}

.app-shell.is-locked { filter: blur(2px); pointer-events: none; }

.sidebar {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 22px;
  gap: 10px;
}

.brand {
  height: 96px;
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 0;
}

.brand img {
  width: 214px;
  max-height: 96px;
  object-fit: contain;
  object-position: center;
  transform: scale(1.16);
}

.nav-list { display: grid; gap: 4px; }

.nav-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #374151;
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 550;
}

.nav-item > span:not(.nav-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover { background: #fbf8f1; }
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: currentColor;
  font-weight: 650;
  position: relative;
}

.nav-icon::before,
.nav-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}

[data-nav="items"] .nav-icon::before {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  background:
    linear-gradient(currentColor 0 0) 50% 0 / 2px 100% no-repeat,
    linear-gradient(currentColor 0 0) 0 50% / 100% 2px no-repeat;
}

[data-nav="browse"] .nav-icon::before {
  width: 17px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

[data-nav="browse"] .nav-icon::after {
  width: 8px;
  height: 4px;
  left: 3px;
  top: 3px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

[data-nav="incoming"] .nav-icon::before {
  width: 17px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

[data-nav="incoming"] .nav-icon::after {
  width: 5px;
  height: 5px;
  right: 4px;
  top: 5px;
  border-radius: 50%;
  background: currentColor;
}

[data-nav="locations"] .nav-icon::before {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

[data-nav="locations"] .nav-icon::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

[data-nav="camera"] .nav-icon::before {
  width: 17px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

[data-nav="camera"] .nav-icon::after {
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

[data-nav="settings"] .nav-icon::before {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

[data-nav="settings"] .nav-icon::after {
  width: 6px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.help-button {
  width: 100%;
  min-width: 0;
  margin-top: auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #374151;
}

.user-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px 1fr 24px;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #efe2d2;
  color: var(--accent);
  font-weight: 650;
}

.user-card strong, .user-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-card small { color: var(--muted); }
.user-card button { border: 0; background: transparent; color: var(--muted); font-size: 24px; }

.main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  --topbar-space: 90px;
  padding: 26px 24px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  min-width: 0;
}

.title-wrap {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex: 0 0 auto;
  min-width: max-content;
  white-space: nowrap;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; line-height: 1.15; font-weight: 650; letter-spacing: 0; }
h2 { margin-bottom: 5px; font-size: 20px; line-height: 1.2; font-weight: 650; letter-spacing: 0; }
p { color: var(--muted); }

#pageCount {
  min-width: 82px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: 0;
}

.search {
  position: relative;
  width: min(310px, 28vw);
  flex: 1 1 250px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 12px;
}

.search input {
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 28px;
}

.search-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 95;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: 0 16px 38px rgba(31, 20, 11, .16);
}

.search-suggestions button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 5px 8px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}

.search-suggestions button:hover {
  background: #f2e6d8;
}

.search-suggestions span {
  color: var(--accent);
}

.sort-select {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
  flex: 0 0 auto;
}

.sort-select select {
  width: 104px;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--text);
  padding: 0 16px 0 0;
}

.btn {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  color: #1f2937;
  font-weight: 600;
  white-space: nowrap;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: white; }
.btn.dark { background: rgba(255,255,255,.12); color: white; border-color: rgba(255,255,255,.22); }
.btn.danger {
  border-color: #9d2f24;
  background: #9d2f24;
  color: white;
}

.btn.danger:hover {
  background: #7f241c;
}

.ajda-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: start center;
  padding: min(12vh, 96px) 18px 18px;
  background: rgba(30, 25, 20, .48);
}

.ajda-dialog-card {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf4;
  box-shadow: 0 24px 70px rgba(35, 24, 15, .28);
}

.ajda-dialog-card header,
.ajda-dialog-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ajda-dialog-card header strong {
  color: var(--text);
  font-size: 22px;
}

.ajda-dialog-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
  white-space: pre-line;
}

.ajda-dialog-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.ajda-dialog-card input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
}

.ajda-dialog-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(132, 83, 43, .14);
}

.ajda-dialog-card footer {
  justify-content: flex-end;
}
.btn.ghost.is-active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(132, 83, 43, .12);
}

.btn.ghost.filter-is-active {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: #2f716b;
  background: #e8f4f2;
  color: #2f716b;
  box-shadow: 0 0 0 3px rgba(47, 113, 107, .12);
}

.filter-active-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  background: #2f716b;
  color: white;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
}

.global-filter-popover {
  position: fixed;
  z-index: 1200;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf4;
  box-shadow: 0 18px 45px rgba(48, 31, 20, .18);
  scrollbar-width: thin;
}

.filter-popover-head,
.filter-popover-actions,
.range-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-popover-head strong {
  font-size: 18px;
}

.global-filter-popover label,
.filter-range,
.filter-group {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.global-filter-popover label > span,
.filter-range > span,
.filter-group > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.global-filter-popover input[type="date"] {
  width: 100%;
  min-height: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  padding-inline: 8px;
}

.global-filter-popover input[type="date"]::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  opacity: .65;
}

.filter-chip-grid,
.filter-rating-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-filter-grid {
  max-height: 116px;
  overflow: auto;
  padding-right: 2px;
}

.filter-chip {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: white;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

.filter-chip.tag {
  min-height: 28px;
}

.filter-chip.pill,
.filter-chip.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-chip.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(132, 83, 43, .14);
}

.filter-chip.type-chip {
  border-color: var(--line);
}

.filter-chip.type-chip.is-active {
  border-color: var(--accent);
}

.filter-rating-choice {
  width: max-content;
  min-height: 28px;
  display: inline-flex;
  gap: 3px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  padding: 0 9px;
  color: #c8b9aa;
  font-size: 13px;
  font-weight: 650;
}

.filter-rating-choice span,
.filter-rating-choice em {
  font-style: normal;
  line-height: 1;
}

.filter-rating-choice em {
  color: #b36f18;
}

.filter-rating-choice:hover,
.rating-picker:hover {
  border-color: #d6b996;
  box-shadow: 0 0 0 3px rgba(132, 83, 43, .1);
}

.filter-rating-choice.is-active {
  border-color: var(--accent);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(132, 83, 43, .12);
}

.filter-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.filter-location-picker {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.32);
  padding: 6px;
}

.selected-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  min-height: 0;
}

.selected-filter-chip {
  min-height: 22px;
  border: 1px solid #2f716b;
  border-radius: 999px;
  background: #e8f4f2;
  color: #2f716b;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}

.filter-location-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  padding: 0 2px;
}

.filter-location-breadcrumbs button {
  min-height: 21px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 2px;
  font-size: 12px;
  font-weight: 500;
}

.filter-location-breadcrumbs button.is-current {
  color: var(--text);
}

.filter-location-list {
  max-height: 118px;
  overflow: auto;
  display: grid;
  gap: 3px;
}

.filter-location-row {
  display: grid;
  grid-template-columns: 23px 1fr;
  align-items: center;
  gap: 5px;
}

.filter-location-check {
  width: 19px;
  height: 19px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  position: relative;
}

.filter-location-row.is-active .filter-location-check {
  border-color: #2f716b;
  background: #2f716b;
}

.filter-location-row.is-active .filter-location-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 5px;
  height: 9px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(42deg);
}

.filter-location-open {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255,255,255,.78);
  padding: 3px 8px;
  text-align: left;
}

.filter-location-open span {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.filter-location-open small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.dual-range {
  position: relative;
  min-height: 18px;
  display: grid;
  align-items: center;
  margin-top: -2px;
  --range-from: 0%;
  --range-to: 100%;
}

.range-values span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.dual-range::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  border-radius: 999px;
  background: rgba(64, 49, 36, .18);
}

.dual-range::after {
  content: "";
  position: absolute;
  left: var(--range-from);
  right: calc(100% - var(--range-to));
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
}

.dual-range input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
  pointer-events: none;
}

.dual-range input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border: 0;
  background: transparent;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5.5px;
  border: 2px solid #fffaf4;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(132, 83, 43, .45);
  pointer-events: auto;
}

.dual-range input[type="range"]::-moz-range-track {
  height: 2px;
  border: 0;
  background: transparent;
}

.dual-range input[type="range"]::-moz-range-progress {
  background: transparent;
}

.dual-range input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid #fffaf4;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(132, 83, 43, .45);
  pointer-events: auto;
}

.filter-date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filter-date-grid label {
  gap: 5px;
}

.filter-summary {
  min-height: 34px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(132, 83, 43, .08);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

@media (max-width: 1320px) {
  .topbar { gap: 14px; }
  .title-wrap { gap: 10px; }
  h1 { font-size: 24px; }
  .search { width: min(260px, 24vw); flex-basis: 210px; }
  .sort-select select { width: 100px; }
  .btn { padding-inline: 12px; }
}

.view { display: none; }
.view.is-visible {
  display: block;
  flex: 1 1 0;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

#itemsView.is-visible {
  overflow: hidden;
}

.archive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--detail-width, 420px);
  gap: 0;
  align-items: stretch;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns 160ms ease;
}

.catalog-panel, .detail-panel, .page-panel {
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
}

.archive-layout:not(.detail-is-closed) .catalog-panel {
  cursor: default;
}

.catalog-panel {
  border-radius: 10px 0 0 10px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.browse-layout,
.incoming-layout {
  min-height: min(720px, calc(100vh - 150px));
}

.browse-page-panel,
.incoming-page-panel {
  border-radius: 10px 0 0 10px;
  min-height: 0;
  overflow: auto;
}

#browseView .archive-layout.detail-is-closed .browse-page-panel,
#incomingView .archive-layout.detail-is-closed .incoming-page-panel {
  border-radius: 10px;
}

.detail-panel {
  border-left: 0;
  border-radius: 0 10px 10px 0;
  width: 100%;
  min-width: 320px;
  max-width: 720px;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  position: relative;
  top: auto;
  overflow: hidden;
  resize: none;
  scrollbar-color: #cbbba9 #fbf8f1;
  transition: opacity 140ms ease, box-shadow 160ms ease;
  will-change: opacity;
}

.detail-panel::-webkit-scrollbar {
  width: 12px;
}

.detail-panel::-webkit-scrollbar-track {
  background: #fbf8f1;
}

.detail-panel::-webkit-scrollbar-thumb {
  background: #cbbba9;
  border-radius: 999px;
  border: 3px solid #fbf8f1;
}

.detail-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: 12px;
  margin-left: -6px;
  cursor: col-resize;
  background: transparent;
}

.detail-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 2px;
  background: transparent;
}

.detail-resize-handle:hover::after,
.detail-resize-handle:active::after {
  background: #c9aa8e;
}

.archive-layout.detail-is-closed {
  grid-template-columns: minmax(0, 1fr) 44px;
}

#browseView .archive-layout.detail-is-closed,
#incomingView .archive-layout.detail-is-closed {
  display: block;
  grid-template-columns: minmax(0, 1fr) 0;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow: visible;
}

#browseView .archive-layout.detail-is-closed .browse-page-panel,
#incomingView .archive-layout.detail-is-closed .incoming-page-panel {
  overflow: visible;
}

.detail-panel.is-closed {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  resize: none;
  overflow: hidden;
  opacity: .92;
}

#browseView .detail-panel.is-closed,
#incomingView .detail-panel.is-closed {
  width: 0;
  min-width: 0;
  max-width: 0;
  border: 0;
  opacity: 0;
}

.detail-reopen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  background: #fffaf4;
  color: var(--accent);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-weight: 650;
}

.empty-detail {
  min-height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-detail strong {
  color: var(--text);
  font-size: 18px;
}

.detail-scroll {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-bottom: 18px;
  scrollbar-color: #cbbba9 #fbf8f1;
  animation: detailPanelIn 160ms ease both;
}

@keyframes detailPanelIn {
  from {
    opacity: .82;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .archive-layout,
  .detail-panel,
  .detail-scroll {
    transition: none;
    animation: none;
  }
}

.detail-scroll::-webkit-scrollbar {
  width: 12px;
}

.detail-scroll::-webkit-scrollbar-track {
  background: #fbf8f1;
}

.detail-scroll::-webkit-scrollbar-thumb {
  background: #cbbba9;
  border-radius: 999px;
  border: 3px solid #fbf8f1;
}

.gallery-detail-hero {
  padding: 14px 16px 0 24px;
  display: grid;
  gap: 12px;
}

.gallery-detail-preview {
  min-height: 240px;
  border-radius: 8px;
  background: #fffaf4;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.gallery-detail-preview img {
  width: 100%;
  height: 100%;
  max-height: 460px;
  object-fit: contain;
  display: block;
  background: #f7f0e8;
}

.gallery-detail-preview .thumb {
  width: 132px;
  height: 132px;
}

.gallery-detail-folder {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf4;
  padding: 4px 8px;
  font-size: 13px;
}

.ocr-text {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  color: var(--ink);
  padding: 10px;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.gallery-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 20, 11, .72);
}

.gallery-preview-card {
  width: min(1120px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 10px;
  background: #fffaf4;
  box-shadow: 0 24px 80px rgba(31, 20, 11, .34);
}

.gallery-preview-card header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
}

.gallery-preview-card header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.gallery-preview-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.gallery-tool-button {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .68);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  font-size: 15px;
  font-weight: 650;
}

.gallery-tool-button:hover {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--accent);
}

.gallery-zoom-button {
  min-width: 66px;
  font-size: 12px;
}

.gallery-preview-stage {
  position: relative;
  min-height: 280px;
  display: grid;
  place-items: center;
  background: #20150d;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.gallery-preview-zoom-surface {
  width: 100%;
  height: 100%;
  min-height: 280px;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: transparent;
  cursor: zoom-in;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.gallery-preview-stage.is-zoomed .gallery-preview-zoom-surface {
  cursor: grab;
  place-items: start;
  overflow: auto;
}

.gallery-preview-stage.is-zoomed .gallery-preview-zoom-surface:active {
  cursor: grabbing;
}

.gallery-preview-stage img {
  max-width: none;
  max-height: none;
  object-fit: contain;
  display: block;
  margin: auto;
  transition: width .14s ease, height .14s ease;
}

.gallery-preview-stage .thumb {
  width: 180px;
  height: 180px;
}

.gallery-preview-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 34px;
  height: 46px;
  border: 1px solid rgba(255, 250, 244, .18);
  border-radius: 999px;
  background: rgba(255, 250, 244, .12);
  color: #fffaf4;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  opacity: .84;
  backdrop-filter: blur(5px);
}

.gallery-preview-nav::before {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform-origin: center;
}

.gallery-preview-nav:hover {
  opacity: 1;
  background: rgba(255, 250, 244, .2);
  border-color: rgba(255, 250, 244, .34);
}

.gallery-preview-nav.previous {
  left: 14px;
}

.gallery-preview-nav.previous::before {
  transform: rotate(225deg);
}

.gallery-preview-nav.next {
  right: 14px;
}

.gallery-preview-nav.next::before {
  transform: rotate(45deg);
}

.gallery-preview-meta {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.gallery-preview-meta strong {
  color: var(--ink);
}

.table-head, .item-row {
  display: grid;
  grid-template-columns: 34px 84px minmax(180px, 1.4fr) 90px 160px minmax(180px, 1fr) 84px;
  align-items: center;
  gap: 12px;
}

.table-head {
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #fbf8f1;
  color: #475467;
  font-size: 12px;
  font-weight: 600;
}

.check-cell { display: grid; place-items: center; }
.check-cell input { width: 16px; height: 16px; min-height: 0; padding: 0; }

.item-table { display: grid; }

.bulk-bar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fbf4eb;
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.bulk-bar[hidden] {
  display: none;
}

.icon-danger {
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #efc5c5;
  border-radius: 7px;
  background: #fff8f8;
  color: #a54848;
  font-size: 16px;
}

.icon-danger:hover {
  border-color: #d99191;
  background: #fff0f0;
}

.empty-table {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: var(--muted);
  background: #fffaf4;
  text-align: center;
}

.empty-table strong {
  color: var(--text);
  font-size: 18px;
}

.item-row {
  width: 100%;
  min-height: 92px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  padding: 12px 14px;
  text-align: left;
}

.item-row:hover, .item-row.is-selected { background: #f6eee3; }

.thumb {
  width: 70px;
  height: 58px;
  border-radius: 6px;
  border: 1px solid rgba(16,24,40,.08);
  overflow: hidden;
  background: #e6e9ef;
  position: relative;
  box-shadow: 0 8px 18px rgba(16,24,40,.08);
}

.thumb::before, .thumb::after { content: ""; position: absolute; }
.thumb::before { inset: 9px; border-radius: 4px; background: rgba(255,255,255,.66); transform: rotate(var(--tilt, -4deg)); }
.thumb::after { left: 18px; right: 18px; top: 25px; height: 5px; background: rgba(17,24,39,.35); box-shadow: 0 10px 0 rgba(17,24,39,.18); }

.thumb.image-thumb::before,
.thumb.image-thumb::after {
  display: none;
}

.thumb.image-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumb.book { background: linear-gradient(135deg, #121926, #67513f); }
.thumb.doc { background: linear-gradient(135deg, #c7a872, #fff7e6); }
.thumb.box { background: linear-gradient(135deg, #b77835, #e7c892); }
.thumb.folder { background: linear-gradient(135deg, #d6a43e, #f4d98e); }
.thumb.binder { background: linear-gradient(135deg, #23395d, #7c96bd); }
.thumb.album { background: linear-gradient(135deg, #453b33, #c6b9a0); }
.thumb.object { background: linear-gradient(135deg, #354b5c, #a8bdc8); }

.item-title strong { display: block; font-size: 15px; line-height: 1.32; font-weight: 650; }
.item-title small, .meta { color: var(--muted); font-size: 13px; }

.pill, .tag, .status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
}

.pill { background: var(--accent-soft); color: var(--accent); }
.pill.doc { background: #edf8ee; color: #257044; }
.pill.box { background: #fff3e4; color: #9a5b13; }
.pill.folder { background: #fff8d9; color: #8a6412; }
.pill.binder { background: #efe8df; color: #5f4530; }
.pill.album { background: #f0eafd; color: #6346a1; }
.pill.object { background: #eef2f7; color: #344054; }

.tag { background: #f2f4f7; color: #475467; margin: 2px; border-radius: 5px; }
.tag-warm { background: #f6eee3; color: #5f391d; }
.tag-sand { background: #f2ecd8; color: #61563a; }
.tag-cream { background: #fbf2df; color: #6d562f; }
.tag-taupe { background: #f0e8df; color: #655342; }
.tag-gold { background: #fff3cf; color: #805a00; }
.tag-mustard { background: #fff0c4; color: #735100; }
.tag-ochre { background: #ffeed8; color: #844b13; }
.tag-green { background: #eaf7ef; color: #1f7a45; }
.tag-olive { background: #f0f2df; color: #5b6532; }
.tag-moss { background: #edf2e4; color: #465b34; }
.tag-mint { background: #edf8f0; color: #3d7651; }
.tag-sage { background: #f0f4ea; color: #5a684d; }
.tag-teal { background: #e8f4f2; color: #2f716b; }
.tag-cyan { background: #e7f5f6; color: #307578; }
.tag-blue { background: #eef2f7; color: #344054; }
.tag-sky { background: #edf4fb; color: #3f6385; }
.tag-navy { background: #edf1f7; color: #2f3e5d; }
.tag-indigo { background: #efeff8; color: #444274; }
.tag-lavender { background: #f2edf8; color: #5d4b78; }
.tag-violet { background: #f0ebf8; color: #55427a; }
.tag-mauve { background: #f8edf4; color: #7a4d68; }
.tag-rose { background: #fff1ef; color: #9d2f24; }
.tag-burgundy { background: #f9e9ec; color: #76333c; }
.tag-plum { background: #f3eaf1; color: #5f3b58; }
.tag-clay { background: #fff0e8; color: #8a4528; }
.tag-rust { background: #ffede3; color: #7a3617; }
.tag-copper { background: #fff0e4; color: #7d421e; }
.tag-blush { background: #fbebe8; color: #8b5048; }
.tag-slate { background: #edf0f2; color: #48525b; }
.tag-gray { background: #f1efeb; color: #5d5851; }
.tag-charcoal { background: #eceae7; color: #403d39; }
.tag-ivory { background: #faf3e4; color: #6c5d3f; }
.tag-wheat { background: #f7edce; color: #705c22; }
.tag-apricot { background: #fff0e4; color: #8b4e28; }
.tag-terracotta { background: #fbece7; color: #7b3525; }
.tag-forest { background: #e8f0e5; color: #334f2f; }
.tag-sea { background: #e6f2f4; color: #2f6670; }
.tag-denim { background: #e9f0f7; color: #385371; }
.tag-orchid { background: #f4ebf7; color: #714f7e; }
.tag-graphite { background: #ebeced; color: #36393d; }
.status.done { background: var(--green-soft); color: var(--green); }
.status.new { background: var(--accent-soft); color: var(--accent); }
.status.todo { background: var(--amber-soft); color: var(--amber); }

.table-footer {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  color: #475467;
  font-size: 13px;
}

.pager { display: flex; gap: 4px; align-items: center; }
.pager button {
  min-width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
}
.pager button:disabled {
  opacity: .35;
  cursor: default;
}
.pager button.is-active { background: var(--accent-soft); color: var(--accent); }

.detail-hero {
  padding: 18px 18px 0 24px;
}

.detail-back-button {
  min-height: 32px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffaf4;
  color: var(--accent);
  padding: 0 10px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.detail-back-button:hover {
  border-color: #c9aa8e;
  background: #f6eee3;
}

.edit-hero {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-photo {
  height: 220px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2a211c, #9c724b);
  position: relative;
  overflow: hidden;
  margin-top: 16px;
}

.detail-photo .thumb {
  position: absolute;
  width: 230px;
  height: 170px;
  left: 60px;
  top: 26px;
  transform: rotate(-7deg);
  box-shadow: 0 20px 45px rgba(0,0,0,.28);
}

.detail-photo .cover-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-photo button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  border: 0;
  border-radius: 7px;
  background: rgba(255,255,255,.92);
  min-height: 34px;
  padding: 0 12px;
  font-weight: 600;
  max-width: calc(100% - 24px);
}

.detail-body { padding: 16px 16px 16px 24px; }

.detail-body h3 {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 650;
}

.detail-grid + h3 {
  margin-top: 14px;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.detail-heading {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding-right: 4px;
}

.detail-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.qr-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 0;
  opacity: .72;
}

.qr-button:hover {
  background: #f6eee3;
  opacity: 1;
}

.panel-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.panel-close:hover {
  background: #f6eee3;
  color: var(--accent);
}

.qr-button span {
  width: 17px;
  height: 17px;
  display: block;
  background:
    linear-gradient(#5f391d 0 0) 0 0 / 7px 7px no-repeat,
    linear-gradient(#5f391d 0 0) 100% 0 / 7px 7px no-repeat,
    linear-gradient(#5f391d 0 0) 0 100% / 7px 7px no-repeat,
    linear-gradient(#5f391d 0 0) 100% 100% / 4px 4px no-repeat,
    repeating-linear-gradient(90deg, #5f391d 0 2px, transparent 2px 4px) 7px 8px / 10px 3px no-repeat,
    repeating-linear-gradient(0deg, #5f391d 0 2px, transparent 2px 4px) 10px 11px / 3px 7px no-repeat;
}

.item-qr-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 20, 11, .62);
}

.item-qr-card {
  width: min(380px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf4;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(31, 20, 11, .28);
}

.item-qr-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.item-qr-card header span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.item-qr-card header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.item-qr-card header small,
.item-qr-card p {
  color: var(--muted);
  font-size: 13px;
}

.item-qr-code {
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.item-qr-code img {
  width: 240px;
  height: 240px;
  max-width: 100%;
  display: block;
}

.qr-visibility-toggle {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid #e2d2bf;
  border-radius: 999px;
  background: #f7efe6;
}

.qr-visibility-toggle button {
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  padding: 0 9px;
}

.qr-visibility-toggle button.is-active {
  background: #fffaf4;
  color: var(--accent);
  box-shadow: 0 1px 6px rgba(31, 20, 11, .08);
}

.qr-visibility-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.lock-icon span {
  width: 12px;
  height: 10px;
  display: inline-block;
  position: relative;
  border: 1.8px solid currentColor;
  border-radius: 2px;
}

.lock-icon span::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -8px;
  width: 6px;
  height: 7px;
  border: 1.8px solid currentColor;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.lock-icon.is-unlocked span::before {
  left: 6px;
  transform: rotate(22deg);
  transform-origin: left bottom;
}

.item-qr-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.item-qr-link input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
}

html.public-item-mode,
body.public-item-mode {
  height: auto;
  min-height: 100%;
  overflow: auto;
}

body.public-item-mode {
  min-height: 100vh;
  background: #f4efe7;
}

.public-item-page {
  position: relative;
  z-index: 1000;
  min-height: 100dvh;
  display: grid;
  place-items: start center;
  padding: 22px;
}

.public-item-card {
  width: min(680px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf4;
  padding: clamp(18px, 4vw, 30px);
  box-shadow: 0 24px 70px rgba(31, 20, 11, .16);
}

.public-item-header {
  display: grid;
  gap: 8px;
}

.public-eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.public-item-card h1 {
  margin: 0;
  font-size: clamp(26px, 7vw, 42px);
  line-height: 1.08;
}

.public-item-loading {
  min-height: 180px;
  align-content: center;
}

.public-item-meta,
.public-item-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.public-item-meta code {
  border-radius: 6px;
  background: #f0e6da;
  padding: 6px 9px;
  color: #6f5d4f;
  font-weight: 700;
}

.public-item-cover {
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 8px;
  background: #26160d;
  padding: 0;
  overflow: hidden;
}

.public-item-photo {
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  display: block;
}

.public-item-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.public-item-facts div {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.public-item-facts dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.public-item-facts dd {
  margin: 0;
  color: var(--text);
  font-weight: 650;
}

.public-item-description {
  display: grid;
  gap: 6px;
}

.public-item-description h2 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.public-item-description p {
  margin: 0;
  color: #3f342b;
  line-height: 1.55;
}

.public-item-photos {
  display: grid;
  gap: 8px;
}

.public-item-photos h2 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.public-item-photos > div {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

.public-item-photos button {
  aspect-ratio: 1 / 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #20150d;
  padding: 0;
  overflow: hidden;
}

.public-item-photos img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.public-item-related {
  display: grid;
  gap: 8px;
}

.public-item-related h2 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.public-item-related > div {
  display: grid;
  gap: 8px;
}

.public-item-related a,
.public-item-related button,
.public-related-missing {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  padding: 8px 10px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.public-item-related button,
.public-related-missing {
  color: var(--muted);
  background: #f7efe6;
}

.public-item-related span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.public-item-related small {
  color: var(--muted);
  font-size: 12px;
}

.public-notice {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 1400;
  width: min(420px, calc(100vw - 28px));
  transform: translateX(-50%);
  border: 1px solid #d9bea3;
  border-radius: 10px;
  background: #fffaf4;
  color: var(--ink);
  padding: 12px 14px;
  box-shadow: 0 18px 45px rgba(31, 20, 11, .22);
  font-size: 14px;
  font-weight: 650;
}

.public-photo-preview .gallery-preview-card {
  grid-template-rows: auto minmax(0, 1fr);
}

.public-photo-preview {
  z-index: 1600;
}

@media (max-width: 640px) {
  .public-item-page {
    place-items: start stretch;
    padding: 0;
  }

  .public-item-card {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .public-item-facts {
    grid-template-columns: 1fr;
  }

  .public-item-photos > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.detail-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 650;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.soft-meta {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: #f7f0e8;
  color: var(--muted);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
}

.detail-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 11px 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.detail-grid strong { color: #475467; }

.placement-links {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.placement-links em {
  color: var(--muted);
  font-style: normal;
}

.place-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  min-height: 0;
  font: inherit;
  font-weight: 650;
}

.place-link:hover {
  text-decoration: underline;
}

.item-code {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 5px;
  background: #f7f0e8;
  color: var(--accent);
  padding: 2px 7px;
  font-family: inherit;
  font-weight: 650;
}

.edit-form {
  display: block;
}

.edit-form input,
.edit-form select,
.edit-form textarea {
  background: #fffaf4;
}

.detail-title-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  padding: 3px 6px;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 650;
  min-width: 0;
}

.detail-title-input:focus {
  background: #fffaf4;
  border-color: var(--line-strong);
}

.pill-select {
  min-height: 28px;
  width: auto;
  border-radius: 5px;
  padding: 3px 28px 3px 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
}

.edit-grid {
  align-items: start;
}

.edit-grid input,
.edit-grid select,
.edit-grid textarea {
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 7px;
}

.edit-grid textarea {
  min-height: 96px;
}

.edit-field-block {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.edit-field-block > strong {
  color: #344054;
}

.edit-grid > strong:has(+ .location-editor),
.edit-grid > strong:has(+ .tag-picker),
.edit-grid > .location-editor,
.edit-grid > .tag-picker {
  grid-column: 1 / -1;
}

.edit-grid > strong:has(+ .location-editor),
.edit-grid > strong:has(+ .tag-picker) {
  margin-bottom: -4px;
}

.location-editor {
  display: grid;
  gap: 8px;
}

.location-path-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 30px;
}

.location-path-chip {
  min-height: 26px;
  max-width: 150px;
  padding: 0 2px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.location-path-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-path-chip:hover {
  background: #f6eee3;
}

.location-path-separator {
  color: var(--muted);
  font-weight: 700;
}

.location-editor label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.location-active-picker {
  margin-top: 2px;
}

.location-active-picker span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.edit-grid .location-editor select,
.edit-grid .tag-picker summary {
  min-height: 32px;
  height: 32px;
  border-radius: 7px;
  padding: 4px 34px 4px 10px;
  background-color: #fffaf4;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.edit-grid .tag-picker summary {
  position: relative;
  padding-right: 34px;
}

.edit-grid .location-editor select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
}

.location-active-picker {
  position: relative;
}

.location-active-picker::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 12px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
}

.input-with-action button {
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: white;
  color: var(--accent);
  font-weight: 700;
}

.tag-picker {
  position: relative;
}

.tag-picker summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fffaf4;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  list-style: none;
}

.tag-picker summary::-webkit-details-marker {
  display: none;
}

.tag-picker summary::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  margin: 0;
}

.tag-picker[open] summary::after {
  transform: translateY(-35%) rotate(225deg);
}

.tag-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 176px;
  overflow: auto;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.tag-check {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fffaf4;
  color: #475467;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.tag-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tag-check.is-checked,
.tag-check:has(input:checked) {
  background: #f2e6d8;
  border-color: #d6b996;
  color: var(--accent);
}

.tag-check.is-checked[class*="tag-"],
.tag-check:has(input:checked)[class*="tag-"] {
  border-color: currentColor;
}

.rating-stars {
  display: inline-flex;
  gap: 2px;
  color: #c8b7a6;
  font-size: 16px;
  letter-spacing: 0;
}

.rating-stars .is-filled {
  color: #b7791f;
}

.rating-editor {
  display: inline-flex;
  align-items: center;
}

.rating-picker {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0 4px;
  color: #c8b7a6;
  font-size: 23px;
}

.rating-picker span {
  line-height: 1;
}

.rating-picker .is-filled {
  color: #b7791f;
}

.edit-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  font-size: 13px;
}

.mini-link {
  min-height: 28px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: #344054;
  font-weight: 600;
}

.contains-box {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.contains-box summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}

.contains-box summary::-webkit-details-marker {
  display: none;
}

.contains-box summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-top: -4px;
}

.contains-box[open] summary::after {
  transform: rotate(225deg);
  margin-top: 4px;
}

.contains-box small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.child-list {
  display: grid;
  gap: 8px;
}

.child-list button {
  min-height: 64px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  padding: 8px;
  text-align: left;
}

.child-list .thumb {
  width: 54px;
  height: 44px;
  box-shadow: none;
}

.child-list strong,
.child-list small {
  display: block;
}

.child-list small {
  color: var(--muted);
  margin-top: 3px;
}

.empty-child {
  min-height: 42px;
  border: 1px dashed #bdc5d1;
  border-radius: 8px;
  background: #fbfcff;
  color: #475467;
  font-weight: 600;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: start;
  padding: 8px 0 12px;
}

.attachment-tile {
  width: 92px;
  display: grid;
  gap: 5px;
  color: inherit;
  text-decoration: none;
  position: relative;
}

.attachment-tile img,
.attachment-tile .file-icon {
  width: 92px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fffaf4;
  object-fit: cover;
}

.attachment-tile .file-icon {
  display: grid;
  place-items: center;
  position: relative;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.attachment-tile .file-icon::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 41px;
  height: 4px;
  background: rgba(17,24,39,.32);
  box-shadow: 0 8px 0 rgba(17,24,39,.18);
}

.attachment-tile:hover strong {
  color: var(--accent);
  text-decoration: underline;
}

.attachment-tile strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.attachment-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(180, 35, 24, .18);
  border-radius: 6px;
  background: rgba(255, 255, 255, .94);
  color: #9b2c23;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.attachment-remove:hover {
  border-color: rgba(180, 35, 24, .36);
  background: #fff1ef;
  color: #7f1d1d;
}

.upload-tile {
  width: 92px;
  min-height: 84px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fffaf4;
  color: var(--accent);
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
}

.upload-tile input {
  display: none;
}

.upload-tile span {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255,255,255,.58);
  border: 1px solid var(--line);
  font-size: 24px;
  line-height: 1;
}

.upload-tile strong {
  font-size: 11px;
  line-height: 1.2;
  max-width: 80px;
  overflow-wrap: anywhere;
}

.upload-tile small {
  display: none;
  color: var(--muted);
  font-size: 10px;
}

.upload-tile:hover,
.upload-tile.is-dragging {
  border-color: #b9895d;
  background: #f6eee3;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(38, 31, 24, .38);
}

.gallery-card {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow);
}

.gallery-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.gallery-head strong,
.gallery-head span {
  display: block;
}

.gallery-head span {
  color: var(--muted);
  font-size: 12px;
}

.gallery-files {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  padding: 16px;
}

.recent-photo-picker {
  grid-column: 1 / -1;
  order: 20;
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.recent-photo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-photo-head span,
.recent-photo-head strong,
.recent-photo-head small {
  display: block;
}

.recent-photo-head strong {
  font-size: 15px;
}

.recent-photo-head small {
  color: var(--muted);
  font-size: 12px;
}

.compact-button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 13px;
}

.recent-photo-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
}

.recent-photo-card {
  position: relative;
  flex: 0 0 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  padding: 4px;
  display: block;
  cursor: grab;
}

.recent-photo-card img,
.recent-photo-card .file-icon {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
  background: #f7f0e8;
}

.recent-photo-card strong,
.recent-photo-card small {
  display: none;
}

.recent-photo-card em {
  position: absolute;
  left: 8px;
  bottom: 8px;
  border-radius: 999px;
  background: rgba(31, 20, 11, .72);
  color: #fffaf4;
  padding: 3px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.recent-photo-card.is-dragging {
  opacity: .45;
  cursor: grabbing;
}

.recent-photo-add {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 24px;
  height: 24px;
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 250, 244, .94);
  color: var(--accent);
  padding: 0;
  overflow: hidden;
  text-indent: -999px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(31, 20, 11, .18);
}

.recent-photo-add::before {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-indent: 0;
  font-size: 18px;
  line-height: 1;
}

.recent-photo-add:disabled {
  color: var(--muted);
  background: #f2eee8;
}

.gallery-files.is-drop-target {
  outline: 2px dashed #9f703e;
  outline-offset: -6px;
  background: #fff8ee;
}

.gallery-file,
.gallery-upload {
  min-height: 126px;
  display: grid;
  align-content: start;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  position: relative;
}

.gallery-file img,
.gallery-file .file-icon,
.gallery-upload {
  width: 100%;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
}

.gallery-file img {
  object-fit: cover;
}

.photo-preview-button {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
  cursor: zoom-in;
}

.photo-preview-button img {
  display: block;
}

.gallery-file .file-icon {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 700;
}

.gallery-file strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.photo-file.is-cover img {
  outline: 3px solid rgba(123, 78, 42, .28);
  outline-offset: -3px;
}

.cover-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.cover-button:hover {
  background: #f6eee3;
}

.detach-photo-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffaf4;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 650;
}

.detach-photo-button:hover {
  background: #f6eee3;
  color: var(--accent);
}

.gallery-upload {
  min-height: 126px;
  height: auto;
  place-items: center;
  align-content: center;
  border-style: dashed;
  color: var(--accent);
  text-align: center;
  cursor: pointer;
  padding: 12px;
}

.gallery-upload input {
  display: none;
}

.gallery-upload span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  font-size: 22px;
}

.gallery-upload small {
  color: var(--muted);
}

.photo-gallery-modal .gallery-card {
  width: min(920px, calc(100vw - 48px));
  border-radius: 12px;
}

.photo-gallery-modal .gallery-head {
  min-height: 56px;
  padding: 13px 18px;
}

.photo-gallery-modal .gallery-head strong {
  font-size: 18px;
  letter-spacing: 0;
}

.photo-gallery-modal .gallery-head .panel-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
}

.photo-gallery-modal .gallery-files {
  grid-template-columns: repeat(auto-fill, minmax(118px, 148px));
  align-items: start;
  gap: 14px;
  padding: 18px;
}

.photo-gallery-modal .photo-file {
  min-height: 0;
  gap: 7px;
  padding: 0;
}

.photo-gallery-modal .photo-file[draggable="true"] {
  cursor: grab;
}

.photo-gallery-modal .photo-file.is-dragging {
  opacity: .45;
}

.photo-gallery-modal .photo-file.is-drop-before::before,
.photo-gallery-modal .photo-file.is-drop-after::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 28px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(132, 83, 43, .14);
  z-index: 4;
}

.photo-gallery-modal .photo-file.is-drop-before::before {
  left: -7px;
}

.photo-gallery-modal .photo-file.is-drop-after::before {
  right: -7px;
}

.photo-gallery-modal .photo-preview-button {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

.photo-gallery-modal .photo-drag-surface {
  cursor: grab;
}

.photo-gallery-modal .photo-file.is-dragging .photo-drag-surface {
  cursor: grabbing;
}

.photo-gallery-modal .photo-preview-button img,
.photo-gallery-modal .photo-file > .file-icon {
  height: 108px;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(31, 20, 11, .1);
}

.photo-gallery-modal .photo-file strong {
  max-width: 100%;
  padding-inline: 2px;
  color: #6f6258;
  font-size: 12px;
  font-weight: 700;
}

.photo-gallery-modal .attachment-remove,
.photo-gallery-modal .cover-button,
.photo-gallery-modal .detach-photo-button,
.photo-gallery-modal .recent-photo-add {
  display: block;
  width: 23px;
  min-width: 23px;
  height: 23px;
  min-height: 23px;
  padding: 0;
  border-radius: 999px;
  font-size: 0;
  line-height: 1;
  position: relative;
  box-shadow: 0 8px 18px rgba(31, 20, 11, .18);
}

.photo-gallery-modal .attachment-remove::before,
.photo-gallery-modal .cover-button::before,
.photo-gallery-modal .detach-photo-button::before {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  line-height: 1;
  font-size: 16px;
  transform: translate(-50%, -50%);
}

.photo-gallery-modal .attachment-remove::before {
  content: "×";
}

.photo-gallery-modal .cover-button::before {
  content: "★";
  font-size: 17px;
}

.photo-gallery-modal .detach-photo-button::before {
  content: "−";
  font-size: 18px;
  transform: translateY(-1px);
}

.photo-gallery-modal .attachment-remove {
  top: 8px;
  right: 8px;
  border-color: rgba(127, 29, 29, .18);
}

.photo-gallery-modal .cover-button,
.photo-gallery-modal .detach-photo-button {
  position: absolute;
  top: 8px;
  border: 1px solid rgba(255, 250, 244, .84);
  background: rgba(255, 250, 244, .94);
  overflow: hidden;
  text-indent: 0;
}

.photo-gallery-modal .cover-button {
  left: 8px;
  color: #8a5a24;
}

.photo-gallery-modal .detach-photo-button {
  left: 39px;
  color: #7a6e64;
}

.photo-gallery-modal .attachment-remove::before {
  content: "";
  width: 9px;
  height: 9px;
  background:
    linear-gradient(45deg, transparent 42%, currentColor 42% 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, currentColor 42% 58%, transparent 58%);
}

.photo-gallery-modal .cover-button::before {
  font-size: 14px;
  transform: translate(-50%, -53%);
}

.photo-gallery-modal .detach-photo-button::before {
  content: "";
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.photo-gallery-modal .attachment-remove {
  top: 9px;
  right: 9px;
}

.photo-gallery-modal .cover-button,
.photo-gallery-modal .detach-photo-button {
  top: 9px;
}

.photo-gallery-modal .cover-button {
  left: 9px;
}

.photo-gallery-modal .detach-photo-button {
  left: 36px;
}

.photo-gallery-modal .attachment-remove,
.photo-gallery-modal .cover-button,
.photo-gallery-modal .detach-photo-button {
  position: absolute;
  z-index: 5;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  top: 8px;
  display: block;
}

.photo-gallery-modal .cover-button {
  left: 8px;
}

.photo-gallery-modal .detach-photo-button {
  left: 34px;
}

.photo-gallery-modal .attachment-remove {
  right: 8px;
}

.photo-gallery-modal .attachment-remove::before,
.photo-gallery-modal .cover-button::before,
.photo-gallery-modal .detach-photo-button::before {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.photo-gallery-modal .attachment-remove::before {
  width: 8px;
  height: 8px;
}

.photo-gallery-modal .cover-button::before {
  font-size: 13px;
  transform: translate(-50%, -54%);
}

.photo-gallery-modal .detach-photo-button::before {
  width: 9px;
  height: 2px;
}

.photo-gallery-modal .photo-file.is-cover .cover-button {
  background: #7b4e2a;
  color: #fffaf4;
}

.photo-gallery-modal .photo-file.is-cover::after {
  content: "Náhled";
  position: absolute;
  left: 8px;
  bottom: 31px;
  border-radius: 999px;
  background: rgba(123, 78, 42, .92);
  color: #fffaf4;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  pointer-events: none;
}

.photo-gallery-modal .gallery-upload {
  min-height: 144px;
  height: 144px;
  gap: 7px;
  border-radius: 10px;
  background: #fffaf4;
}

.photo-gallery-modal .gallery-upload span {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
}

.photo-gallery-modal .gallery-upload strong {
  color: var(--accent);
  font-size: 14px;
}

.photo-gallery-modal .gallery-upload small {
  max-width: 120px;
  font-size: 12px;
  line-height: 1.35;
}

.photo-gallery-modal .recent-photo-picker {
  order: 20;
  margin-top: 10px;
  padding-top: 16px;
}

.photo-gallery-modal .recent-photo-card {
  flex-basis: 74px;
  border-radius: 10px;
  padding: 5px;
}

.photo-gallery-modal .recent-photo-card img,
.photo-gallery-modal .recent-photo-card .file-icon {
  border-radius: 8px;
}

.photo-gallery-modal .recent-photo-add {
  right: 6px;
  top: 6px;
  width: 28px;
  height: 28px;
  min-height: 28px;
  font-size: 0;
  text-indent: 0;
}

.photo-gallery-modal .recent-photo-add::before {
  font-size: 20px;
  transform: translateY(-1px);
}

.attachment-add {
  width: 76px;
  height: 58px;
  border: 1px dashed #c8cfda;
  border-radius: 8px;
  background: #fbfcff;
  color: #667085;
}

.link-groups {
  display: grid;
  gap: 0;
  padding: 0 0 12px;
  border: 0;
}

.link-group {
  padding: 0;
}

.link-group + .link-group {
  border-top: 0;
}

.link-group summary {
  height: 38px;
  cursor: pointer;
  color: #5f4530;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border-top: 1px solid var(--line);
  line-height: 38px;
}

.link-group:last-child summary {
  border-bottom: 1px solid var(--line);
}

.link-group[open] summary {
  border-bottom: 1px solid var(--line);
}

.link-group[open]:last-child summary {
  border-bottom: 1px solid var(--line);
}

.link-group summary::-webkit-details-marker {
  display: none;
}

.link-group summary::after {
  content: "";
  width: 8px;
  height: 8px;
  display: block;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  flex: 0 0 auto;
  margin-top: -4px;
}

.link-group[open] summary::after {
  transform: rotate(225deg);
  margin-top: 4px;
}

.link-group a,
.link-group button {
  width: 100%;
  min-height: 24px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 0 8px;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
}

.link-group .muted-line,
.link-group .missing-link,
.relation-editor {
  padding-top: 0;
}

.link-content {
  display: grid;
  gap: 2px;
  padding: 8px 0 9px;
  border-bottom: 1px solid var(--line);
}

.link-group:last-child .link-content {
  border-bottom: 1px solid var(--line);
}

.link-group button span,
.link-group button small {
  display: block;
}

.link-group button small {
  color: var(--muted);
  margin-top: 2px;
}

.muted-line,
.missing-link {
  display: block;
  color: var(--muted);
  padding-top: 0;
  font-size: 13px;
}

.missing-link {
  color: var(--red);
}

.relation-editor {
  display: grid;
  gap: 6px;
  padding: 8px 0 9px;
  border-bottom: 1px solid var(--line);
}

.relation-editor small {
  color: var(--muted);
  font-size: 12px;
}

.resolved-links {
  display: grid;
  gap: 0;
}

.link-group a:hover,
.link-group button:hover {
  color: var(--accent);
  text-decoration: underline;
}

.link-group summary::after {
  content: "";
  width: 7px;
  height: 7px;
  display: block;
  flex: 0 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-1px) rotate(45deg);
  margin-right: 3px;
  margin-top: 0;
}

.link-group[open] summary::after {
  transform: translateY(2px) rotate(225deg);
  margin-top: 0;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 0 0;
  border-top: 0;
}

.detail-footnote {
  display: block;
  margin-top: 10px;
  padding: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.page-panel {
  border-radius: 10px;
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-title p { margin-bottom: 0; }

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gallery-shell {
  display: block;
  padding-top: 16px;
}

.gallery-breadcrumbs {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffaf4;
  color: var(--muted);
  overflow-x: auto;
}

.breadcrumb-part {
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--accent);
  padding: 0 8px;
  font-weight: 650;
  white-space: nowrap;
}

.breadcrumb-part:hover,
.breadcrumb-part.is-current {
  background: white;
  color: var(--accent-strong);
}

.gallery-content {
  min-width: 0;
}

.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffaf4;
}

.segmented[hidden] {
  display: none;
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 650;
}

.segmented button.is-active {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(72, 50, 28, .10);
}

.segmented.compact button {
  min-width: 74px;
}

.incoming-grid {
  display: grid;
  gap: 18px;
}

.gallery-context {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent-strong);
  padding: 16px 18px;
  box-shadow: 0 12px 28px rgba(72, 50, 28, .12);
}

.gallery-context small,
.gallery-context strong,
.gallery-context em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-context small {
  color: rgba(255, 250, 244, .72);
  font-size: 11px;
  font-weight: 650;
}

.gallery-context strong {
  color: #fffaf4;
  font-size: 15px;
  line-height: 1.2;
}

.gallery-context em {
  color: rgba(255, 250, 244, .78);
  font-size: 12px;
  font-style: normal;
  margin-top: 2px;
}

.gallery-context .location-icon {
  width: 52px;
  height: 52px;
  background: #f4dfbd;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 244, .18), 0 8px 18px rgba(31, 20, 11, .12);
}

.gallery-section {
  display: grid;
  gap: 10px;
}

.gallery-section + .gallery-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.gallery-section:has(.gallery-folder-grid .empty-gallery) {
  display: none;
}

.gallery-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gallery-section-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.gallery-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.gallery-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.gallery-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 160px));
  gap: 12px;
}

.incoming-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 8px;
  background: #fffaf4;
}

.gallery-tile {
  position: relative;
  padding: 6px;
  gap: 6px;
}

.gallery-tile.is-selected {
  border-color: #9f703e;
  box-shadow: 0 0 0 2px rgba(159, 112, 62, .12);
}

.gallery-tile[draggable="true"] {
  cursor: grab;
}

.gallery-tile.is-dragging {
  opacity: .28;
  transform: scale(.96);
  cursor: grabbing;
}

body.is-gallery-dragging .gallery-tile:not(.is-dragging) {
  transition: opacity 120ms ease, filter 120ms ease;
}

body.is-gallery-dragging .gallery-section {
  scroll-margin-top: 110px;
}

.gallery-drag-preview {
  position: fixed;
  left: -9999px;
  top: -9999px;
  z-index: 9999;
  width: 146px;
  padding: 8px;
  border: 1px solid rgba(244, 223, 189, .92);
  border-radius: 10px;
  background: rgba(255, 250, 244, .96);
  box-shadow: 0 22px 52px rgba(31, 20, 11, .28);
  pointer-events: none;
}

.gallery-drag-preview .thumb {
  width: 130px;
  height: 96px;
  border-radius: 7px;
}

.gallery-drag-preview strong {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-size: 12px;
}

.gallery-tile .media-open {
  display: grid;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 0;
}

.gallery-tile .thumb,
.gallery-tile .image-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
}

.gallery-tile .media-card-body {
  display: none;
}

.gallery-tile .media-card-body strong {
  font-size: 12px;
}

.gallery-tile .media-card-body small,
.gallery-tile .media-card-body em {
  font-size: 11px;
}

.gallery-tile .gallery-card-actions {
  display: none;
}

.gallery-info-button {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 250, 244, .78);
  border-radius: 999px;
  background: rgba(99, 57, 26, .88);
  color: #fffaf4;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(31, 20, 11, .22);
}

.gallery-info-button:hover {
  background: var(--accent-strong);
}

.gallery-menu-button {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 250, 244, .78);
  border-radius: 999px;
  background: rgba(255, 250, 244, .92);
  color: var(--accent);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(31, 20, 11, .14);
}

.gallery-menu-button:hover {
  background: #fff;
  color: var(--accent-strong);
}

.gallery-context-menu {
  position: fixed;
  z-index: 80;
  width: 196px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fffaf4;
  box-shadow: 0 18px 48px rgba(31, 20, 11, .2);
}

.gallery-context-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}

.gallery-context-menu button:hover {
  background: #f2e6d8;
  color: var(--accent);
}

.gallery-context-menu button.is-danger {
  color: #9b2c2c;
}

.gallery-context-menu button.is-danger:hover {
  background: #fee2e2;
}

.drive-card {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  overflow: hidden;
  box-shadow: none;
}

.folder-open {
  min-width: 0;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px 12px 18px;
  color: inherit;
  text-align: left;
}

.folder-open .location-icon {
  width: 38px;
  height: 34px;
}

.folder-open .location-icon svg {
  width: 26px;
  height: 26px;
}

.folder-icon {
  width: 38px;
  height: 28px;
  border-radius: 5px;
  background: #b98752;
  box-shadow: none;
  position: relative;
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: -5px;
  width: 17px;
  height: 9px;
  border-radius: 4px 4px 0 0;
  background: #9f703e;
}

.folder-open strong,
.folder-open small {
  display: block;
}

.folder-open strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 650;
}

.folder-open small {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.folder-delete {
  width: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  letter-spacing: 1px;
}

.folder-delete:hover {
  color: var(--accent);
  background: #f6eee3;
}

.gallery-card-actions {
  display: grid;
  gap: 6px;
}

.gallery-card-actions select {
  min-height: 30px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 4px 8px;
  font-size: 13px;
}

.incoming-card:hover,
.drive-card:hover {
  border-color: #c9aa8e;
  box-shadow: 0 10px 24px rgba(72, 50, 28, .08);
}

.folder-card.is-drop-target {
  border-color: #9f703e;
  background: #f5e4cf;
  box-shadow: inset 0 0 0 2px rgba(159, 112, 62, .24), 0 14px 28px rgba(99, 57, 26, .12);
  transform: translateY(-1px);
}

.gallery-context.is-drop-target {
  outline: 3px solid rgba(244, 223, 189, .88);
  outline-offset: 3px;
  box-shadow: 0 16px 32px rgba(99, 57, 26, .2);
}

.gallery-breadcrumbs .breadcrumb-part.is-drop-target {
  background: #f5e4cf;
  color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(159, 112, 62, .24);
}

.gallery-breadcrumbs.is-drop-target {
  border-color: #9f703e;
  background: #f5e4cf;
  box-shadow: inset 0 0 0 2px rgba(159, 112, 62, .2);
}

body.is-gallery-dragging [data-gallery-drop-folder],
body.is-gallery-dragging .gallery-breadcrumbs .breadcrumb-part {
  transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease, outline-color 120ms ease;
}

.browse-breadcrumbs {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 14px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  color: var(--muted);
}

.browse-breadcrumbs button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  padding: 0 8px;
  font-weight: 650;
}

.browse-breadcrumbs button:hover,
.browse-breadcrumbs button.is-current {
  background: white;
  color: var(--accent-strong);
}

.browse-grid {
  display: grid;
  gap: 14px;
}

.browse-context {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent-strong);
  padding: 9px 11px;
  box-shadow: 0 12px 28px rgba(72, 50, 28, .12);
}

.browse-context small,
.browse-context strong,
.browse-context em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-context small {
  color: rgba(255, 250, 244, .72);
  font-size: 11px;
  font-weight: 650;
}

.browse-context strong {
  color: #fffaf4;
  font-size: 15px;
  line-height: 1.2;
}

.browse-context em {
  color: rgba(255, 250, 244, .78);
  font-size: 12px;
  font-style: normal;
  margin-top: 2px;
}

.browse-context .location-icon {
  background: #f4dfbd;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 244, .18), 0 8px 18px rgba(31, 20, 11, .12);
}

.browse-section {
  display: grid;
  gap: 10px;
}

.browse-section:first-child {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.browse-context + .browse-section {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.browse-items-section {
  padding-top: 2px;
}

.browse-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.browse-section-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.browse-section-head > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.browse-title-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.browse-title-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.browse-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.browse-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  overflow: hidden;
}

.browse-card button {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 7px 9px;
  text-align: left;
  color: var(--text);
}

.browse-card:hover {
  border-color: #c9aa8e;
  box-shadow: 0 10px 24px rgba(72, 50, 28, .08);
}

.browse-card strong,
.browse-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-card strong {
  font-size: 13px;
  font-weight: 650;
}

.browse-card small {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.browse-tools {
  align-items: center;
}

.browse-controls {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  margin-left: auto;
}

.browse-items-section .browse-controls {
  display: none;
}

.browse-controls input,
.browse-controls select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf4;
  padding: 4px 8px;
  font-size: 13px;
}

.browse-controls input {
  width: 180px;
}

.browse-controls select {
  width: 126px;
}

.browse-item-list {
  display: grid;
  gap: 6px;
}

.browse-item-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.browse-item-row button {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 110px 74px;
  gap: 10px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 6px 10px;
  color: var(--text);
  text-align: left;
}

.browse-item-row:hover {
  border-color: #c9aa8e;
  background: #fffaf4;
}

.browse-row-thumb {
  width: 38px;
  height: 34px;
}

.browse-row-title strong,
.browse-row-title small,
.browse-row-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-row-title strong {
  font-size: 13px;
  font-weight: 700;
}

.browse-row-title small,
.browse-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.browse-empty {
  margin: 0;
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.browse-icon {
  width: 48px;
  height: 42px;
  border-radius: 7px;
  display: block;
  position: relative;
  background: #efe2d2;
  box-shadow: inset 0 0 0 1px rgba(95, 57, 29, .12);
}

.browse-folder-card .browse-icon {
  width: 34px;
  height: 30px;
}

.browse-folder-card .browse-icon.place::before {
  left: 11px;
  top: 6px;
  width: 12px;
  height: 12px;
}

.browse-folder-card .browse-icon.storage::before {
  inset: 8px 7px;
  border-left-width: 5px;
}

.browse-folder-card .browse-icon.container::before {
  left: 6px;
  right: 6px;
  top: 10px;
  height: 11px;
}

.browse-icon.place::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  background: var(--accent);
  transform: rotate(-45deg);
}

.browse-icon.storage::before {
  content: "";
  position: absolute;
  inset: 11px 9px;
  border: 2px solid var(--accent);
  border-left-width: 7px;
  border-radius: 3px;
}

.browse-icon.container {
  background: #f4dfbd;
}

.browse-icon.container::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 14px;
  height: 14px;
  border: 2px solid #9f703e;
  border-radius: 3px;
}

.location-icon {
  background: #f4dfbd;
}

.location-icon.icon-svg {
  display: grid;
  place-items: center;
  color: #9f703e;
}

.location-icon.icon-svg::before,
.location-icon.icon-svg::after {
  display: none;
}

.location-icon.icon-svg svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.browse-context .location-icon.icon-svg svg {
  width: 25px;
  height: 25px;
}

.location-icon::before,
.location-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}

.browse-context .location-icon {
  width: 36px;
  height: 32px;
}

.location-icon::before {
  left: 8px;
  right: 8px;
  top: 10px;
  height: 12px;
  border: 2px solid #9f703e;
  border-radius: 3px;
}

.icon-archive::before,
.icon-unknown::before {
  top: 8px;
  height: 15px;
  border-radius: 4px;
}

.icon-garage::before {
  left: 7px;
  right: 7px;
  top: 9px;
  height: 14px;
  border-radius: 6px 6px 3px 3px;
  border-top-width: 4px;
}

.icon-shelf::before,
.icon-library::before {
  left: 7px;
  right: 7px;
  top: 8px;
  height: 16px;
  border-left-width: 5px;
  box-shadow: inset 0 -5px 0 rgba(159, 112, 62, .18);
}

.icon-box::before,
.icon-crate::before,
.icon-safe::before {
  top: 9px;
  height: 14px;
}

.icon-box::after,
.icon-crate::after {
  left: 13px;
  right: 13px;
  top: 9px;
  border-top: 2px solid #9f703e;
}

.icon-binder::before,
.icon-folder::before,
.icon-cabinet::before {
  left: 7px;
  right: 7px;
  top: 8px;
  height: 16px;
  border-left-width: 6px;
}

.icon-folder::after {
  left: 9px;
  top: 6px;
  width: 10px;
  height: 5px;
  border: 2px solid #9f703e;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.icon-envelope::before,
.icon-letter::before,
.icon-postcard::before {
  top: 8px;
  height: 15px;
}

.icon-envelope::after,
.icon-letter::after,
.icon-postcard::after {
  left: 9px;
  right: 9px;
  top: 10px;
  height: 10px;
  border-left: 2px solid #9f703e;
  border-bottom: 2px solid #9f703e;
  transform: rotate(-45deg);
}

.icon-drawer::before {
  top: 8px;
  height: 16px;
  box-shadow: inset 0 -6px 0 rgba(159, 112, 62, .16);
}

.icon-drawer::after {
  left: 15px;
  top: 17px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #9f703e;
}

.icon-bag::before,
.icon-suitcase::before {
  left: 8px;
  right: 8px;
  top: 12px;
  height: 12px;
}

.icon-bag::after,
.icon-suitcase::after {
  left: 12px;
  right: 12px;
  top: 7px;
  height: 8px;
  border: 2px solid #9f703e;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.icon-album::before,
.icon-book::before,
.icon-document::before,
.icon-contract::before,
.icon-certificate::before,
.icon-newspaper::before,
.icon-map::before {
  left: 10px;
  right: 10px;
  top: 6px;
  height: 18px;
  border-radius: 3px;
}

.icon-book::after,
.icon-album::after,
.icon-document::after {
  left: 14px;
  top: 8px;
  bottom: 8px;
  border-left: 2px solid #9f703e;
}

.icon-photo::before,
.icon-painting::before,
.icon-slide::before,
.icon-negative::before {
  top: 8px;
  height: 15px;
}

.icon-photo::after,
.icon-painting::after,
.icon-slide::after {
  left: 14px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9f703e;
}

.icon-camera::before {
  left: 8px;
  right: 8px;
  top: 11px;
  height: 12px;
}

.icon-camera::after {
  left: 14px;
  top: 13px;
  width: 7px;
  height: 7px;
  border: 2px solid #9f703e;
  border-radius: 50%;
}

.icon-film::before,
.icon-audio::before,
.icon-disk::before,
.icon-usb::before,
.icon-device::before {
  left: 9px;
  right: 9px;
  top: 7px;
  height: 18px;
  border-radius: 4px;
}

.icon-film::after,
.icon-audio::after,
.icon-disk::after,
.icon-device::after {
  left: 15px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9f703e;
  box-shadow: 0 8px 0 #9f703e;
}

.icon-key::before {
  left: 9px;
  top: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.icon-key::after {
  left: 18px;
  top: 14px;
  width: 11px;
  border-top: 3px solid #9f703e;
  box-shadow: 5px 4px 0 -1px #9f703e;
}

.icon-clock::before {
  left: 10px;
  top: 7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.icon-clock::after {
  left: 18px;
  top: 11px;
  width: 5px;
  height: 7px;
  border-left: 2px solid #9f703e;
  border-bottom: 2px solid #9f703e;
}

.icon-medal::before,
.icon-coin::before,
.icon-stamp::before,
.icon-star::before,
.icon-jewelry::before {
  left: 10px;
  top: 7px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.icon-star::after,
.icon-medal::after {
  left: 15px;
  top: 12px;
  width: 6px;
  height: 6px;
  background: #9f703e;
  transform: rotate(45deg);
}

.icon-tool::before,
.icon-workshop::before {
  left: 16px;
  top: 6px;
  width: 5px;
  height: 20px;
  border-radius: 3px;
  transform: rotate(38deg);
}

.icon-house::before,
.icon-room::before,
.icon-attic::before,
.icon-basement::before,
.icon-kitchen::before {
  left: 9px;
  right: 9px;
  top: 12px;
  height: 12px;
}

.icon-house::after,
.icon-room::after,
.icon-attic::after,
.icon-basement::after,
.icon-kitchen::after {
  left: 10px;
  top: 7px;
  width: 15px;
  height: 15px;
  border-left: 2px solid #9f703e;
  border-top: 2px solid #9f703e;
  transform: rotate(45deg);
}

.icon-tube::before,
.icon-textile::before,
.icon-glass::before,
.icon-toy::before,
.icon-label::before {
  left: 10px;
  right: 10px;
  top: 7px;
  height: 17px;
  border-radius: 10px;
}

.media-open {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}

.incoming-card .thumb {
  width: 100%;
  height: 136px;
  box-shadow: none;
}

.media-card-body {
  display: grid;
  gap: 3px;
  padding: 9px 2px 2px;
}

.media-card-body strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
}

.media-card-body small,
.media-card-body em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.media-card-body em {
  color: var(--accent);
}

.empty-gallery {
  margin: 0;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  background: #fffaf4;
  color: var(--muted);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.location-levels {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.management-sections {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.management-section {
  border: 1px solid #7a4a28;
  border-radius: 8px;
  background: #fffaf4;
  overflow: hidden;
}

.management-section > summary {
  min-height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-weight: 650;
  background: #5f391d;
  color: #fffaf4;
}

.management-section > summary::-webkit-details-marker {
  display: none;
}

.management-section > summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid #f7eadb;
  border-bottom: 2px solid #f7eadb;
  transform: rotate(45deg);
  margin-top: -4px;
}

.management-section[open] > summary {
  border-bottom: 1px solid #7a4a28;
}

.management-section[open] > summary::after {
  transform: rotate(225deg);
  margin-top: 4px;
}

.management-section .location-levels,
.management-section .tag-manager,
.tag-manager-head {
  padding: 10px;
}

.location-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  display: grid;
  gap: 9px;
  position: relative;
}

.location-band.is-child-level::before {
  content: "";
  position: absolute;
  left: var(--connector-x, 28px);
  top: calc(var(--connector-height, 20px) * -1);
  width: 0;
  height: var(--connector-height, 20px);
  border-left: 2px solid #d8c6b3;
  pointer-events: none;
}

.location-band.is-child-level::after {
  content: "";
  position: absolute;
  left: calc(var(--connector-x, 28px) - 4px);
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8c6b3;
  pointer-events: none;
}

.level-parent {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-right: auto;
}

.tag-manager-head {
  padding-bottom: 0;
}

.tag-manager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.managed-tag {
  display: inline-flex;
}

.managed-tag button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 12px;
  background: white;
  color: var(--text);
}

.managed-tag button small {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 700;
}

.managed-tag button:hover {
  background: #f6eee3;
}

.managed-tag.tag-warm button { background: #f6eee3; color: #5f391d; }
.managed-tag.tag-sand button { background: #f2ecd8; color: #61563a; }
.managed-tag.tag-cream button { background: #fbf2df; color: #6d562f; }
.managed-tag.tag-taupe button { background: #f0e8df; color: #655342; }
.managed-tag.tag-gold button { background: #fff3cf; color: #805a00; }
.managed-tag.tag-mustard button { background: #fff0c4; color: #735100; }
.managed-tag.tag-ochre button { background: #ffeed8; color: #844b13; }
.managed-tag.tag-green button { background: #eaf7ef; color: #1f7a45; }
.managed-tag.tag-olive button { background: #f0f2df; color: #5b6532; }
.managed-tag.tag-moss button { background: #edf2e4; color: #465b34; }
.managed-tag.tag-mint button { background: #edf8f0; color: #3d7651; }
.managed-tag.tag-sage button { background: #f0f4ea; color: #5a684d; }
.managed-tag.tag-teal button { background: #e8f4f2; color: #2f716b; }
.managed-tag.tag-cyan button { background: #e7f5f6; color: #307578; }
.managed-tag.tag-blue button { background: #eef2f7; color: #344054; }
.managed-tag.tag-sky button { background: #edf4fb; color: #3f6385; }
.managed-tag.tag-navy button { background: #edf1f7; color: #2f3e5d; }
.managed-tag.tag-indigo button { background: #efeff8; color: #444274; }
.managed-tag.tag-lavender button { background: #f2edf8; color: #5d4b78; }
.managed-tag.tag-violet button { background: #f0ebf8; color: #55427a; }
.managed-tag.tag-mauve button { background: #f8edf4; color: #7a4d68; }
.managed-tag.tag-rose button { background: #fff1ef; color: #9d2f24; }
.managed-tag.tag-burgundy button { background: #f9e9ec; color: #76333c; }
.managed-tag.tag-plum button { background: #f3eaf1; color: #5f3b58; }
.managed-tag.tag-clay button { background: #fff0e8; color: #8a4528; }
.managed-tag.tag-rust button { background: #ffede3; color: #7a3617; }
.managed-tag.tag-copper button { background: #fff0e4; color: #7d421e; }
.managed-tag.tag-blush button { background: #fbebe8; color: #8b5048; }
.managed-tag.tag-slate button { background: #edf0f2; color: #48525b; }
.managed-tag.tag-gray button { background: #f1efeb; color: #5d5851; }
.managed-tag.tag-charcoal button { background: #eceae7; color: #403d39; }
.managed-tag.tag-ivory button { background: #faf3e4; color: #6c5d3f; }
.managed-tag.tag-wheat button { background: #f7edce; color: #705c22; }
.managed-tag.tag-apricot button { background: #fff0e4; color: #8b4e28; }
.managed-tag.tag-terracotta button { background: #fbece7; color: #7b3525; }
.managed-tag.tag-forest button { background: #e8f0e5; color: #334f2f; }
.managed-tag.tag-sea button { background: #e6f2f4; color: #2f6670; }
.managed-tag.tag-denim button { background: #e9f0f7; color: #385371; }
.managed-tag.tag-orchid button { background: #f4ebf7; color: #714f7e; }
.managed-tag.tag-graphite button { background: #ebeced; color: #36393d; }

.location-band header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.location-band header strong {
  flex: 1;
}

.location-band strong {
  font-weight: 650;
}

.level-badge {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  flex: 0 0 auto;
}

.mini-add {
  min-height: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: white;
  color: var(--accent);
  font-weight: 600;
  padding: 3px 10px;
}

.mini-remove {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: #9b8370;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.mini-remove.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.location-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 230px));
  gap: 7px;
}

.location-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  display: grid;
  grid-template-columns: minmax(92px, 1fr) 32px 32px;
  align-items: stretch;
  overflow: hidden;
  max-width: 230px;
}

.location-card.is-selected {
  border-color: #c9aa8e;
  background: #f6eee3;
}

.location-main {
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 10px;
}

.location-main strong,
.location-main small {
  display: block;
}

.location-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(12px, 1.5vw, 14px);
}

.location-main small {
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.label-action {
  border: 0;
  border-left: 1px solid var(--line);
  background: #fffaf4;
  color: var(--accent);
  padding: 0;
  font-weight: 600;
  font-size: 15px;
  display: grid;
  place-items: center;
}

.qr-location-action {
  width: 32px;
  display: grid;
  place-items: center;
  padding: 0;
}

.qr-location-action span {
  width: 15px;
  height: 15px;
  display: block;
  background:
    linear-gradient(#8a542d 0 0) 0 0 / 6px 6px no-repeat,
    linear-gradient(#8a542d 0 0) 100% 0 / 6px 6px no-repeat,
    linear-gradient(#8a542d 0 0) 0 100% / 6px 6px no-repeat,
    linear-gradient(#8a542d 0 0) 100% 100% / 4px 4px no-repeat,
    linear-gradient(#8a542d 0 0) 50% 50% / 4px 4px no-repeat;
}

.location-main:hover,
.label-action:hover,
.mini-add:hover,
.mini-remove:hover {
  background: #f6eee3;
}

.add-level-button {
  min-height: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fffaf4;
  color: var(--accent);
  font-weight: 700;
}

.fake-qr {
  width: 166px;
  height: 166px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.fake-qr i { display: block; background: #111827; }
.fake-qr i:nth-child(2), .fake-qr i:nth-child(4), .fake-qr i:nth-child(8) {
  background: repeating-linear-gradient(45deg, #111827 0 5px, transparent 5px 10px);
}
.qr-card { display: grid; gap: 12px; justify-items: center; text-align: center; }

.qr-dialog-card {
  width: min(360px, calc(100vw - 32px));
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
}

.qr-card-compact {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf4;
  padding: 16px;
}

.fake-qr-small {
  width: 118px;
  height: 118px;
  padding: 10px;
  gap: 6px;
}

.qr-card-compact p {
  margin: 0;
  color: var(--muted);
}

.people-list {
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.people-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fffaf4;
}

.users-table { display: grid; padding-top: 10px; }
.user-row {
  display: grid;
  grid-template-columns: 1.5fr 110px 120px 130px;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  border-bottom: 1px solid var(--line);
}
.user-row strong, .user-row small { display: block; }
.user-row small { color: var(--muted); }

.role-card, .share-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  margin-top: 10px;
  background: #fffaf4;
}
.role-card p, .share-box p { margin-bottom: 0; font-size: 13px; }
.share-box .btn { margin-top: 12px; width: 100%; }

.phone-shell {
  width: min(430px, 100%);
  margin: 0 auto;
  background: #111827;
  color: white;
  border-radius: 30px;
  padding: 14px;
  box-shadow: 0 30px 80px rgba(16,24,40,.26);
}

.phone-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 6px 14px;
}
.phone-top small, .phone-top strong { display: block; }
.phone-top small { color: #b8c0cc; margin-bottom: 4px; }
.tiny-button {
  height: 32px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: white;
  padding: 0 10px;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}
.mode-toggle button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: white;
  font-weight: 650;
}
.mode-toggle button.is-active { background: white; color: #111827; }

.camera-stage {
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  background: radial-gradient(circle at 32% 22%, #697386, #2c3441 58%, #101318);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
}
#cameraVideo, #cameraCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#cameraCanvas { display: none; }
.mobile-camera-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.camera-placeholder {
  position: absolute;
  inset: auto 24px 24px;
  text-align: center;
  color: rgba(255,255,255,.86);
}
.camera-placeholder strong, .camera-placeholder span { display: block; }
.camera-placeholder span { margin-top: 8px; font-size: 13px; }
.scan-frame {
  display: none;
  position: absolute;
  inset: 54px 34px;
  border: 2px solid rgba(255,255,255,.92);
  border-radius: 6px;
}
.scan-frame span {
  width: 18px;
  height: 18px;
  position: absolute;
  border-radius: 50%;
  background: white;
}
.scan-frame span:nth-child(1) { top: -10px; left: -10px; }
.scan-frame span:nth-child(2) { top: -10px; right: -10px; }
.scan-frame span:nth-child(3) { bottom: -10px; left: -10px; }
.scan-frame span:nth-child(4) { bottom: -10px; right: -10px; }
.phone-shell[data-mode="scan"] .scan-frame { display: block; }
.camera-stage.is-scan-review #cameraVideo,
.camera-stage.is-scan-review .scan-frame,
.camera-stage.is-scan-review .camera-placeholder {
  display: none;
}
.camera-stage.is-scan-review #cameraCanvas {
  object-fit: contain;
  background: #111827;
}
.scan-crop-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
}
.scan-crop-overlay svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.scan-crop-overlay polygon {
  fill: rgba(255, 250, 244, .14);
  stroke: #fffaf4;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.28));
}
.scan-crop-overlay button {
  position: absolute;
  width: 34px;
  height: 34px;
  min-height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid #fffaf4;
  border-radius: 999px;
  background: #8a552a;
  box-shadow: 0 8px 20px rgba(0,0,0,.32);
  touch-action: none;
}
.scan-review-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.scan-review-actions small {
  color: rgba(255, 250, 244, .72);
  font-size: 12px;
  line-height: 1.35;
}
.camera-actions {
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 0 2px;
}
.mobile-link-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 250, 244, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
}
.mobile-link-box small {
  color: rgba(255, 250, 244, .72);
  font-size: 12px;
  line-height: 1.35;
}
.mobile-link-box a {
  color: #fffaf4;
  font-weight: 800;
}
.shutter {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 5px solid white;
  background: rgba(255,255,255,.18);
}

dialog {
  border: 0;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(16,24,40,.28);
}
dialog::backdrop { background: rgba(15,23,42,.35); }
.dialog-card {
  width: min(520px, calc(100vw - 32px));
  padding: 22px;
  background: white;
}
.dialog-actions { display: flex; justify-content: end; gap: 10px; }
.split-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
}

.btn.danger {
  color: var(--red);
  border-color: #efc7c2;
  background: #fff8f7;
}

@media (max-width: 1180px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; overflow: visible; }
  .main { height: auto; min-height: 100vh; overflow: visible; }
  .view.is-visible { overflow: visible; }
  #itemsView.is-visible { overflow: visible; }
  .archive-layout, .settings-grid { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .detail-panel { border-left: 1px solid var(--line); border-radius: 10px; position: static; height: auto; max-height: none; }
  .detail-scroll { max-height: none; overflow: visible; }
  .catalog-panel { border-radius: 10px; }
  .detail-resize-handle { display: none; }
}

@media (max-width: 820px) {
  html,
  body {
    min-width: 0;
    overflow-x: hidden;
  }

  body {
    background: #f4efe7;
  }

  .app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column-reverse;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 90;
    height: 62px;
    min-height: 62px;
    overflow: hidden;
    border-right: 0;
    border: 1px solid rgba(132, 83, 43, .18);
    border-radius: 18px;
    background: rgba(255, 250, 244, .96);
    box-shadow: 0 18px 46px rgba(31, 20, 11, .18);
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 6px;
    gap: 4px;
    backdrop-filter: blur(16px);
  }

  .brand,
  .help-button,
  .user-card,
  .nav-divider {
    display: none;
  }

  .nav-list {
    display: contents;
  }

  .nav-item {
    width: auto;
    min-width: 48px;
    flex: 1 1 0;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    gap: 2px;
    min-height: 48px;
    padding: 5px 4px;
    border-radius: 14px;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
  }

  .nav-item .nav-icon {
    width: 22px;
    height: 22px;
  }

  .nav-item span:not(.nav-icon) {
    max-width: 58px;
    display: block;
    font-size: 10px;
    font-weight: 650;
  }

  .nav-item.is-active {
    box-shadow: none;
    background: #efe0cf;
  }

  .main {
    min-height: 100dvh;
    padding: 14px 12px calc(92px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  .topbar {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
    margin-bottom: 12px;
  }

  .title-wrap {
    min-width: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
  }

  h1 {
    font-size: 24px;
  }

  #pageCount {
    min-width: 0;
    font-size: 13px;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .search {
    width: 100%;
    grid-column: 1 / -1;
    min-height: 42px;
  }

  .top-actions .btn,
  .sort-select select {
    min-height: 40px;
  }

  #addItemButton {
    grid-column: 1 / -1;
    width: 100%;
    padding: 0 12px;
    white-space: nowrap;
  }

  .sort-select { width: 100%; }
  .sort-select select { flex: 1; }

  .global-filter-popover {
    left: 10px !important;
    right: 10px !important;
    top: 10px !important;
    bottom: calc(84px + env(safe-area-inset-bottom));
    width: auto;
    max-height: none;
    border-radius: 12px;
    padding: 16px;
  }

  .view.is-visible,
  #itemsView.is-visible {
    min-height: 0;
    overflow: visible;
  }

  .archive-layout,
  .browse-layout,
  .incoming-layout {
    display: block;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .catalog-panel,
  .page-panel,
  .browse-page-panel,
  .incoming-page-panel {
    border-radius: 10px;
    overflow: visible;
  }

  .detail-panel {
    position: fixed;
    inset: 0;
    z-index: 100;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: white;
    opacity: 1;
    transform: translateX(0);
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .detail-panel.is-closed {
    width: auto;
    min-width: 0;
    max-width: none;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
  }

  .detail-scroll {
    height: 100dvh;
    max-height: 100dvh;
    overflow: auto;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .detail-reopen,
  .detail-resize-handle {
    display: none;
  }

  .table-head {
    display: none;
  }

  .item-table {
    gap: 8px;
    padding: 8px;
    background: #fbf8f1;
  }

  .item-row {
    min-height: 92px;
    grid-template-columns: 28px 72px minmax(0, 1fr);
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: #fffaf4;
    box-shadow: 0 1px 2px rgba(31, 20, 11, .04);
  }

  .item-row.is-selected {
    background: #f6eee3;
    border-color: #d9bea3;
  }

  .item-row > :nth-child(n+4) { display: none; }

  .item-row .item-title strong {
    font-size: 15px;
  }

  .item-row .item-title small {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .thumb { width: 64px; height: 54px; }

  .table-footer {
    padding: 12px;
    font-size: 13px;
  }

  .panel-title { display: grid; }
  .panel-actions { justify-content: start; }

  .gallery-shell,
  .gallery-content,
  .browse-grid {
    overflow: visible;
  }

  .gallery-breadcrumbs,
  .browse-breadcrumbs {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .gallery-toolbar {
    align-items: stretch;
    overflow-x: auto;
  }

  .segmented {
    width: max-content;
    max-width: 100%;
  }

  .gallery-context,
  .browse-context {
    border-radius: 10px;
    padding: 14px;
  }

  .gallery-folder-grid,
  .browse-folder-grid {
    grid-template-columns: 1fr;
  }

  .gallery-file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .gallery-tile {
    padding: 5px;
    gap: 0;
  }

  .gallery-tile .thumb,
  .gallery-tile .image-thumb {
    aspect-ratio: 1 / 1;
    border-radius: 7px;
  }

  .gallery-info-button,
  .gallery-menu-button {
    width: 26px;
    height: 26px;
    top: 8px;
  }

  .gallery-info-button {
    right: 8px;
  }

  .gallery-menu-button {
    left: 8px;
  }

  .incoming-grid {
    display: grid;
    gap: 12px;
  }

  .browse-section-head,
  .browse-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .browse-tools {
    align-items: stretch;
  }
  .browse-controls {
    margin-left: 0;
  }
  .browse-controls input,
  .browse-controls select {
    width: 100%;
  }
  .browse-item-row button {
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .browse-row-meta {
    display: none;
  }

  .detail-hero {
    border-radius: 0;
  }

  .detail-top {
    align-items: start;
    gap: 10px;
  }

  .detail-heading {
    min-width: 0;
  }

  .detail-title,
  .detail-title-input {
    font-size: 22px;
  }

  .detail-body {
    padding: 16px;
  }

  .detail-grid,
  .edit-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .detail-grid > strong,
  .edit-grid > strong {
    margin-top: 8px;
  }

  .detail-photo {
    min-height: 220px;
  }

  .detail-actions {
    position: sticky;
    bottom: 0;
    margin: 0 -16px -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 250, 244, .96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .item-qr-modal,
  .gallery-modal,
  .photo-gallery-modal,
  .gallery-preview-modal {
    padding: 10px;
  }

  .item-qr-card,
  .gallery-card,
  .gallery-preview-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 12px;
  }
}
