/* Тёплая «бумажная» палитра с мягким цветным фоном; тёмная тема — тот же характер ночью. */
:root {
  --bg: #f6efe4;
  --surface: rgba(255, 252, 246, .78);
  --surface-solid: #fffcf6;
  --ink: #2a211c;
  --muted: #7b6d61;
  --line: rgba(80, 55, 35, .12);
  --line-strong: rgba(80, 55, 35, .24);
  --accent: #c2362b;
  --accent-soft: rgba(194, 54, 43, .1);
  --accent-ink: #fff;
  --warn: #9a6a00;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(60, 35, 20, .06), 0 10px 30px -14px rgba(60, 35, 20, .25);
  --shadow-lift: 0 2px 4px rgba(60, 35, 20, .08), 0 22px 40px -18px rgba(60, 35, 20, .38);
  --blob-1: rgba(214, 92, 62, .22);
  --blob-2: rgba(47, 125, 128, .18);
  --blob-3: rgba(222, 170, 70, .2);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130f;
    --surface: rgba(38, 32, 27, .72);
    --surface-solid: #26201b;
    --ink: #f1e8dc;
    --muted: #a99b8c;
    --line: rgba(255, 235, 210, .1);
    --line-strong: rgba(255, 235, 210, .2);
    --accent: #ef6a5c;
    --accent-soft: rgba(239, 106, 92, .14);
    --warn: #e0b04c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -14px rgba(0, 0, 0, .6);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 24px 44px -18px rgba(0, 0, 0, .75);
    --blob-1: rgba(190, 70, 50, .2);
    --blob-2: rgba(40, 120, 125, .18);
    --blob-3: rgba(180, 130, 50, .12);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 16px/1.55 var(--font);
  background:
    radial-gradient(900px 520px at 8% -8%, var(--blob-1), transparent 62%),
    radial-gradient(760px 480px at 100% 4%, var(--blob-2), transparent 60%),
    radial-gradient(900px 620px at 55% 115%, var(--blob-3), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}
/* Лёгкое бумажное зерно поверх фона */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); margin: 0 0 .5em; }
.muted { color: var(--muted); }
.small { font-size: .85em; display: block; }
.lead { font-size: 1.15em; margin: -.2em 0 .4em; }
.entity { display: flex; flex-wrap: wrap; gap: 1em; align-items: flex-start; justify-content: space-between; margin-bottom: 1em; }
.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); box-shadow: var(--shadow); display: block; background: var(--surface-solid); }
.portrait figcaption { margin-top: .4em; word-break: break-word; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: .5em; }
.entity-text { max-width: 760px; margin: 0 0 1.8em; padding: 1.1em 1.4em; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.entity-text p:first-child { margin-top: 0; }
.entity-text p:last-child { margin-bottom: 0; }
.entries li { margin-bottom: .35em; }
.card.album .caption { display: flex; flex-direction: column; gap: .15em; }
.card.album strong { font-family: var(--display); font-size: 1.15em; }
.narrow.wide { max-width: 760px; }
.narrow.wide textarea { font-size: .95em; }
.error { color: var(--accent); display: block; }
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--warn); padding: .6em 1em; border-radius: var(--radius-sm); }
.hp { position: absolute; left: -9999px; }
.inline { display: inline; }
.plain { list-style: none; padding: 0; }
.columns { columns: 3 220px; }
.columns li { break-inside: avoid; padding: .15em 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Шапка: матовое стекло поверх фона */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .5em 1.5em; align-items: center;
  padding: .7em max(16px, calc((100vw - 1400px) / 2 + 16px));
  background: var(--surface); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
}
.brand { font-family: var(--display); font-size: 1.2em; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.top nav { display: flex; gap: .25em; flex-wrap: wrap; }
.top nav a { color: var(--ink); padding: .35em .8em; border-radius: 999px; font-weight: 500; }
.top nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.account { margin-left: auto; display: flex; gap: .75em; align-items: center; flex-wrap: wrap; font-size: .95em; }
.lang { display: inline-flex; background: var(--line); border-radius: 999px; padding: 2px; }
.lang button.linklike { color: var(--muted); padding: .15em .6em; border-radius: 999px; font-size: .85em; font-weight: 600; }
.lang button.active { background: var(--surface-solid); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
main { padding: 24px 16px; max-width: 1400px; margin: 0 auto; }
.bottom { padding: 3em 16px; text-align: center; font-size: .9em; }

/* Кнопки и поля */
button, .button {
  font: inherit; font-weight: 600; font-size: .95em; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-solid); color: var(--ink);
  border-radius: 999px; padding: .45em 1.05em; display: inline-flex; align-items: center; gap: .4em;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
button:hover, .button:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
button.danger { color: var(--accent); }
button.linklike { border: none; background: none; padding: 0; color: var(--accent); font-weight: 500; box-shadow: none; }
button.linklike:hover { text-decoration: underline; }
input, select, textarea {
  font: inherit; padding: .55em .8em; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-solid); color: var(--ink); max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05em; height: 1.05em; }
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='%237b6d61' stroke-width='2.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;
}
textarea { width: 100%; }
label { display: block; font-size: .88em; font-weight: 600; color: var(--muted); margin-top: .6em; }

.messages { list-style: none; padding: 0; }
.messages li { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: .6em 1em; margin-bottom: .5em; border-radius: var(--radius-sm); }

/* Каталог: большая строка поиска и расширенный поиск */
.catalog { margin-bottom: 1.2em; }
.hero { text-align: center; padding: 2.2em 0 1.2em; }
.hero-title { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 3rem); margin-bottom: .55em; }
.search {
  position: relative; display: flex; align-items: center; max-width: 760px; margin: 0 auto;
  font-size: 1rem; font-weight: 400; color: var(--ink);
}
.search svg { position: absolute; left: 1.15em; width: 1.3em; height: 1.3em; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 60px; padding: 0 3.2em 0 3.3em; font-size: 1.12rem;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-solid); box-shadow: var(--shadow);
}
.search input:focus { box-shadow: var(--shadow), 0 0 0 5px var(--accent-soft); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.spinner {
  position: absolute; right: 3em; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line-strong); 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); } }

.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: .9em; font-weight: 500; display: inline-flex; align-items: center; gap: .45em;
  padding: .38em .85em; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-solid);
  color: var(--ink); cursor: pointer; line-height: 1.3;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on .n { color: inherit; opacity: .8; }
.chip .n { color: var(--muted); font-size: .85em; font-variant-numeric: tabular-nums; }
.chip.ghost { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.toggle svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.chip.toggle[aria-expanded=true] { border-color: var(--accent); color: var(--accent); }
.chip .count:not(:empty) { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .5em; font-size: .8em; font-weight: 700; }
.chip.removable span { font-size: 1.15em; line-height: 1; }
.chip[hidden] { display: none; }

.segmented { display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px; }
.segmented label { margin: 0; font-size: .88em; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: .32em .95em; border-radius: 999px; transition: background .15s, color .15s; }
.segmented input:checked + span { background: var(--surface-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

.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);
  box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.advanced[hidden] { display: none; }
.facet { border: 0; margin: 0; padding: 0; min-width: 0; }
.facet legend { font-size: .78em; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5em; }
.facet .chips { display: flex; flex-wrap: wrap; gap: .4em; max-height: 12.5em; overflow-y: auto; padding: 2px 4px 2px 0; align-content: flex-start; }
.facet-filter { width: 100%; margin-bottom: .5em; padding: .4em .9em; border-radius: 999px; font-size: .9em; }
.lookup { position: relative; margin-bottom: .5em; }
.facet-lookup { width: 100%; padding: .4em .9em; border-radius: 999px; font-size: .9em; }
.lookup-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 4; display: flex; flex-wrap: wrap; gap: .4em;
  max-height: 16em; overflow-y: auto; padding: 10px; background: var(--surface-solid);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lift);
}
.lookup-results[hidden] { display: none; }
.years { display: flex; align-items: center; gap: .5em; }
.years input { width: 7em; border-radius: 999px; }

.results-head { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; margin: .5em 0 1em; }
.suggestions { display: flex; flex-wrap: wrap; gap: .45em; align-items: center; margin: -.3em 0 1em; }

/* Сетка открыток */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; background: var(--surface-solid); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--ink); position: relative; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.card img { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 10px; }
.card .caption { padding: .55em .85em .75em; font-size: .92em; font-weight: 500; border-top: 1px solid var(--line); }
.noimg { aspect-ratio: 3 / 2; background: linear-gradient(135deg, var(--line), transparent); }
.noimg.big { width: 100%; border-radius: var(--radius); }
.pager { display: flex; gap: 1em; justify-content: center; align-items: center; margin: 2em 0; }
.pager a { padding: .4em 1em; border-radius: 999px; background: var(--surface-solid); border: 1px solid var(--line-strong); font-weight: 600; }
.pager a:hover { text-decoration: none; border-color: var(--accent); }

.selectable .card input[type=checkbox] { position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; z-index: 1; }
.selectable .card:has(input:checked) { outline: 3px solid var(--accent); }
.badge { display: inline-block; font-size: .8em; font-weight: 600; padding: .15em .65em; border-radius: 999px; background: var(--line); }
.badge.warn { background: none; color: var(--warn); margin: 0 .6em .4em; }

/* Карточка открытки */
.postcard { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 36px; }
.photos { display: flex; flex-wrap: wrap; gap: 12px; }
.photos figure { margin: 0; width: calc(33% - 8px); }
.photos figure.main { width: 100%; }
.photos img { width: 100%; background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.photos figcaption { font-size: .85em; margin-top: .3em; }
.info { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4em 1.6em; box-shadow: var(--shadow); align-self: start; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.info dl { display: grid; grid-template-columns: max-content 1fr; gap: .45em 1.2em; }
.info dt { color: var(--muted); font-size: .92em; }
.info dd { margin: 0; font-weight: 500; }
.notes { white-space: normal; }
.share { display: flex; flex-wrap: wrap; gap: .5em; margin: 1.2em 0; }
.share .permalink { flex: 1 1 100%; font-size: .9em; }
.private { border: 1px dashed var(--line-strong); padding: 0 1em; border-radius: var(--radius-sm); }
@media (max-width: 760px) {
  .postcard { grid-template-columns: 1fr; }
}
#lightbox { position: fixed; inset: 0; background: rgba(10, 8, 6, .88); display: flex; align-items: center; justify-content: center; z-index: 10; cursor: zoom-out; backdrop-filter: blur(4px); }
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 96vw; max-height: 96vh; border-radius: 6px; }

.comments { max-width: 760px; margin-top: 2.5em; }
.comment { border-top: 1px solid var(--line); padding: .6em 0; }
.comment.hidden { opacity: .5; }
.comment p { margin: .2em 0; }

/* Рабочая часть */
.subnav { display: flex; flex-wrap: wrap; gap: .3em; margin-bottom: 1.2em; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.subnav a { color: var(--ink); padding: .35em .9em; border-radius: 999px; font-weight: 500; font-size: .95em; }
.subnav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.tiles { display: flex; flex-wrap: wrap; gap: 16px; }
.tile { background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1em 1.5em; color: var(--ink); min-width: 190px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
a.tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.tile strong { display: block; font-size: 2.1em; font-family: var(--display); }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 2em; 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: .5em; align-items: center; margin: 1em 0; }
.toolbar .group { display: flex; gap: .3em; }
.sticky { position: sticky; top: 58px; background: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: .5em .75em; z-index: 2; border-radius: var(--radius-sm); }

.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: 12px; background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; box-shadow: var(--shadow); }
.photo-card img { width: 100%; border-radius: var(--radius-sm); }
.photo-tools form { margin-bottom: .4em; }
.photo-tools .buttons { display: flex; flex-wrap: wrap; gap: .3em; }
.photo-tools .buttons button { padding: .3em .7em; font-size: .88em; }
.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: 1em 1.4em; box-shadow: var(--shadow); align-self: start; }
.edit-form label { 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; }
}
.modal { position: fixed; inset: 0; background: rgba(10, 8, 6, .72); z-index: 10; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-body { background: var(--surface-solid); padding: 18px; border-radius: var(--radius); width: min(96vw, 1000px); box-shadow: var(--shadow-lift); }
.crop-area { max-height: 75vh; }
.crop-area img { display: block; max-width: 100%; }
.mod-item { display: flex; gap: 16px; border-bottom: 1px solid var(--line); padding: 1em 0; }
.mod-item img { width: 160px; border-radius: var(--radius-sm); }
table.diff, table.list { border-collapse: collapse; width: 100%; margin: .5em 0; background: var(--surface-solid); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.diff td, table.diff th, table.list td, table.list th { border-bottom: 1px solid var(--line); padding: .5em .7em; text-align: left; vertical-align: top; }
table.list th, table.diff th { font-size: .82em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.list img.mini { width: 60px; border-radius: 6px; }
.inline-filters { display: flex; flex-wrap: wrap; gap: .5em; margin-bottom: 1em; }
.bulk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6em 1em; }
.bulk summary { cursor: pointer; font-weight: 600; }
.bulk-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1em; }
.narrow { max-width: 420px; margin: 2em auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6em 2em; box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.narrow input { width: 100%; }
@media (max-width: 760px) {
  table.list { display: block; overflow-x: auto; }
  .top { position: static; }
}

.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(300px, 2fr); gap: 20px; }
.rec-image { overflow: auto; max-height: calc(94vh - 36px); border-radius: var(--radius-sm); background: var(--bg); 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 - 36px); padding-right: 4px; }
.rec-side h2 { margin-top: 0; }
.rec-row { display: block; margin: 0 0 .7em; }
.rec-row input { display: block; width: 100%; margin-top: .25em; }
.rec-row.found input { border-color: #c9a227; box-shadow: 0 0 0 3px rgba(201, 162, 39, .18); }
.rec-row .was { display: block; font-weight: 400; font-size: .85em; margin-top: .2em; }
.rec-text pre { white-space: pre-wrap; font-size: .85em; background: var(--surface-solid); padding: .6em; border-radius: var(--radius-sm); border: 1px solid var(--line); }
@media (max-width: 800px) { .recognize-body { grid-template-columns: 1fr; overflow-y: auto; } .rec-image, .rec-side { max-height: none; } }

/* Варианты одной открытки */
.variants { margin: 2.5em 0; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grid.small .caption { display: flex; flex-direction: column; gap: .15em; }
.variants-edit { margin-top: 1em; }
.variants-edit .variant-row { display: flex; align-items: center; gap: .6em; margin: .3em 0; }

.tag-editor { margin-top: .25em; }
.tag-chips { display: flex; flex-wrap: wrap; gap: .35em; align-items: center; padding: .35em .45em; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-solid); }
.tag-chips:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tag-chips input { flex: 1 1 10em; border: 0; box-shadow: none; padding: .25em .3em; background: transparent; min-width: 8em; }
.tag-chips input:focus { box-shadow: none; }
.tag-chips .chip { font-size: .85em; padding: .25em .7em; }
.tag-suggest { display: flex; flex-direction: column; gap: .35em; margin-top: .45em; }
.tag-group { display: flex; flex-wrap: wrap; gap: .3em; align-items: center; }
.tag-group > .muted { display: inline; margin-right: .3em; }
.tag-group .chip { font-size: .82em; padding: .22em .65em; }

.wanted-badge {
  position: absolute; top: 10px; right: 10px; padding: .15em .7em; border-radius: 999px; font-size: .8em; font-weight: 700;
  background: var(--surface-solid); color: var(--accent); border: 1px solid var(--accent); box-shadow: var(--shadow);
}
.notice.wanted { border-left-color: var(--accent); }

.album-block { margin-bottom: 2.5em; }
.album-block h2 { margin: 0; font-size: 1.3em; }
.album-block .toolbar.sticky { justify-content: space-between; }
.small-search { margin: 0; flex: 1 1 320px; max-width: 560px; }
.small-search input { height: 44px; font-size: 1rem; box-shadow: none; }
label.card { cursor: pointer; margin: 0; font-size: 1em; font-weight: 400; color: var(--ink); }

.sorting { display: inline-flex; gap: .4em; align-items: center; flex-wrap: wrap; }
.chip.sort-dir { font-size: 1.05em; font-weight: 700; padding: .3em .8em; }
.chip.sort-dir[hidden] { display: none; }

.type-badge {
  position: absolute; top: 10px; left: 10px; padding: .15em .7em; border-radius: 999px; font-size: .78em; font-weight: 700;
  background: var(--surface-solid); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.link-form { display: flex; flex-wrap: wrap; gap: .4em; align-items: center; }

.my-lists { display: flex; flex-wrap: wrap; gap: .4em; margin: 1em 0 .4em; }
.my-lists form { margin: 0; }
.who { margin: .3em 0 0; }
.segmented.tabs { margin: 0 0 1.2em; flex-wrap: wrap; }
.segmented.tabs a { display: block; white-space: nowrap; padding: .35em 1em; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .9em; }
.segmented.tabs a:hover { text-decoration: none; color: var(--ink); }
.segmented.tabs a.active { background: var(--surface-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented.tabs .n { color: var(--muted); font-size: .85em; }

.feedback-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8em 1.2em; margin-bottom: .8em; }
.feedback-item.done { opacity: .6; }
.feedback-item p { margin: .3em 0; }
.bottom a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

#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: 130px; display: flex; flex-direction: column; gap: .2em; }
.add-previews img { width: 130px; height: 100px; object-fit: contain; background: var(--surface-solid); border: 1px solid var(--line); border-radius: var(--radius-sm); }

.section-title { margin: 1.4em 0 .6em; font-size: 1.35em; }
.profile-albums .toolbar { justify-content: space-between; }
.profile-albums .section-title { margin: 0; }
label.check { display: flex; gap: .5em; align-items: center; font-size: .95em; color: var(--ink); font-weight: 500; }

/* Каталог: фильтры слева, открытки справа */
.catalog-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.catalog-side {
  position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.catalog-side .catalog { margin: 0; }
.search.compact { max-width: none; margin: 0 0 .6em; }
.search.compact svg { left: .8em; width: 1.05em; height: 1.05em; }
.search.compact input { height: 40px; font-size: .95rem; padding: 0 2.2em 0 2.4em; box-shadow: none; }
.search.compact .spinner { right: .8em; width: 14px; height: 14px; }
.catalog-side .sorting { display: flex; gap: .4em; margin-bottom: .8em; }
.catalog-side .sorting select { flex: 1; padding: .4em 2em .4em .7em; font-size: .9em; border-radius: 999px; }
.filters-head { display: flex; justify-content: space-between; align-items: center; font-size: .78em; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .2em .2em .4em; border-bottom: 1px solid var(--line); }
.filters-head .linklike { text-transform: none; letter-spacing: 0; font-size: 1.1em; }
details.facet { border-bottom: 1px solid var(--line); padding: 0; }
details.facet summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5em;
  padding: .55em .2em; font-weight: 600; font-size: .92em;
}
details.facet summary::-webkit-details-marker { display: none; }
details.facet summary::after { content: "▸"; margin-left: auto; color: var(--muted); transition: transform .15s; }
details.facet[open] summary::after { transform: rotate(90deg); }
details.facet summary .count:not(:empty) { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .5em; font-size: .78em; }
details.facet > :not(summary) { margin: 0 .2em .6em; }
details.facet .chips { max-height: 14em; }
details.facet .chip { font-size: .84em; padding: .28em .7em; }
details.facet .facet-filter { font-size: .85em; padding: .35em .8em; }
details.facet .years input { width: 6em; padding: .35em .6em; font-size: .9em; }
.catalog-main .select-row { display: flex; justify-content: flex-end; margin-bottom: -.4em; }
.catalog-main .results-head { margin-top: 0; }
@media (max-width: 860px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .catalog-side { position: static; max-height: none; }
}

/* Точки у названия: зелёная — «Маю», жёлтая — «Шукаю» */
.dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: .4em; vertical-align: .08em; }
.dot.have { background: #3aa655; box-shadow: 0 0 0 2px rgba(58, 166, 85, .2); }
.dot.want { background: #e0b020; box-shadow: 0 0 0 2px rgba(224, 176, 32, .25); }

/* Режим выбора и панель массовых действий */
.selecting .card { cursor: pointer; }
.selecting .card::after {
  content: ""; position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--line-strong); background: var(--surface-solid);
}
.selecting .card.picked { outline: 3px solid var(--accent); outline-offset: -3px; }
.selecting .card.picked::after { background: var(--accent); border-color: var(--accent); }
.bulk-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 8; width: min(96vw, 980px);
  display: flex; flex-wrap: wrap; gap: .5em .7em; align-items: center; padding: 10px 14px;
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.bulk-bar[hidden] { display: none; }
.bulk-count { font-weight: 700; }
.bulk-bar select { max-width: 260px; }
.bulk-new { display: inline-flex; gap: .5em; align-items: center; }
.bulk-new[hidden] { display: none; }
.bulk-message { flex-basis: 100%; }
.bulk-message:empty { display: none; }

.proposal { align-items: flex-start; }
.proposal-body { flex: 1; min-width: 0; }
.proposal-note { margin: .2em 0 .6em; font-style: italic; }
table.diff del { color: #b3261e; text-decoration-thickness: 1px; }
table.diff ins { color: #2e8b47; text-decoration: none; font-weight: 600; }
.chip.plus { border-color: #2e8b47; color: #2e8b47; cursor: default; }
.chip.minus { border-color: #b3261e; color: #b3261e; text-decoration: line-through; cursor: default; }
.proposals-list li { margin-bottom: .4em; }
.small-inline { font-size: .85em; }
.badge.status-approved { background: rgba(46, 139, 71, .18); color: #2e8b47; }
.badge.status-rejected { background: rgba(179, 38, 30, .15); color: #b3261e; }

/* Мои списки — иконки с подсказкой */
.my-lists { gap: .5em; }
.icon-toggle {
  position: relative; width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%;
  --tone: var(--muted);
}
.icon-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-toggle.kind-have { --tone: #2e9b4f; }
.icon-toggle.kind-want { --tone: #d6a312; }
.icon-toggle.kind-trade { --tone: #2f7d9e; }
.icon-toggle.kind-favorite { --tone: #d23b4a; }
.icon-toggle:hover { color: var(--tone); border-color: var(--tone); }
.icon-toggle.on { color: #fff; background: var(--tone); border-color: var(--tone); }
.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; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: .8rem; font-weight: 600; padding: .3em .7em; border-radius: 8px;
  background: var(--ink); color: var(--bg); pointer-events: none; z-index: 5;
}

/* Просмотр фото: листание */
#lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 30px; line-height: 1; justify-content: center; cursor: pointer;
}
#lightbox .lb-nav:hover { background: rgba(255, 255, 255, .28); color: #fff; }
#lightbox .lb-prev { left: 16px; }
#lightbox .lb-next { right: 16px; }
#lightbox .lb-count { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: #fff; font-size: .9rem; opacity: .85; }
#lightbox .lb-nav[hidden], #lightbox .lb-count[hidden] { display: none; }

.proposal-photos { margin: .6em 0; }
.proposal-photos .thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: .3em; }
.proposal-photos img { width: 120px; height: 90px; object-fit: contain; background: var(--surface-solid); border-radius: 8px; border: 3px solid var(--line); }
.proposal-photos.add img { border-color: #2e8b47; }
.proposal-photos.remove img { border-color: #b3261e; opacity: .75; }
