/* «Образы» */
:root {
  --bg: #f5f3ef; --card: #fff; --tile: #ebe7e0; --board: #efebe4; --fg: #1d1d1f; --muted: #79746c; --line: #e2ddd4;
  --accent: #1d1d1f; --accent-fg: #fff; --hl: #b5651d; --danger: #b3261e; --ok: #2e7d4f; --hint: #fbf1e3;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --navh: 62px; --maxw: 860px;
}
[data-theme=dark] {
  --bg: #151515; --card: #1f1f1f; --tile: #2b2926; --board: #2b2926; --fg: #ece9e4; --muted: #9c978f; --line: #302e2b;
  --accent: #ece9e4; --accent-fg: #151515; --hl: #d9934f; --danger: #ef6b5f; --ok: #63b98a; --hint: #2d261d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
#app { height: 100%; }
.boot { height: 100%; display: flex; align-items: center; justify-content: center; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--hl); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 4px 14px; }
.link { color: var(--hl); font-weight: 500; padding: 4px 2px; }

.ic { display: inline-flex; width: 22px; height: 22px; flex: none; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* кнопки, поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 9px 15px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-t { color: var(--danger); }
.btn.done { color: var(--ok); border-color: var(--ok); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.wide { flex: 1; }
.btn:disabled { opacity: 0.45; }
.icon-btn { min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 20px; position: relative; }
.icon-btn.small { min-width: 32px; height: 32px; }
.icon-btn.small .ic { width: 18px; height: 18px; }
.icon-btn:active { background: rgba(127, 127, 127, 0.16); }
.icon-btn.on { color: var(--hl); }
.icon-btn.fav .ic svg { fill: var(--hl); }
.badge-n { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--hl); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); font: inherit; outline: none; }
.input:focus { border-color: var(--hl); }
.input.big { font-size: 17px; font-weight: 500; }
.input.qty { width: 90px; }
.input.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
textarea.input { resize: vertical; }
.row-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.row-btns.left { justify-content: flex-start; }
.row-btns.compact { margin-top: 6px; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form.pad { padding: 12px 14px 40px; }
.lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.check { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check input, .pline input, .gcheck { width: 20px; height: 20px; accent-color: var(--hl); flex: none; }
.check.opt { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.inline-f { display: flex; align-items: center; gap: 12px; }
.inline-f .lbl { margin: 0; }

/* чипы */
.chips { display: flex; gap: 6px; }
.chips.wrap { flex-wrap: wrap; }
.chips.scroll { overflow-x: auto; scrollbar-width: none; padding: 2px 12px 8px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 13px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.cdot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; }
.cdot.big { width: 26px; height: 26px; margin: 0; }
.cdot.light { box-shadow: inset 0 0 0 1px #c9c4ba; }
.colors { display: flex; flex-wrap: wrap; gap: 6px; }
.cbtn { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid transparent; }
.cbtn.on { border-color: var(--hl); }

/* каркас */
.shell { height: 100%; display: flex; flex-direction: column; max-width: var(--maxw); margin: 0 auto; position: relative; }
.bar { display: flex; align-items: center; gap: 2px; padding: calc(6px + var(--safe-top)) 6px 4px 14px; background: var(--bg); z-index: 5; min-height: 52px; }
.bar > .icon-btn:first-child { margin-left: -8px; }
.bar-title { font-weight: 650; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar-sp { flex: 1; }
.search-in { flex: 1; min-width: 0; max-width: 360px; padding: 8px 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; outline: none; margin-left: 8px; }
.sync-state { display: inline-flex; align-items: center; padding: 0 6px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #48b06a; opacity: 0.8; }
.sync-state.busy .sync-dot, .sync-state.wait .sync-dot { background: #e2b33a; animation: pulse 0.8s ease-in-out infinite alternate; }
.sync-state.err .sync-dot { background: #e2554a; }
@keyframes pulse { to { opacity: 0.25; } }
.subbar { background: var(--bg); }
.page { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(40px + var(--safe-bottom)); }
.page.with-nav { padding-bottom: calc(var(--navh) + 90px + var(--safe-bottom)); }
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, var(--maxw)); display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom); z-index: 6; }
.nav-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; font-size: 11.5px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav-tab .ic { width: 25px; height: 25px; }
.nav-tab.on { color: var(--fg); }
.nav-tab.on .ic svg { stroke-width: 2.1; }
.fab { position: fixed; right: max(16px, calc(50% - var(--maxw) / 2 + 16px)); bottom: calc(var(--navh) + 16px + var(--safe-bottom)); width: 56px; height: 56px; border-radius: 28px;
  background: var(--accent); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22); z-index: 6; }
.fab .ic { width: 28px; height: 28px; }

.tabs { display: flex; gap: 4px; padding: 0 12px 8px; }
.tab { flex: 1; padding: 8px 6px; border-radius: 12px; font-weight: 500; color: var(--muted); background: transparent; border: 1px solid transparent; }
.tab.on { color: var(--fg); background: var(--card); border-color: var(--line); }
.seg { display: inline-flex; background: var(--tile); border-radius: 12px; padding: 3px; }
.seg button { padding: 7px 16px; border-radius: 9px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.seg button .ic { width: 18px; height: 18px; }
.seg button.on { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* сетка вещей */
.sec { display: flex; align-items: center; gap: 8px; margin: 18px 14px 8px; font-weight: 650; font-size: 15px; }
.sec-n { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--tile); border-radius: 10px; padding: 1px 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px 10px; padding: 0 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); } }
.tile { display: block; text-decoration: none; position: relative; min-width: 0; text-align: left; }
.thumb { aspect-ratio: 1; background: var(--tile); border-radius: 16px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { max-width: 88%; max-height: 88%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.13)); -webkit-user-drag: none; user-select: none; }
.thumb.empty { color: var(--muted); }
.thumb.empty .ic { width: 30px; height: 30px; opacity: 0.5; }
.tile-t { font-size: 12.5px; line-height: 1.25; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-s { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tag { position: absolute; font-size: 10.5px; font-weight: 600; border-radius: 8px; padding: 1px 6px; }
.tag.st { top: 6px; left: 6px; background: rgba(40, 36, 30, 0.72); color: #fff; }
.tag.re { top: 5px; right: 5px; background: rgba(181, 101, 29, 0.9); color: #fff; padding: 2px 3px; }
.tag.re .ic { width: 14px; height: 14px; }
.tag.inline { position: static; display: inline-block; }
.tile.st-worn .thumb img, .tile.st-gone .thumb img { filter: grayscale(0.55) opacity(0.75); }
.tile.added .thumb { box-shadow: inset 0 0 0 2px var(--hl); }
.foot { text-align: center; padding: 18px; font-size: 13px; }
.active-f { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 14px 6px; font-size: 13.5px; }
.empty { text-align: center; color: var(--fg); padding: 50px 26px; }
.empty p { margin: 8px 0; }
.empty-ic .ic { width: 54px; height: 54px; color: var(--muted); opacity: 0.6; }

/* карточка вещи */
.hero { background: var(--tile); display: flex; align-items: center; justify-content: center; height: min(56vh, 100vw); margin: 0 12px; border-radius: 22px; overflow: hidden; }
.hero img { max-width: 90%; max-height: 90%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.16)); }
.hero-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.hero-empty .ic { width: 48px; height: 48px; }
.card { background: var(--card); margin: 12px; border-radius: 18px; padding: 14px; display: block; text-decoration: none; text-align: left; width: calc(100% - 24px); }
.item-t { font-size: 21px; margin: 0 0 8px; line-height: 1.25; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; margin: 4px 0; }
.with-dot { display: inline-flex; align-items: center; }
.note { white-space: pre-wrap; margin: 10px 0 0; }
.stat { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* форма вещи */
.ph-box { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ph-prev { width: 220px; height: 220px; background: var(--tile); border-radius: 18px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ph-prev img { max-width: 90%; max-height: 90%; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15)); }
.ph-prev.empty { flex-direction: column; gap: 6px; color: var(--muted); }
.ph-prev.empty .ic { width: 40px; height: 40px; opacity: 0.6; }
.ph-prev.small { width: 130px; height: 130px; flex: none; }
.ph-row { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; }
.ph-busy { width: 220px; height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.hint { background: var(--hint); border-left: 3px solid var(--hl); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }

/* образы */
.grid.looks { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
.lcard { display: block; text-decoration: none; min-width: 0; }
.lcover { aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; background: var(--board); }
.lcover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lcard-t { font-weight: 600; font-size: 14px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard-t .fav { color: var(--hl); }
.lcard-s { font-size: 12px; color: var(--muted); }

.board { position: relative; aspect-ratio: 4 / 5; background: var(--board); border-radius: 20px; overflow: hidden; width: 100%; }
.board.mini { border-radius: 18px; }
.bi { position: absolute; transform: translate(-50%, -50%); user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.16)); }
.bi.noph, .bi.gone { background: var(--card); border-radius: 10px; padding: 8px; font-size: 12px; text-align: center; color: var(--muted); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.board-wrap { padding: 6px 12px; display: flex; justify-content: center; }
.board-wrap.view .board { max-width: 520px; }
.board.edit.preview { height: min(43vh, calc((100vw - 24px) * 1.25)); width: auto; max-width: 100%; }
.board.edit.live { max-width: 560px; touch-action: none; cursor: grab; }
.board.edit.live .bi.sel { outline: 2px dashed var(--hl); outline-offset: 3px; z-index: 99 !important; }
.board-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; color: var(--muted); font-size: 14px; }
.btop { display: flex; justify-content: center; padding: 2px 12px 4px; }
.bpanel { padding-bottom: 30px; }
.bfilter { display: flex; align-items: center; gap: 6px; padding: 6px 0 0; }
.bfilter .chips.scroll { flex: 1; padding-right: 4px; }
.btn.dice { margin-right: 12px; margin-bottom: 8px; flex: none; }
.prow { margin: 4px 0 2px; }
.prow-h { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px; font-size: 14px; }
.prow-sel { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pscroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; scroll-snap-type: x proximity; }
.pscroll::-webkit-scrollbar { display: none; }
.pt { flex: none; width: 78px; height: 78px; border-radius: 16px; border: 2px solid transparent; background: var(--tile); scroll-snap-align: start; padding: 0; overflow: hidden; }
.pt .thumb { width: 100%; height: 100%; border-radius: 13px; }
.pt.on { border-color: var(--hl); box-shadow: 0 0 0 2px rgba(181, 101, 29, 0.18); }
.pt.none { font-size: 22px; color: var(--muted); }
.pt-empty { color: var(--muted); font-size: 13px; padding: 26px 4px; white-space: nowrap; }
.tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 8px 12px 0; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 12px; }
.tool:disabled { opacity: 0.4; }
.tools-hint { padding: 8px 14px 0; font-size: 13px; }
.bpanel .row-btns { padding: 0 12px; }
.grid.pick { padding: 4px 0 20px; }

/* снаряжение */
.gbar { display: flex; gap: 14px; padding: 0 14px 6px; font-size: 14px; }
.gtree { background: var(--card); margin: 0 12px; border-radius: 16px; overflow: hidden; }
.gtree.picker { margin: 0; }
.gnode { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 10px 10px 8px; border-bottom: 1px solid var(--line); min-height: 48px; cursor: pointer; }
.gnode:last-child { border-bottom: 0; }
.gnode.cur { background: var(--hint); }
.gchev { width: 18px; height: 18px; flex: none; color: var(--muted); transition: transform 0.15s; }
.gchev .ic { width: 18px; height: 18px; }
.gchev.open { transform: rotate(90deg); }
.gchev.none { visibility: hidden; }
.gicon { width: 20px; height: 20px; flex: none; color: var(--muted); }
.gicon .ic { width: 20px; height: 20px; }
.gicon.place { color: var(--hl); }
.gmain { flex: 1; min-width: 0; }
.gtitle { font-size: 14.5px; line-height: 1.3; word-break: break-word; }
.gnode.place > .gmain > .gtitle { font-weight: 600; }
.gnode.todo .gtitle { color: var(--hl); }
.gnode.todo.done .gtitle { color: var(--muted); text-decoration: line-through; }
.gq { color: var(--muted); font-weight: 600; }
.gn { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.gpath { font-size: 11.5px; color: var(--muted); margin-bottom: 1px; }
.gtags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.gtag { font-size: 11px; font-weight: 600; border-radius: 7px; padding: 1px 7px; background: var(--tile); color: var(--fg); }
.gtag.t-база, .chip.t-база.on { background: #2e7d4f; color: #fff; border-color: #2e7d4f; }
.gtag.t-полный, .chip.t-полный.on { background: #2f5ea8; color: #fff; border-color: #2f5ea8; }
.gtag.t-ремонт, .chip.t-ремонт.on { background: #c8742a; color: #fff; border-color: #c8742a; }
.gtag.t-некондиция, .chip.t-некондиция.on { background: #7d776e; color: #fff; border-color: #7d776e; }
.gtag.t-продать, .chip.t-продать.on { background: #7a4aa3; color: #fff; border-color: #7a4aa3; }
.gph { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: var(--tile); flex: none; padding: 2px; }
.gadd { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 9px 12px; color: var(--muted); font-size: 13.5px; border-bottom: 1px solid var(--line); }
.gadd .ic { width: 16px; height: 16px; }
.btn.where { justify-content: flex-start; white-space: normal; text-align: left; font-weight: 500; }
.kit { background: var(--card); margin: 8px 12px; border-radius: 16px; overflow: hidden; }
.kit-h { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px; text-align: left; }
.kit-h b { flex: 1; }
.kit-body { padding: 0 0 12px; }
.kit-body .gtree { margin: 0; border-radius: 0; border-top: 1px solid var(--line); }
.kit-body .row-btns { padding: 0 14px; }
.card.tpl { display: block; }
.card.pack .pack-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.progress { height: 6px; border-radius: 3px; background: var(--tile); overflow: hidden; margin: 8px 0 6px; }
.progress.big { height: 10px; border-radius: 5px; }
.progress-in { height: 100%; background: var(--ok); border-radius: inherit; transition: width 0.2s; }
.pack-top { padding: 4px 14px 0; }
.pack-n { font-weight: 600; }
.pack-list { background: var(--card); margin: 0 12px; border-radius: 16px; overflow: hidden; }
.pline { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pline-t { flex: 1; line-height: 1.35; }
.pline-w { display: block; font-size: 12px; color: var(--muted); }
.pline.on .pline-t { color: var(--muted); text-decoration: line-through; }

/* шторки, меню, уведомления */
.sheet-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.38); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 86vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up 0.18s ease-out; padding-bottom: var(--safe-bottom); }
.sheet.tall { max-height: 93vh; }
@keyframes up { from { transform: translateY(30px); opacity: 0.5; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 6px 6px 18px; }
.sheet-head b { flex: 1; font-size: 17px; line-height: 1.25; }
.sheet-body { overflow-y: auto; padding: 4px 16px 18px; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-sec { font-weight: 650; margin-top: 8px; }
.menu-list { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 6px; text-align: left; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.menu-item:last-child { border-bottom: 0; }
.menu-item.danger { color: var(--danger); }
.ver { margin-top: 14px; }
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--navh) + 84px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 40; pointer-events: none; }
.toast { pointer-events: auto; background: #2a2724; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; display: flex; align-items: center; gap: 12px; max-width: 92%; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); transition: opacity 0.3s, transform 0.3s; }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-btn { color: #f0b47a; font-weight: 600; }

/* вход */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login { width: 100%; max-width: 340px; background: var(--card); border-radius: 22px; padding: 28px 22px; display: flex; flex-direction: column; gap: 10px; text-align: center; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.06); }
.login h1 { margin: 0; font-size: 26px; }
.login-logo .ic { width: 52px; height: 52px; color: var(--hl); }
.login-sub { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; }
.login-err { color: var(--danger); min-height: 18px; font-size: 13px; }

@media (min-width: 900px) {
  .builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; }
  .builder .btop { grid-column: 1 / -1; }
  .builder .board.edit.preview { height: auto; width: 100%; }
  .builder .bpanel { overflow-y: auto; }
}

/* ИИ-образы */
.nav-tab span { white-space: nowrap; }
.aipage { display: flex; flex-direction: column; }
.wline { padding: 0 16px 6px; font-size: 13.5px; color: var(--muted); min-height: 20px; }
.swarea { position: relative; margin: 0 12px; height: min(calc(46vh + 190px), calc((100vw - 24px) * 1.25 + 190px)); max-height: 760px; }
.swcard { position: absolute; inset: 0; background: var(--card); border-radius: 24px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12); overflow: hidden;
  display: flex; flex-direction: column; touch-action: pan-y; user-select: none; will-change: transform; }
.swcard.next { transform: scale(0.95) translateY(10px); opacity: 0.7; pointer-events: none; }
.swcard.top { cursor: grab; }
.swboard { flex: 1; min-height: 0; padding: 10px 10px 0; display: flex; justify-content: center; }
.swboard .board { height: 100%; width: auto; max-width: 100%; aspect-ratio: 4 / 5; }
.swinfo { padding: 10px 16px 14px; }
.swtitle { font-weight: 650; font-size: 18px; }
.swmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.swchip { font-size: 12px; font-weight: 600; background: var(--tile); border-radius: 9px; padding: 2px 8px; }
.swwhy { margin: 0; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.swlist { display: none; position: absolute; inset: 0; background: var(--card); padding: 14px; overflow-y: auto; }
.swcard.details .swlist { display: block; }
.switem { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.switem .thumb { width: 56px; height: 56px; flex: none; border-radius: 12px; }
.swbadge { position: absolute; top: 22px; padding: 4px 12px; border: 3px solid; border-radius: 10px; font-weight: 800; font-size: 20px; letter-spacing: 0.06em; opacity: 0; pointer-events: none; background: rgba(255, 255, 255, 0.85); }
.swbadge.like { left: 18px; color: #2e7d4f; border-color: #2e7d4f; transform: rotate(-12deg); }
.swbadge.nope { right: 18px; color: #b3261e; border-color: #b3261e; transform: rotate(12deg); }
.swempty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: var(--card); border-radius: 24px; }
.swbtns { display: flex; justify-content: center; align-items: center; gap: 22px; padding: 14px 0 6px; }
.swbtn { width: 62px; height: 62px; border-radius: 50%; background: var(--card); box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14); display: flex; align-items: center; justify-content: center; }
.swbtn .ic { width: 30px; height: 30px; }
.swbtn.nope { color: #b3261e; }
.swbtn.like { color: #2e7d4f; }
.swbtn.like .ic svg { fill: rgba(46, 125, 79, 0.15); }
.swbtn.undo { width: 46px; height: 46px; color: var(--muted); }
.swbtn.undo .ic { width: 22px; height: 22px; }
.swbtn:disabled { opacity: 0.35; }
.swfoot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; padding: 4px 14px 10px; font-size: 13px; }
.swstate { color: var(--hl); font-weight: 600; }
.swstate.err { color: var(--danger); }
.rules { margin-top: 10px; font-size: 14px; }
.rules h3 { margin: 6px 0; font-size: 17px; }
.rules h4 { margin: 14px 0 4px; font-size: 15px; }
.rules ul { margin: 4px 0; padding-left: 20px; }
.rules li { margin: 3px 0; }
.wbanner { margin: 6px 12px 2px; padding: 10px 12px; background: var(--hint); border-radius: 14px; font-size: 13.5px; }
.wb-line { color: var(--muted); }
.wb-title { font-weight: 600; margin-top: 3px; }
.wb-why { margin-top: 2px; }

/* Что докупить */
a.tab { text-align: center; text-decoration: none; }
.tab-n { display: inline-block; margin-left: 5px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--hl); color: #fff; font-size: 11px; font-weight: 700; }
.audit-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.audit-sum { margin: 8px 0 10px; font-size: 14px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 14px; margin-top: 6px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.chk-i { width: 18px; text-align: center; color: var(--ok); }
.chk.gap .chk-i { color: #c8742a; }
.chk.gap .chk-l { font-weight: 600; }
.chk-l { flex: 1; }
.chk-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.shoptabs { padding-top: 4px; }
.card.shop .shop-h { display: flex; align-items: baseline; gap: 8px; }
.card.shop .shop-h b { font-size: 15.5px; line-height: 1.3; }
.prio { flex: none; font-size: 11px; font-weight: 700; border-radius: 8px; padding: 1px 7px; color: #fff; }
.prio.p1 { background: #c8742a; } .prio.p2 { background: #2f5ea8; } .prio.p3 { background: #7d776e; }
.shop-why { margin: 6px 0; font-size: 13.5px; color: var(--muted); }
.shop-repl { margin: 4px 0; font-size: 13.5px; }
.pair-row { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.pair { flex: none; width: 58px; }
.pair .thumb { border-radius: 12px; }
.shop-links { display: flex; gap: 10px; align-items: baseline; margin-top: 6px; font-size: 14px; }
.shop-links a { color: var(--hl); font-weight: 500; }
.row-btns.center { justify-content: center; align-items: center; }
.small-empty { padding: 26px 20px; }
