/* Колекція листівок — «музейний» стиль. Заміна static/css/site.css: ті самі класи, що в шаблонах.
   Шрифти в base.html:
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600&family=Literata:opsz,wght@7..72,500;7..72,600&display=swap"> */
:root {
  --bg: #f5f1ea;
  --surface: #fffdf9;
  --surface-solid: #fffdf9;
  --sunk: #eae3d7;
  --ink: #1e1a16;
  --muted: #5e554b;
  --faint: #8c8378;
  --line: #e3dcd0;
  --line-strong: #cfc6b8;
  --accent: #8a2e22;
  --accent-hover: #6f2319;
  --accent-soft: #f6e0dc;
  --accent-ink: #fff;
  --warn: #7a5200;
  --warn-soft: #fbefd2;
  --ok: #1f6b3a;
  --ok-soft: #dff0e2;
  --bad: #b33a2b;
  --bad-soft: #f8e1dc;
  --focus: #2457c5;
  --have: #2f8a4e;
  --want: #c98a0b;
  --want-dot: #e0a21b;
  --trade: #2f6f8e;
  --like: #b8323f;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-photo: 3px;
  --shadow: 0 1px 3px rgba(30, 26, 22, .06);
  --shadow-photo: 0 1px 2px rgba(30, 26, 22, .14), 0 6px 18px rgba(30, 26, 22, .06);
  --shadow-lift: 0 12px 32px rgba(30, 26, 22, .22);
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Literata", Georgia, "Times New Roman", serif;
  --tap: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130f;
    --surface: #221d18;
    --surface-solid: #221d18;
    --sunk: #1c1814;
    --ink: #efe7db;
    --muted: #a89a8a;
    --faint: #7d7164;
    --line: #3a322a;
    --line-strong: #4e453b;
    --accent: #e38a78;
    --accent-hover: #eea08f;
    --accent-soft: #3a231e;
    --accent-ink: #16130f;
    --warn: #e8b54a;
    --warn-soft: #3a2f17;
    --ok: #5dbb7a;
    --ok-soft: #1b3324;
    --bad: #e8707c;
    --bad-soft: #3d1e21;
    --have: #5dbb7a;
    --want: #e8b54a;
    --want-dot: #e8b54a;
    --trade: #6fafcc;
    --like: #e8707c;
    --focus: #8fb0ff;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-photo: 0 0 0 1px var(--line), 0 8px 20px rgba(0, 0, 0, .4);
    --shadow-lift: 0 14px 36px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font: 17px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.18; letter-spacing: -.005em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.6rem); margin: 0 0 .4em; }
h2 { font-size: 1.55rem; margin: 0 0 .7em; }
h3 { font-size: 1.2rem; }
p { text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: .88em; display: block; }
.lead { font-size: 1.15em; margin: -.2em 0 .4em; }
.error { color: var(--bad); display: block; }
.hp { position: absolute; left: -9999px; }
.inline { display: inline; }
.plain { list-style: none; padding: 0; }
.columns { columns: 3 240px; }
.columns li { break-inside: avoid; padding: .2em 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.notice { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); padding: .7em 1em; border-radius: var(--radius-sm); }
.notice.wanted { background: var(--accent-soft); color: var(--accent); }

/* Шапка */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .5em 2.2em; align-items: center; min-height: 76px;
  padding: .6em max(20px, calc((100vw - 1440px) / 2 + 40px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-size: 1.35em; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.top nav { display: flex; gap: 1.6em; flex-wrap: wrap; align-self: stretch; }
.top nav a { display: flex; align-items: center; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.top nav a:hover, .top nav a[aria-current=page] { color: var(--ink); border-bottom-color: var(--accent); }
.account { margin-left: auto; display: flex; gap: 1em; align-items: center; flex-wrap: wrap; font-size: .95em; }
.account a { color: var(--ink); text-decoration: none; }
.account .button.primary { color: var(--accent-ink); }
main { padding: 24px 20px 48px; max-width: 1440px; margin: 0 auto; }
@media (min-width: 900px) { main { padding: 24px 40px 64px; } }
.bottom { padding: 2.5em 20px; text-align: center; font-size: .92em; border-top: 1px solid var(--line); }
.bottom a { color: inherit; }

/* Кнопки і поля */
button, .button {
  font: inherit; font-size: 1rem; font-weight: 500; cursor: pointer; line-height: 1.2;
  min-height: var(--tap); padding: 0 1.15em; display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius);
  text-decoration: none; transition: background .15s, border-color .15s;
}
button:hover, .button:hover { border-color: var(--ink); color: var(--ink); }
button:disabled { background: var(--line); border-color: var(--line); color: var(--faint); cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
button.wide { width: 100%; margin-top: 8px; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
button.linklike { min-height: 0; border: 0; background: none; padding: 0; color: var(--accent); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
button.linklike:hover { color: var(--accent-hover); }
input, select, textarea {
  font: inherit; font-size: 1rem; min-height: var(--tap); padding: .5em .8em; max-width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
input[type=file] { padding: 6px; width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-size: .94rem; min-height: 32px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); cursor: pointer; }
textarea { width: 100%; min-height: 6em; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; accent-color: var(--ink); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2em; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235e554b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7em center; background-size: 1em;
}
label { display: block; font-size: .92em; color: var(--muted); margin-top: .7em; }
label.check { display: flex; gap: .6em; align-items: center; font-size: 1em; color: var(--ink); min-height: 40px; margin: 0; }

.messages { list-style: none; padding: 0; margin: 0 0 1em; }
.messages li { background: var(--surface); border: 1px solid var(--line); padding: .7em 1em; margin-bottom: .5em; border-radius: var(--radius-sm); }
.messages li.success { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.messages li.error { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* Пошук */
.catalog { margin-bottom: 1.2em; }
.hero { text-align: center; padding: 2.2em 0 1.2em; }
.hero-title { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); margin-bottom: .55em; }
.search { position: relative; display: flex; align-items: center; max-width: none; margin: 0; }
.search svg { position: absolute; left: 18px; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; height: 56px; padding: 0 52px; font-size: 1.1rem; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--surface); }
.spinner { position: absolute; right: 18px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); opacity: 0; transition: opacity .15s; }
.loading .spinner { opacity: 1; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading .spinner { animation-duration: 2s; } }

/* Чипи */
.toolbar-row { display: flex; flex-wrap: wrap; gap: .75em; align-items: center; justify-content: space-between; margin: .6em 0 0; }
.chip {
  font: inherit; font-size: .94rem; font-weight: 400; display: inline-flex; align-items: center; gap: .45em;
  min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; line-height: 1.2;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { color: var(--muted); font-size: .88em; font-variant-numeric: tabular-nums; }
.chip.on .n { color: inherit; opacity: .75; }
.chip.ghost { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.removable { background: var(--ink); border-color: var(--ink); color: var(--bg); padding-right: 5px; }
.chip.removable span { width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 16%, transparent); font-size: 1.1em; line-height: 1; }
.chip .count:not(:empty) { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--ink); color: var(--bg); font-size: .8em; font-weight: 600; display: inline-grid; place-items: center; }
.chip[hidden] { display: none; }
.chip.toggle svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.segmented { display: inline-flex; background: var(--sunk); border-radius: var(--radius); padding: 3px; }
.segmented label { margin: 0; font-size: .95em; color: var(--muted); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; min-height: 38px; padding: 0 1em; border-radius: var(--radius-sm); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }

/* Фасети */
.advanced { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 1em; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.advanced[hidden] { display: none; }
.facet { border: 0; margin: 0; padding: 0; min-width: 0; }
.facet legend { font-size: .8em; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .5em; }
.facet .chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 15em; overflow-y: auto; padding: 2px 4px 2px 0; align-content: flex-start; }
.facet-filter, .facet-lookup { width: 100%; min-height: 40px; margin-bottom: .5em; font-size: .94rem; }
.lookup { position: relative; margin-bottom: .5em; }
.lookup-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 4; display: flex; flex-wrap: wrap; gap: 6px; max-height: 16em; overflow-y: auto; padding: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lift); }
.lookup-results[hidden] { display: none; }
.years { display: flex; align-items: center; gap: .6em; }
.years input { width: 0; flex: 1; }

.results-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }

/* Сітка: фото без рамок, пропорції зберігаються */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 32px 22px; align-items: end; }
.card { display: flex; flex-direction: column; gap: 10px; color: var(--ink); position: relative; text-decoration: none; }
.card:hover { color: var(--ink); }
.card img, .card .noimg { width: 100%; height: auto; aspect-ratio: auto; max-height: 300px; object-fit: contain; object-position: bottom; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); background: var(--sunk); transition: box-shadow .2s; }
.card:hover img { box-shadow: 0 2px 4px rgba(30, 26, 22, .18), 0 14px 30px rgba(30, 26, 22, .14); }
.card .caption { font-size: 1rem; font-weight: 500; line-height: 1.35; }
.card .caption .muted, .card .caption .small { font-weight: 400; font-size: .94rem; }
.noimg { aspect-ratio: 3 / 2; background: var(--sunk); }
.noimg.big { width: 100%; border-radius: var(--radius); }
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 2em 0; }
.pager a { min-height: var(--tap); padding: 0 1em; display: inline-flex; align-items: center; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none; }
.pager a:hover { border-color: var(--ink); }

.badge { display: inline-flex; align-items: center; font-size: .82em; font-weight: 500; min-height: 26px; padding: 0 10px; border-radius: 13px; background: var(--sunk); color: var(--ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.status-approved { background: var(--ok-soft); color: var(--ok); }
.badge.status-rejected { background: var(--bad-soft); color: var(--bad); }
.type-badge { position: absolute; left: 10px; bottom: 44px; min-height: 26px; padding: 0 10px; border-radius: 13px; font-size: .8rem; font-weight: 500; display: inline-flex; align-items: center; background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--ink); }
.wanted-badge { position: absolute; top: 10px; right: 10px; min-height: 26px; padding: 0 10px; border-radius: 13px; font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; background: var(--accent-soft); color: var(--accent); }

/* Точки «маю / шукаю» */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .45em; vertical-align: .02em; }
.dot.have { background: var(--have); }
.dot.want { background: var(--want-dot); }

/* Вибір і масові дії */
.selecting .card { cursor: pointer; }
.selecting .card::after { content: ""; position: absolute; top: 10px; left: 10px; width: 28px; height: 28px; border-radius: 6px; border: 2px solid var(--muted); background: color-mix(in srgb, var(--surface) 90%, transparent); }
.selecting .card.picked img { outline: 3px solid var(--accent); outline-offset: 4px; }
.selecting .card.picked::after { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 18px no-repeat; border-color: var(--accent); }
.selectable .card input[type=checkbox] { position: absolute; top: 10px; left: 10px; width: 24px; height: 24px; z-index: 1; }
.selectable .card:has(input:checked) img { outline: 3px solid var(--accent); outline-offset: 4px; }
.bulk-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 8; width: max-content; max-width: calc(100vw - 24px);
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 10px 10px 20px;
  background: #1e1a16; color: #fffdf9; border-radius: 12px; box-shadow: var(--shadow-lift);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar button { background: none; color: #fffdf9; border-color: rgba(255, 253, 249, .3); }
.bulk-bar button.primary { background: #fffdf9; color: #1e1a16; border-color: #fffdf9; }
.bulk-bar button.linklike { color: #fffdf9; }
.bulk-bar select { background-color: #fffdf9; color: #1e1a16; max-width: 260px; }
.bulk-count { font-weight: 600; margin-right: 6px; }
.bulk-new { display: inline-flex; gap: .5em; align-items: center; }
.bulk-new[hidden] { display: none; }
.bulk-new .check { color: #fffdf9; }
.bulk-message { flex-basis: 100%; color: rgba(255, 253, 249, .75); }
.bulk-message:empty { display: none; }

/* Каталог: фільтри зліва */
.catalog-layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 40px; align-items: start; }
.catalog-side { position: sticky; top: 92px; max-height: calc(100vh - 108px); overflow-y: auto; padding: 0 8px 24px 0; border-right: 1px solid var(--line); }
.catalog-side .catalog { margin: 0; }
.search.compact { margin: 0 0 12px; }
.search.compact svg { left: 12px; width: 18px; height: 18px; }
.search.compact input { height: var(--tap); font-size: 1rem; padding: 0 38px; border-width: 1px; border-color: var(--line-strong); border-radius: var(--radius-sm); }
.search.compact .spinner { right: 12px; width: 14px; height: 14px; }
.catalog-side .sorting { display: flex; gap: 0; margin-bottom: 16px; }
.catalog-side .sorting select { flex: 1; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.filters-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 0 12px; font-family: var(--display); font-size: 1.25rem; }
.filters-head .linklike { font-family: var(--font); font-size: .94rem; }
details.facet { border-top: 1px solid var(--line); }
details.facet:last-of-type { border-bottom: 1px solid var(--line); }
details.facet summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 50px; font-size: 1.02rem; }
details.facet summary::-webkit-details-marker { display: none; }
details.facet summary::after { content: "+"; margin-left: auto; width: 20px; text-align: center; font-size: 1.25rem; color: var(--muted); }
details.facet[open] summary::after { content: "−"; }
details.facet summary .count:not(:empty) { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: .8rem; display: inline-grid; place-items: center; }
details.facet > :not(summary) { margin: 0 0 14px; }
details.facet .chip { font-size: .94rem; }
.catalog-main .select-row { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.chip.sort-dir { min-width: var(--tap); min-height: var(--tap); justify-content: center; font-size: 1.1rem; padding: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.chip.sort-dir[hidden] { display: none; }
.sorting { display: inline-flex; gap: 0; align-items: center; }
@media (max-width: 860px) {
  .catalog-layout { grid-template-columns: 1fr; gap: 16px; }
  .catalog-side { position: static; max-height: none; border-right: 0; padding: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
}

/* Каталог за макетом 2b: пошук зверху, сортування в рядку з кількістю, сітка-галерея */
.catalog-main > .search { margin-bottom: 18px; }
.catalog-main .search .spinner { right: 18px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.results-head .total { font-size: 1.05rem; }
.results-head .sorting { margin-left: auto; display: flex; height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.results-head .sorting select { border: 0; border-radius: 0; min-height: 0; height: 100%; background-color: transparent; }
.results-head .sorting select:focus { box-shadow: none; }
.results-head .sort-dir { width: var(--tap); min-height: 0; height: 100%; padding: 0; border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; background: none; font-size: 1.1rem; }
.results-head .sort-dir[hidden] { display: none; }
#select-toggle.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.checks { display: flex; flex-direction: column; }
.checks label.check { min-height: 40px; gap: 12px; }
.checks label.check[hidden] { display: none; }
.checks label.check span:first-of-type { flex: 1; }
.checks .n { font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.facet .more { padding: 8px 0; font-size: .94rem; }
.facet .more[hidden] { display: none; }
.filters-head .sheet-close, .sheet-foot, .filters-open { display: none; }

.grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.grid::after { content: ""; flex: 10 1 0; }
.grid > .card { flex: var(--r, 1.4) 1 calc(var(--r, 1.4) * var(--card-h, 200px)); min-width: 0; }
#results[data-size=s] { --card-h: 100px; }
#results[data-size=s] .grid { gap: 10px; }
#results[data-size=s] .card .caption { font-size: .88rem; }
#results { --card-h: 165px; }
#results[data-size=l] { --card-h: 280px; }
/* Вид «Списком»: рядок — мініатюра, назва, художник, рік, видавництво */
.list-info { display: none; }
#results[data-size=list] .grid { display: block; border-top: 1px solid var(--line); }
#results[data-size=list] .grid::after { display: none; }
#results[data-size=list] .card { display: flex; flex-direction: row; align-items: center; gap: 18px; padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: 0; }
#results[data-size=list] .card:hover { background: var(--surface); }
#results[data-size=list] .card .photo { flex: none; width: 96px; height: 72px; display: grid; place-items: center; box-shadow: none; background: var(--sunk); border-radius: var(--radius-sm); }
#results[data-size=list] .card .photo img { width: auto; height: auto; max-width: 88px; max-height: 64px; aspect-ratio: auto; box-shadow: var(--shadow-photo); }
#results[data-size=list] .card .photo .dot { top: 4px; right: 4px; width: 10px; height: 10px; }
#results[data-size=list] .card .type-badge, #results[data-size=list] .card .hover-title, #results[data-size=list] .card img.back { display: none; }
#results[data-size=list] .list-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-meta { display: flex; flex-wrap: wrap; gap: 0 14px; color: var(--muted); font-size: .94rem; }
.list-meta span + span::before { content: "·"; margin-right: 14px; color: var(--line-strong); }
.card-size { display: flex; height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.card-size button { width: var(--tap); min-height: 0; height: 100%; padding: 0; border: 0; border-radius: 0; background: none; color: var(--muted); }
.card-size button + button { border-left: 1px solid var(--line-strong); }
.card-size button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.card-size svg { width: 18px; height: 18px; fill: currentColor; }
.grid.small > .card { flex: 0 0 calc(var(--r, 1.4) * 170px); min-width: 150px; max-width: 300px; }
.card .photo { position: relative; display: block; }
.card .photo img, .card .photo .noimg { display: block; width: 100%; max-height: none; aspect-ratio: var(--r, 1.4); object-fit: cover; }
.card .photo .type-badge { bottom: 10px; }
.card .photo .dot { position: absolute; top: 10px; right: 10px; width: 14px; height: 14px; margin: 0; box-shadow: 0 0 0 2.5px var(--surface); }
.card .caption { display: flex; flex-direction: column; gap: 2px; }
.card .caption .meta { font-size: .94rem; font-weight: 400; color: var(--muted); }
/* Наведення на картку: оборот і назва; на сенсорних екранах не показуємо */
.card .photo { overflow: hidden; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); container-type: inline-size; }
.card .photo img { box-shadow: none; }
.selecting .card.picked .photo { outline: 3px solid var(--accent); outline-offset: 4px; overflow: visible; }
.card .photo img.back { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--sunk); box-shadow: none; opacity: 0; transition: opacity .2s; }
/* оборот повёрнут относительно лица: поворачиваем его на 90°, чтобы он заполнил карточку */
.card .photo img.back.turn { inset: auto; left: 50%; top: 50%; width: calc(100cqw / var(--r, 1.4)); height: 100cqw; transform: translate(-50%, -50%) rotate(-90deg); }
.card .hover-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; font-size: .82rem; line-height: 1.3; color: #fffdf9;
  background: linear-gradient(transparent, rgba(22, 19, 16, .8)); opacity: 0; transition: opacity .2s; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) {
  .card:hover img.back[src] { opacity: 1; }
  .card:hover .hover-title { opacity: 1; }
  .card:hover .type-badge { opacity: 0; }
}
.card:focus-visible .hover-title { opacity: 1; }
.selecting .card .hover-title, .selecting .card img.back { display: none; }
.load-more { display: flex; width: max-content; margin: 32px auto 8px; min-width: 260px; }
.load-more[aria-busy] { opacity: .6; pointer-events: none; }
.to-start { display: block; text-align: center; margin-top: 16px; font-size: .94rem; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
.empty { padding: 3em 0; text-align: center; }
.error-page { padding: 12vh 0; }
.error-code { font-family: var(--display); font-size: 4rem; line-height: 1; color: var(--line-strong); margin: 0 0 .2em; }
.empty h3 { font-size: 1.15rem; margin: 0 0 .3em; }

/* Масові дії: меню над панеллю */
.bulk-bar details.menu { position: relative; }
.bulk-bar details.menu summary { list-style: none; }
.bulk-bar details.menu summary::-webkit-details-marker { display: none; }
.bulk-bar summary.button { background: none; color: #fffdf9; border-color: rgba(255, 253, 249, .3); }
.bulk-bar summary.button.primary { background: #fffdf9; color: #1e1a16; border-color: #fffdf9; }
.menu-items { position: absolute; bottom: calc(100% + 10px); left: 0; min-width: 250px; max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; padding: 6px; background: #fffdf9; color: #1e1a16; border-radius: 10px; box-shadow: var(--shadow-lift); }
.bulk-bar .menu-items button { justify-content: flex-start; gap: 10px; border: 0; border-radius: 6px; color: #1e1a16; text-align: left; font-weight: 400; }
.bulk-bar .menu-items button:hover { background: #f5f1ea; }
.bulk-bar .menu-items button.danger { color: #8a2e22; }
.menu-items hr { border: 0; height: 1px; background: #e3dcd0; margin: 4px 0; width: 100%; }
.menu-label { font-size: .8rem; color: #5e554b; padding: 8px 10px 4px; }
.menu-items .dot { margin: 0; }
.dot.trade { background: var(--trade); }
.dot.favorite { background: var(--like); }

@media (max-width: 860px) {
  .grid > .card, .grid.small > .card { flex: 1 1 40%; }
  #results[data-size=s] .grid > .card { flex-basis: 28%; }
  #results[data-size=l] .grid > .card { flex-basis: 100%; }
  .grid { align-items: flex-start; }
  .grid::after { display: none; }
  .filters-open { display: inline-flex; margin-bottom: 12px; }
  .filters-open .count:not(:empty) { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--ink); color: var(--bg); font-size: .8em; display: inline-grid; place-items: center; }
  .catalog-side { display: none; }
  .filters-shown { overflow: hidden; }
  .filters-shown .catalog-side { display: block; position: fixed; inset: 0; z-index: 20; max-height: none; overflow-y: auto; padding: 0 20px; background: var(--surface); }
  .filters-shown .filters-head { position: sticky; top: 0; z-index: 1; padding: 18px 0; margin: 0; background: var(--surface); align-items: center; gap: 16px; }
  .filters-shown .filters-head > span { flex: 1; font-size: 1.5rem; }
  .filters-shown .filters-head .sheet-close { display: inline-flex; border: 0; background: none; font-size: 1.8rem; padding: 0 4px; }
  .filters-shown .sheet-foot { display: block; position: sticky; bottom: 0; padding: 12px 0 16px; background: var(--surface); border-top: 1px solid var(--line); }
  .sheet-foot button { width: 100%; min-height: 54px; font-size: 1.1rem; }
  .active-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .active-filters .chip { flex: none; }
  .results-head .total { flex-basis: 100%; }
  .results-head .sorting { margin-left: 0; }
}

/* Сторінка листівки */
.postcard { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; }
.photos { display: flex; flex-wrap: wrap; gap: 12px; align-content: start; }
.photos figure { margin: 0; width: 120px; }
.photos figure.main { width: 100%; background: var(--sunk); border-radius: var(--radius-sm); padding: 6%; }
.photos img { display: block; width: 100%; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); cursor: zoom-in; }
.photos figure:not(.main) img { aspect-ratio: 4 / 3; object-fit: contain; background: var(--sunk); padding: 8px; box-shadow: none; border-radius: var(--radius-sm); }
.photos figcaption { font-size: .9em; margin-top: .4em; }
.info { align-self: start; }
.info dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); margin: 0 0 1.2em; border-top: 1px solid var(--line); }
.info dt, .info dd { padding: 11px 0; border-bottom: 1px solid var(--line); }
.info dt { color: var(--muted); }
.info dd { margin: 0; display: flex; flex-direction: column; }
.info dd .small { font-size: .9em; color: var(--muted); }
.notes { max-width: 36em; }
.share { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.2em 0; }
.share .permalink { flex: 1 1 100%; color: var(--muted); }
.private { border: 1px dashed var(--line-strong); padding: 4px 18px; border-radius: var(--radius); margin: 1em 0; }
.private h3 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 400; }
.private dl { border-top: 0; }
.private dt, .private dd { border-bottom: 0; padding: 4px 0; }
.who { margin: .3em 0 0; color: var(--muted); }
@media (max-width: 760px) {
  .postcard { grid-template-columns: 1fr; gap: 24px; }
  .info dl { grid-template-columns: 1fr; }
  .info dt { border-bottom: 0; padding-bottom: 0; font-size: .88em; }
}

/* Сторінка листівки за макетом 2c */
.crumbs { display: flex; gap: 8px; font-size: .9rem; color: var(--muted); margin: -4px 0 20px; }
.crumbs a { color: var(--muted); }
.crumbs span:last-child { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photos { flex-direction: column; flex-wrap: nowrap; gap: 14px; }
.photos figure.main { padding: 0; }
.photos figure.main a { position: relative; display: grid; place-items: center; aspect-ratio: 1.3; padding: 7%; cursor: zoom-in; }
.photos figure.main img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.photos .fullscreen { position: absolute; right: 12px; bottom: 12px; min-height: 32px; padding: 0 12px; border-radius: 16px; display: inline-flex; align-items: center; font-size: .85rem; color: var(--ink); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); }
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.thumbs .thumb { width: 120px; height: 88px; min-height: 0; padding: 8px; background: var(--sunk); border: 2px solid transparent; border-radius: var(--radius-sm); }
.thumbs .thumb[aria-current] { border-color: var(--ink); }
.thumbs .thumb img { width: 100%; height: 100%; object-fit: contain; border-radius: 2px; }
.thumb-caption { font-size: .94rem; margin-left: 6px; }
.info h1 { font-size: clamp(1.9rem, 1.4rem + 1.5vw, 2.6rem); margin: 0 0 18px; }
.kicker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 6px; font-size: .94rem; color: var(--muted); }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.actions-row .my-lists { margin: 0; }
.actions-row .share { margin: 0 0 0 auto; }
.actions-row .share button { min-height: 40px; font-size: .94rem; }
.who { margin: 0 0 18px; font-size: .92rem; }
.info dd.tags { flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.info dd.tags .chip { min-height: 32px; text-decoration: none; }
.variants { margin-top: 2.5em; }
@media (max-width: 760px) {
  .actions-row .share { margin: 0; }
  .thumbs .thumb { width: 96px; height: 72px; }
}

/* Мої списки: іконки з підказкою */
.my-lists { display: flex; flex-wrap: wrap; gap: 10px; margin: 1em 0 .6em; }
.my-lists form { margin: 0; }
.icon-toggle { position: relative; width: 56px; height: 56px; min-height: 0; padding: 0; border-radius: 10px; border-width: 1.5px; color: var(--muted); --tone: var(--muted); }
.icon-toggle svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-toggle.kind-have { --tone: var(--have); }
.icon-toggle.kind-want { --tone: var(--want); }
.icon-toggle.kind-trade { --tone: var(--trade); }
.icon-toggle.kind-favorite { --tone: var(--like); }
.icon-toggle:hover { color: var(--tone); border-color: var(--tone); }
.icon-toggle.on { color: var(--tone); border-color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, var(--surface)); }
.icon-toggle.kind-favorite.on svg { fill: currentColor; }
.icon-toggle[data-tip]:hover::after, .icon-toggle[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: .88rem; font-weight: 400; padding: 6px 10px; border-radius: 6px;
  background: var(--ink); color: var(--bg); pointer-events: none; z-index: 5;
}

/* Лайтбокс */
#lightbox { position: fixed; inset: 0; background: rgba(22, 19, 16, .96); display: flex; align-items: center; justify-content: center; z-index: 10; cursor: zoom-out; touch-action: pan-y; }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: calc(100vw - 180px); max-height: calc(100vh - 140px); border-radius: var(--radius-photo); }
#lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 60px; height: 60px; border-radius: 30px; border: 0; background: rgba(255, 253, 249, .12); color: #fffdf9; font-size: 30px; line-height: 1; cursor: pointer; }
#lightbox .lb-nav:hover { background: rgba(255, 253, 249, .24); color: #fffdf9; }
#lightbox .lb-prev { left: 24px; }
#lightbox .lb-next { right: 24px; }
#lightbox .lb-count { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: rgba(255, 253, 249, .8); font-size: .95rem; }
#lightbox .lb-nav[hidden], #lightbox .lb-count[hidden] { display: none; }
@media (max-width: 760px) { #lightbox img { max-width: 100vw; } #lightbox .lb-nav { display: none; } }

/* Варіанти, пов'язане, коментарі */
.variants { margin: 3em 0; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.grid.small .caption { display: flex; flex-direction: column; gap: 2px; font-size: .94rem; }
.variants-edit { margin-top: 1em; }
.variants-edit .variant-row { display: flex; align-items: center; gap: .6em; margin: .3em 0; }
.comments { max-width: 820px; margin-top: 2.5em; padding-top: 2em; border-top: 1px solid var(--line); }
.comment { border-bottom: 1px solid var(--line); padding: .8em 0; }
.comment.hidden { opacity: .55; }
.comment p { margin: .2em 0; }
.comment p.muted { font-size: .9em; }
.comments form { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 1em; }

/* Художники, видавництва, альбоми */
.entity { display: flex; flex-wrap: wrap; gap: 1.5em; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5em; }
.entity h1 { margin-bottom: .2em; }
.entity-main { flex: 1 1 320px; }
.portrait { margin: 0; width: 180px; flex: none; }
.portrait img { width: 180px; height: 220px; object-fit: cover; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); display: block; background: var(--sunk); }
.portrait figcaption { margin-top: .4em; font-size: .9em; color: var(--muted); }
.entity-text { max-width: 760px; margin: 0 0 2em; font-size: 1.05rem; }
/* Довідники: рядки з аватаркою, ім'ям, довідкою і кількістю */
.entries { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 40px; }
.entries li a { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.entries li a:hover .entry-name { color: var(--accent); }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; object-fit: cover; background: var(--sunk); color: var(--muted); display: grid; place-items: center; font-family: var(--display); font-size: 1.1rem; }
.entry-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entries .n { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
/* Альбоми: обкладинки однакового розміру */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 32px 24px; }
.album { display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none; }
.album .cover { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 12%; margin-bottom: 8px; background: var(--sunk); border-radius: var(--radius); }
.album .cover img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(30, 26, 22, .18)); transition: transform .2s; }
.album:hover .cover img { transform: translateY(-3px); }
.album .type-badge { bottom: 10px; }
.album-name { font-family: var(--display); font-size: 1.2rem; line-height: 1.25; }
.album:hover .album-name { color: var(--accent); }
.album-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.album .small { display: block; }
.album-block { margin-bottom: 2.5em; }
.album-block h2 { margin: 0; font-size: 1.35em; }
.album-block .toolbar.sticky { justify-content: space-between; }
.small-search { margin: 0; flex: 1 1 320px; max-width: 560px; }
.small-search input { height: var(--tap); font-size: 1rem; border-width: 1px; border-color: var(--line-strong); }
label.card { cursor: pointer; margin: 0; font-size: 1em; color: var(--ink); }
.section-title { margin: 1.6em 0 .6em; font-size: 1.4em; }
.profile-albums .toolbar { justify-content: space-between; }
.profile-albums .section-title { margin: 0; }
.segmented.tabs { margin: 0 0 1.4em; flex-wrap: wrap; }
.segmented.tabs a { display: flex; align-items: center; min-height: 40px; white-space: nowrap; padding: 0 1em; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; }
.segmented.tabs a:hover { color: var(--ink); }
.segmented.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented.tabs .n { color: var(--muted); font-size: .88em; margin-left: .35em; }

/* Робота з колекцією — щільно */
.subnav { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 1.4em; border-bottom: 1px solid var(--line); }
.subnav a { display: flex; align-items: center; min-height: var(--tap); padding: 0 .9em; color: var(--muted); text-decoration: none; font-size: .95em; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover, .subnav a[aria-current=page] { color: var(--ink); border-bottom-color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; color: var(--ink); text-decoration: none; }
a.tile:hover { border-color: var(--ink); color: var(--ink); }
.tile { display: flex; flex-direction: column; gap: 2px; min-height: 96px; justify-content: center; }
.tile span { color: var(--muted); font-size: .94rem; }
.tile strong { display: block; font-family: var(--display); font-weight: 500; font-size: 2em; line-height: 1.1; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 2.4em; text-align: center; margin-bottom: 1em; background: var(--surface); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone label { display: inline; font-size: 1em; }
.dropzone progress { width: 100%; accent-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 1em 0; }
/* Заголовок сторінки з дією праворуч */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.tiles + h2, .rows + h2 { margin-top: 1.8em; }
/* Прості списки рядками: назва і пояснення ліворуч, статус праворуч */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rows li { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rows .row-main { display: flex; flex-direction: column; min-width: 0; }
.rows li.muted { display: block; }
table.history td { vertical-align: top; }
table.history .change { padding: 2px 0; }
.nowrap { white-space: nowrap; }
@media (max-width: 760px) {
  table.history, table.history tbody, table.history tr, table.history td { display: block; }
  table.history tr:first-child { display: none; }
  table.history tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .subnav a { flex: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 84px; padding: 12px 14px; }
  .albums { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .album-name { font-size: 1.05rem; }
  table.diff.history td { border: 0; padding: 2px 12px; }
  table.history td:first-child { width: auto; text-align: left; color: var(--muted); font-size: .88rem; }
}
.toolbar .group { display: flex; gap: 4px; }
.sticky { position: sticky; top: 76px; background: var(--bg); padding: 8px 0; z-index: 2; border-bottom: 1px solid var(--line); }
.inline-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 1em; }
.inline-filters input[type=search], .inline-filters input[type=text] { grid-column: span 2; }
.inline-filters > * { width: 100%; min-width: 0; }
.bulk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6em 1em; }
.bulk summary { cursor: pointer; font-weight: 500; min-height: 36px; display: flex; align-items: center; }
.bulk-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1em; }
.narrow { max-width: 440px; margin: 2em auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2em; }
.narrow input { width: 100%; }
.narrow.wide { max-width: 760px; }
.feedback-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9em 1.2em; margin-bottom: .8em; }
.feedback-item.done { opacity: .6; }
.feedback-item p { margin: .3em 0; }
.proposals-list li { margin-bottom: .4em; }
.small-inline { font-size: .88em; }

/* Правка */
.edit-head { display: flex; flex-wrap: wrap; gap: 1em; align-items: baseline; }
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
.photo-card { display: grid; grid-template-columns: 200px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.photo-card img { width: 100%; border-radius: var(--radius-photo); }
.photo-tools form { margin-bottom: .4em; }
.photo-tools .buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.photo-tools .buttons button { min-height: 36px; padding: 0 .8em; font-size: .92em; }
.split-check { margin: 0 0 .4em; }
.postcard-tools form { margin-bottom: .8em; }
.edit-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2em 1.4em; align-self: start; }
.edit-form label { margin-top: .9em; }
.edit-form label:first-child { margin-top: 0; }
.edit-form input:not([type=checkbox]), .edit-form select { width: 100%; }
@media (max-width: 900px) { .edit-layout { grid-template-columns: 1fr; } .photo-card { grid-template-columns: 1fr; } }
.tag-editor { margin-top: .25em; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: var(--tap); padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.tag-chips:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.tag-chips input { flex: 1 1 10em; border: 0; box-shadow: none; min-height: 32px; padding: 0 .3em; background: transparent; min-width: 8em; }
.tag-chips input:focus { box-shadow: none; }
.tag-chips .chip { min-height: 30px; font-size: .9em; padding: 0 10px; }
.tag-suggest { display: flex; flex-direction: column; gap: 6px; margin-top: .5em; }
.tag-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-group > .muted { display: inline; margin-right: .3em; font-size: .9em; }
.tag-group .chip { min-height: 30px; font-size: .88em; padding: 0 10px; }
.link-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#add-drop { display: block; cursor: pointer; position: relative; }
#add-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.add-previews { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; list-style: none; margin: 0 0 1em; }
.add-previews li { width: 140px; display: flex; flex-direction: column; gap: .3em; font-size: .9em; }
.add-previews img { width: 140px; height: 100px; object-fit: contain; background: var(--sunk); border-radius: var(--radius-sm); }

/* Модальні вікна, обрізка, OCR */
.modal { position: fixed; inset: 0; background: rgba(22, 19, 16, .72); z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-body { background: var(--surface); padding: 20px; border-radius: 10px; width: min(96vw, 1000px); box-shadow: var(--shadow-lift); }
.crop-area { max-height: 75vh; }
.crop-area img { display: block; max-width: 100%; }
.recognize { margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .6em; align-items: center; }
.recognize-body { width: min(96vw, 1280px); max-height: 94vh; display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 24px; }
.rec-image { overflow: auto; max-height: calc(94vh - 40px); border-radius: var(--radius-sm); background: var(--sunk); cursor: zoom-in; }
.rec-image img { display: block; width: 100%; }
.rec-image.zoomed { cursor: zoom-out; }
.rec-image.zoomed img { width: 220%; max-width: none; }
.rec-side { overflow-y: auto; max-height: calc(94vh - 40px); padding-right: 4px; }
.rec-side h2 { margin-top: 0; }
.rec-row { display: block; margin: 0 0 .8em; }
.rec-row input { display: block; width: 100%; margin-top: .25em; }
.rec-row.found input { border-color: var(--want); background: var(--warn-soft); }
.rec-row .was { display: block; font-size: .88em; margin-top: .2em; color: var(--muted); }
.rec-text pre { white-space: pre-wrap; font-size: .9em; background: var(--sunk); padding: .7em; border-radius: var(--radius-sm); }
@media (max-width: 800px) { .recognize-body { grid-template-columns: 1fr; overflow-y: auto; } .rec-image, .rec-side { max-height: none; } }

/* Модерація */
/* Модерація за макетом 2d: меню кабінету, черга, розбір */
.subnav a .n { margin-left: auto; padding-left: 12px; font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.mod-layout { display: grid; grid-template-columns: 232px 360px minmax(0, 1fr); height: calc(100vh - 76px - 48px); min-height: 560px; font-size: .94rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mod-layout .subnav { flex-direction: column; flex-wrap: nowrap; gap: 2px; margin: 0; padding: 16px 12px; border: 0; border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto; }
.mod-layout .subnav a { min-height: 42px; padding: 0 12px; border: 0; margin: 0; border-radius: var(--radius-sm); color: var(--ink); }
.mod-layout .subnav a:hover { background: var(--sunk); }
.mod-layout .subnav a[aria-current=page] { background: var(--ink); color: var(--bg); }
.mod-layout .subnav a[aria-current=page] .n { color: inherit; opacity: .8; }
.mod-queue { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.queue-filter { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.queue-filter .chip { text-decoration: none; }
.queue { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.queue a { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; color: var(--ink); text-decoration: none; }
.queue a:hover { background: var(--bg); }
.queue a[aria-current] { background: var(--bg); border-left-color: var(--accent); }
.queue img, .queue .noimg { width: 56px; height: 40px; object-fit: cover; border-radius: 2px; flex: none; }
.queue-text { display: flex; flex-direction: column; min-width: 0; }
.queue-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-meta { color: var(--muted); font-size: .88rem; }
.queue-meta > span { display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 3px; font-size: .8rem; font-weight: 600; }
.tag-edit { background: color-mix(in srgb, var(--trade) 16%, var(--surface)); color: var(--trade); }
.tag-new { background: var(--ok-soft); color: var(--ok); }
.tag-photo { background: var(--warn-soft); color: var(--warn); }
.queue-empty { padding: 16px; }
.mod-review { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.review-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.review-head p { margin: 0; }
.review-head h1 { font-size: 1.35rem; margin: 2px 0 0; }
.review-nav { display: flex; gap: 8px; align-items: center; flex: none; }
.review-nav .button { width: var(--tap); padding: 0; }
.review-nav span.button { opacity: .4; }
.review-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.review-body { flex: 1; overflow-y: auto; padding: 18px 24px; }
.review-section { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.review-section .linklike { text-transform: none; letter-spacing: 0; font-size: .94rem; }
.review-section:first-child { margin-top: 0; }
.photo-groups { display: flex; flex-wrap: wrap; gap: 28px; }
.photo-groups .proposal-photos { margin: 0; }
.proposal-photos.same img { border-color: transparent; }
.review-foot { display: flex; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--bg); }
.review-foot input { flex: 1; }
button.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
button.dark:hover { background: var(--ink); color: var(--bg); opacity: .9; }
.notice.dup { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.notice.dup .button, .notice.dup button { min-height: 36px; }
.review-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.review-photos { display: flex; flex-direction: column; gap: 12px; }
.review-photos img { width: 100%; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); }
.review-fields { display: grid; grid-template-columns: 150px minmax(0, 1fr); margin: 0 0 12px; border-top: 1px solid var(--line); }
.review-fields dt, .review-fields dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.review-fields dt { color: var(--muted); }
@media (max-width: 1100px) {
  .mod-layout { grid-template-columns: minmax(0, 1fr); height: auto; overflow: visible; border: 0; background: none; }
  .mod-layout .subnav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; border: 0; background: none; padding: 0 0 12px; }
  .mod-layout .subnav a { flex: none; }
  .review-head { flex-direction: column-reverse; gap: 8px; padding: 12px 16px; }
  .review-body { padding: 16px; }
  .mod-queue { border: 1px solid var(--line); border-radius: var(--radius); max-height: 40vh; background: var(--surface); }
  .mod-review { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .review-body { overflow: visible; }
  .review-foot { position: sticky; bottom: 0; flex-wrap: wrap; }
  .review-new { grid-template-columns: 1fr; }
}
.mod-item { display: flex; gap: 18px; border-bottom: 1px solid var(--line); padding: 1em 0; }
.mod-item img { width: 160px; border-radius: var(--radius-photo); box-shadow: var(--shadow-photo); align-self: flex-start; }
.proposal { align-items: flex-start; }
.proposal-body { flex: 1; min-width: 0; }
.proposal-note { margin: .2em 0 .8em; padding: 10px 14px; background: var(--sunk); border-radius: var(--radius-sm); }
table.diff, table.list { border-collapse: collapse; width: 100%; margin: .5em 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; font-size: .94rem; }
table.diff td, table.diff th, table.list td, table.list th { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: middle; }
table.list th, table.diff th { font-size: .8rem; font-weight: 400; color: var(--muted); background: var(--bg); }
table.diff td:first-child { width: 48px; text-align: center; }
table.diff tr:has(input:not(:checked)) td { opacity: .55; }
table.diff del { background: var(--bad-soft); color: var(--bad); padding: 2px 6px; border-radius: 3px; text-decoration-thickness: 1px; }
table.diff ins { background: var(--ok-soft); color: var(--ok); padding: 2px 6px; border-radius: 3px; text-decoration: none; }
.chip.plus { border-color: var(--have); color: var(--ok); cursor: default; min-height: 28px; font-size: .88rem; }
.chip.minus { border-color: var(--bad); color: var(--bad); text-decoration: line-through; cursor: default; min-height: 28px; font-size: .88rem; }
.list img.mini { display: block; width: 64px; height: 46px; object-fit: contain; background: var(--sunk); border-radius: var(--radius-photo); }
.proposal-photos { margin: .8em 0; }
.proposal-photos .thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: .4em; }
.proposal-photos img { width: 140px; height: 98px; object-fit: contain; background: var(--sunk); border-radius: 4px; border: 3px solid var(--line); }
.proposal-photos.add .check { color: var(--ok); }
.proposal-photos.add img { border-color: var(--have); }
.proposal-photos.remove .check { color: var(--bad); }
.proposal-photos.remove img { border-color: var(--bad); opacity: .75; }
.menu-toggle { display: none; }
@media (max-width: 760px) {
  table.list { display: block; overflow-x: auto; }
  .top { position: static; min-height: 64px; }
  .menu-toggle { display: inline-flex; margin-left: auto; width: var(--tap); padding: 0; border: 0; background: none; }
  .menu-toggle svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .top > nav, .top:has(.menu-toggle) > .account { display: none; }
  .top.open > nav, .top.open > .account { display: flex; flex-basis: 100%; flex-direction: column; gap: 0; margin: 0; align-items: stretch; }
  .top.open > nav a { min-height: var(--tap); border-bottom: 0; }
  .top.open > .account { flex-direction: row; padding: 8px 0 4px; border-top: 1px solid var(--line); }
  .filters-open { background: var(--ink); border-color: var(--ink); color: var(--bg); }
  .filters-open .count:not(:empty) { background: var(--bg); color: var(--ink); }
  .mod-item { flex-direction: column; }
}
