/* Склад. Тихий интерфейс вокруг обложек; единственный громкий элемент это картонная бирка короба
   с кодом «маркером». Шрифты лежат в /fonts, внешних запросов нет. */


:root {
  --concrete: #0f1419;   /* фон страницы */
  --sheet: #1c242d;      /* панели и поля ввода */
  --ink: #e4e9ef;
  --muted: #8794a5;
  --line: #27313c;
  --kraft: #c49b5f;      /* картон */
  --kraft-edge: #7a5c30;
  --kraft-ink: #241806;
  --stamp: #8eaaff;      /* чернила: ссылки и действия */
  --stamp-ink: #0d1530;
  --alarm: #ff9a8a;
  --header: #151b22;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--concrete); color: var(--ink); font: 400 16px/1.5 "Golos Text", system-ui, sans-serif; }
a { color: var(--stamp); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; border-radius: 3px; }
h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 750; letter-spacing: -.02em; margin: 0 0 .5rem; }
h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -.01em; margin: 2.5rem 0 .75rem; }
small, .muted { color: var(--muted); }
.hint { display: block; color: var(--muted); font-size: .875rem; max-width: 70ch; margin: .5rem 0; }
.empty { color: var(--muted); max-width: 60ch; padding: 1.25rem 0; }

/* Шапка общая для всех страниц: см. top.css */
main { max-width: 1240px; margin: 0 auto; padding: 28px 20px 96px; }

/* Поля и кнопки */
input, select, textarea, button, .button { font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input, select { max-width: 100%; min-width: 0; }
textarea { width: 100%; resize: vertical; }
button, .button { cursor: pointer; text-decoration: none; display: inline-block; font-weight: 500; }
button:hover, .button:hover { border-color: var(--ink); }
button:disabled { opacity: .45; cursor: default; }
.primary, button.primary, .button.primary { background: var(--stamp); border-color: var(--stamp); color: var(--stamp-ink); font-weight: 600; }
.primary:hover { filter: brightness(1.08); }
button.link { border: 0; background: none; padding: 0; color: var(--stamp); text-decoration: underline; text-underline-offset: 3px; font-weight: 400; }
.danger, button.link.danger { color: var(--alarm); }
button.danger:not(.link) { border-color: var(--alarm); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.panel { background: var(--sheet); border-radius: 10px; padding: 20px; margin: 16px 0; display: grid; gap: 16px; }
.panel label { display: grid; gap: 5px; font-size: .875rem; color: var(--muted); }
.panel label input, .panel label select { width: 100%; font-size: 1rem; }
.panel button.primary { justify-self: start; padding: 10px 22px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row > label { flex: 1 1 150px; }
.panel.narrow { max-width: 380px; margin: 9vh auto 0; padding: 28px; }
.wordmark { display: flex; align-items: center; gap: 12px; font-size: 2.25rem; font-weight: 850; margin: 0 0 4px; }

.flash { background: var(--sheet); border-left: 4px solid var(--stamp); padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 0 0 20px; }
.error { color: var(--alarm); font-weight: 600; }

/* Галерея: лист контактных отпечатков. Рамок нет, цвет дают сами обложки. */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input[name="q"] { flex: 1 1 260px; }
.filters .button.primary { margin-left: auto; }
.summary { color: var(--muted); margin: 18px 0 14px; }
.summary b { color: var(--ink); font-weight: 650; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 22px 14px; }
.card { position: relative; min-width: 0; }
.shot { position: relative; display: block; text-decoration: none; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: var(--line); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot:hover { outline: 2px solid var(--ink); outline-offset: 2px; }
.nophoto { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .875rem; }
.qty { position: absolute; right: 6px; bottom: 6px; background: var(--ink); color: var(--concrete); font-size: .75rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.cap { margin-top: 7px; font-weight: 600; font-size: .9375rem; line-height: 1.25; color: var(--ink); text-decoration: none; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cap:hover { text-decoration: underline; }
.spec { display: flex; justify-content: space-between; gap: 8px; font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card input[type="checkbox"] { position: absolute; top: 7px; left: 7px; width: 26px; height: 26px; margin: 0; padding: 0; appearance: none; cursor: pointer; border: 2px solid #fff; border-radius: 6px; background: rgb(23 32 43 / .35); box-shadow: 0 1px 4px rgb(0 0 0 / .35); }
.card input[type="checkbox"]:checked { background: var(--stamp) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat; border-color: var(--stamp); }
.card:has(input:checked) .shot { outline: 3px solid var(--stamp); outline-offset: 2px; }

/* Панель укладки: главный рабочий инструмент, поэтому заметная */
.bulk { position: sticky; bottom: 14px; border: 1px solid #35424f; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 16px; margin-top: 28px; background: var(--header); color: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgb(0 0 0 / .3); }
.bulk .count { font-variant-numeric: tabular-nums; }
.bulk button.link { color: #c3ccd7; }
.bulk select { flex: 1 1 200px; min-width: 0; }
.bulk button:not(.link) { background: var(--kraft); border-color: var(--kraft); color: var(--kraft-ink); font-weight: 650; }

/* Картонная бирка короба */
.tag { display: inline-flex; align-items: baseline; gap: 10px; padding: 5px 14px 8px; color: var(--kraft-ink); text-decoration: none; border-radius: 3px; font-weight: 500;
  background: var(--kraft) repeating-linear-gradient(90deg, rgb(0 0 0 / .16) 0 2px, transparent 2px 5px) bottom / 100% 4px no-repeat; }
.tag:hover { filter: brightness(1.06); }
.tag .code, .boxhead .code { font-family: "Pangolin", "Golos Text", cursive; font-weight: 400; letter-spacing: .02em; }
.tag .code { font-size: 1.5rem; line-height: 1; }
.tag.small { padding: 2px 10px 5px; gap: 7px; vertical-align: baseline; }
.tag.small .code { font-size: 1.125rem; }
.place { font-weight: 700; font-size: 1.0625rem; color: var(--ink); text-decoration: none; }
.place:hover { text-decoration: underline; }
.load { margin-left: 12px; color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.tree, .tree ul { list-style: none; padding: 0; margin: 0; }
.tree ul { margin: 8px 0 4px 10px; padding-left: 22px; border-left: 2px solid var(--line); }
.tree li { padding: 5px 0; }
.loose { margin: 24px 0; }

.boxhead { display: flex; align-items: center; gap: 22px; margin: 0 0 24px; }
.boxhead h1 { margin: 0; }
.boxhead p { margin: 4px 0 0; color: var(--muted); }
.boxhead.kraft { padding: 18px 24px 22px; border-radius: 4px; color: var(--kraft-ink);
  background: var(--kraft) repeating-linear-gradient(90deg, rgb(0 0 0 / .16) 0 2px, transparent 2px 5px) bottom / 100% 6px no-repeat; }
.boxhead.kraft p, .boxhead.kraft a { color: var(--kraft-ink); }
.boxhead .code { font-size: 4rem; line-height: .9; }

/* Страница вещи: фото слева, карточка учёта справа */
.item { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 36px; align-items: start; }
@media (max-width: 820px) { .item { grid-template-columns: 1fr; gap: 20px; } }
.where { color: var(--muted); margin: 0 0 1rem; }
.photos { display: flex; flex-wrap: wrap; gap: 16px; }
.photos figure { margin: 0; max-width: 100%; }
.photos > p { flex-basis: 100%; margin: 0; }
.photos img { display: block; width: auto; height: auto; max-width: 100%; max-height: 78vh; border-radius: 4px; }
figcaption { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .875rem; color: var(--muted); padding-top: 6px; }
figcaption form, td form { display: inline; }
.facts { margin: 1.25rem 0; max-width: 480px; }
.facts div { display: flex; justify-content: space-between; gap: 28px; padding: 7px 0; border-bottom: 1px dotted var(--muted); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; }
.text { white-space: pre-wrap; max-width: 68ch; }
details { margin: 18px 0; }
summary { cursor: pointer; color: var(--stamp); font-weight: 500; }

/* Таблицы админки и журнала */
table { border-collapse: collapse; }
table.plain td { padding: 6px 18px 6px 0; vertical-align: middle; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { border-top: 1px solid var(--ink); font-weight: 650; }
table.log { width: 100%; font-size: .875rem; }
table.log td { padding: 5px 12px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.scroll { overflow-x: auto; }
table.log td:nth-child(2), table.log td:nth-child(3) { white-space: nowrap; overflow-wrap: normal; }
table.log td:first-child { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Редактор фото */
#editor canvas { max-width: 100%; touch-action: none; cursor: crosshair; border-radius: 4px; display: block; background: var(--line); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }

@media (max-width: 560px) {
  main { padding: 20px 14px 96px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 10px; }
  .boxhead .code { font-size: 3rem; }
}

/* Главная: склад как стеллаж. Секции это места, на полках стоят ящики. */
.overview { margin-bottom: 28px; }
.overview h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 2px; }
.overview p { color: var(--muted); margin: 0 0 16px; font-variant-numeric: tabular-nums; }
.search { display: flex; gap: 8px; max-width: 640px; }
.search input { flex: 1 1 auto; padding: 11px 14px; font-size: 1.0625rem; }
.search button { padding: 11px 22px; }

.bay { margin: 28px 0 0; }
.bay .bay { margin: 18px 0 0 10px; padding-left: 20px; border-left: 2px solid var(--line); }
.bay h2, .bay h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 0 10px; }
.bay h2 { font-size: 1.375rem; font-weight: 750; letter-spacing: -.015em; }
.bay h3 { font-size: 1.0625rem; font-weight: 700; }
.bay h2 a, .bay h3 a { color: var(--ink); text-decoration: none; }
.bay h2 a:hover, .bay h3 a:hover { text-decoration: underline; }
.bay small { font-size: .9375rem; font-weight: 400; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.direct { margin: 0 0 10px; font-size: .9375rem; }

/* Полка: ящики стоят на доске, выровнены по низу */
.shelf { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 0 10px; border-bottom: 7px solid var(--line); border-radius: 0 0 3px 3px; }
.shelf.loose { margin-top: 4px; }
.crate { display: grid; grid-template-rows: auto auto 1fr auto; align-content: start; gap: 2px; width: 196px; min-height: 148px; padding: 10px 14px 12px; color: var(--ink); text-decoration: none; background: var(--sheet); border-radius: 4px 4px 0 0; }
.crate:hover { transform: translateY(-3px); transition: transform .12s ease-out; }
.crate .code { font-family: "Pangolin", "Golos Text", cursive; font-size: 2.25rem; line-height: 1; letter-spacing: .02em; }
.crate .ttl { font-weight: 600; font-size: .9375rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.crate .load { margin-left: 0; font-size: .8125rem; font-variant-numeric: tabular-nums; opacity: .8; }
.crate.kraft { color: var(--kraft-ink); background: var(--kraft) repeating-linear-gradient(90deg, rgb(0 0 0 / .16) 0 2px, transparent 2px 5px) top / 100% 5px no-repeat; padding-top: 14px; }
.crate.pile { width: 240px; outline: 2px dashed var(--muted); outline-offset: -2px; background: transparent; }
.peek { display: flex; gap: 5px; align-items: flex-end; margin: 8px 0 6px; min-height: 58px; }
.peek img { width: 44px; height: 58px; object-fit: cover; border-radius: 2px; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.peek.empty { align-items: center; font-size: .875rem; opacity: .65; }

.pager { display: flex; align-items: center; gap: 16px; margin: 28px 0 0; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .crate:hover { transform: none; transition: none; } }
@media (max-width: 560px) {
  .overview h1 { font-size: 1.75rem; }
  .crate { width: calc(50% - 7px); min-height: 136px; }
  .crate.pile { width: 100%; }
  .bay .bay { margin-left: 2px; padding-left: 12px; }
}

/* Списки и выбор галочками */
.slot { position: relative; display: flex; }
.slot input[type="checkbox"], .card input[type="checkbox"] { position: absolute; top: 7px; right: 7px; left: auto; }
.card input[type="checkbox"] { left: 7px; right: auto; }
.slot input[type="checkbox"] { width: 26px; height: 26px; margin: 0; padding: 0; appearance: none; cursor: pointer; border: 2px solid #fff; border-radius: 6px; background: rgb(23 32 43 / .35); box-shadow: 0 1px 4px rgb(0 0 0 / .35); }
.slot input[type="checkbox"]:checked { background: var(--stamp) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 18px no-repeat; border-color: var(--stamp); }
.slot:has(input:checked) .crate { outline: 3px solid var(--stamp); outline-offset: 2px; }
.bulk .act { display: flex; flex: 1 1 320px; gap: 8px; min-width: 0; }
.bulk .act select, .bulk .act input { flex: 1 1 120px; min-width: 0; }
.addone { display: flex; flex-wrap: wrap; gap: 8px; margin: 1rem 0; max-width: 480px; }
.addone select, .addone input { flex: 1 1 160px; }
.lists { list-style: none; padding: 0; margin: 0 0 20px; max-width: 640px; }
.lists li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px dotted var(--muted); }
.lists a { font-weight: 650; font-size: 1.0625rem; }
.lists .load { margin: 0; white-space: nowrap; }
.newlist { max-width: 640px; }
.newlist input { flex: 1 1 240px; }
[hidden] { display: none !important; }

/* Страница вещи: соседи по контейнеру, цепочка места, листание фото */
.itemnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 20px; }
.itemnav small { margin-left: 8px; }
.button.off { opacity: .35; cursor: default; }
.button.off:hover { border-color: var(--line); }
.where { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.where i { font-style: normal; color: var(--muted); }
.where a:not(.tag) { color: var(--ink); }
.gallery { width: 100%; }
.stage { position: relative; display: grid; place-items: center; background: #0a0e12; border-radius: 6px; overflow: hidden; min-height: 320px; }
.shotbig { display: block; }
.shotbig[hidden] { display: none; }
.shotbig img { display: block; width: auto; height: auto; max-width: 100%; max-height: 76vh; }
.garrow { position: absolute; top: 50%; width: 44px; height: 64px; margin-top: -32px; padding: 0; border: 0; border-radius: 6px; background: rgb(15 20 25 / .6); cursor: pointer; }
.garrow:hover { background: rgb(15 20 25 / .9); border-color: transparent; }
.garrow::before { content: ""; position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; border: solid #fff; border-width: 0 0 3px 3px; transform: translate(-30%, -50%) rotate(45deg); }
.garrow.prev { left: 8px; }
.garrow.next { right: 8px; }
.garrow.next::before { transform: translate(-70%, -50%) rotate(-135deg); }
.gcount { position: absolute; right: 10px; bottom: 10px; padding: 2px 9px; border-radius: 999px; background: rgb(15 20 25 / .75); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.gthumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gthumbs button { padding: 0; width: 58px; height: 76px; border: 2px solid transparent; border-radius: 4px; overflow: hidden; background: var(--sheet); cursor: pointer; opacity: .6; }
.gthumbs button:hover, .gthumbs button.on { opacity: 1; }
.gthumbs button.on { border-color: var(--kraft); }
.gthumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcap { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: .875rem; color: var(--muted); }
.gcap[hidden] { display: none; }
