/* Хозблок — приложение (Operate): системный шрифт, сгруппированный фон, полупрозрачные системные панели (как в iOS),
   плоские кнопки и карточки без парящих теней, контраст текста ≥ 4,5:1 в обеих темах, цели касания ≥ 44 px. */
:root {
  --bg: #f2f1ee; --card: #ffffff; --card-2: #ebeae6; --line: rgba(60, 58, 50, .14); --sep: rgba(60, 58, 50, .16);
  --lift: 0 1px 2px rgba(40, 36, 24, .05), 0 6px 18px rgba(40, 36, 24, .06);     /* карточка «лежит» на фоне: смещение + мягкое размытие */
  --edge-line: 0 0 0 .5px rgba(60, 58, 50, .08);
  /* шкала ролей: заголовок экрана, название группы, название вещи, текст, пояснение, подпись */
  --t-display: 28px; --t-title: 20px; --t-name: 16px; --t-body: 17px; --t-note: 14px; --t-caption: 13px; --t-label: 15px;
  --text: #111114; --text-2: #545458; --text-3: #6c6c70;
  --accent: #0062cc; --accent-ink: #ffffff; --green: #1e7d36; --orange: #a14a00; --red: #c4281c;
  --seg-on: #ffffff; --chrome: rgba(243, 242, 239, .84);
  --float: 0 8px 28px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .06);   /* только для того, что парит: лист, панель ящиков, уведомление */
  --r: 18px; --r-ctl: 12px; --tile: 132px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --pad: 16px; --pad-l: max(var(--pad), var(--safe-l)); --pad-r: max(var(--pad), var(--safe-r));
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #1c1c1e; --card-2: #2c2c2e; --line: rgba(255, 255, 255, .1); --sep: rgba(255, 255, 255, .14);
  --text: #f2f2f7; --text-2: #aeaeb2; --text-3: #8e8e93;
  --accent: #4c9dff; --accent-ink: #ffffff; --green: #3cb46a; --orange: #ffa64d; --red: #ff6b5e;
  --seg-on: #55555a; --chrome: rgba(18, 18, 20, .8);
  --float: 0 10px 34px rgba(0, 0, 0, .6), 0 0 0 .5px rgba(255, 255, 255, .1);
  --lift: none; --edge-line: 0 0 0 1px rgba(255, 255, 255, .09);                  /* в темноте тень не видна — тонкая кромка */
}
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .boxtag.big, :root[data-theme="dark"] .boxpick button[aria-pressed="true"],
:root[data-theme="dark"] .shoot-btn { background: #0a6ad6; }
:root[data-theme="dark"] .badge:not(.muted-b) { background: #1e7d36; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 17px/1.4 system-ui, -apple-system, "SF Pro Text", sans-serif; min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h2, h3 { margin: 0; font: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
input, textarea { caret-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--text-3) transparent; }
h1, h2, h3, .empty b, .sheet h2, .group-head, .boxcard .ttl, .box-hero .ttl { text-wrap: balance; }
p, .hint, .empty, .drop span, .muted { text-wrap: pretty; }
/* зона касания 44 px у мелких элементов без раздувания их вида */
.chip::after, .seg button::after, .clear::after, .text-btn::after, .stepper button::after, .boxtag::after { content: ""; position: absolute; inset: -6px -2px; }
.chip, .seg button, .clear, .text-btn, .stepper button, .boxtag { position: relative; }

/* ── шапка ───────────────────────────────────────────────────────────────────── */
.bar { position: sticky; top: 0; z-index: 20; padding: calc(var(--safe-t) + 6px) var(--pad-r) 8px var(--pad-l);
  background: var(--chrome); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
.bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px; pointer-events: none;
  background: linear-gradient(var(--chrome), transparent); opacity: var(--edge, 0); transition: opacity .2s; }
.bar-row { display: flex; align-items: center; gap: 8px; min-height: 44px; }
h1 { margin: 0; font-size: var(--t-display); line-height: 1.15; letter-spacing: -.022em; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: flex; align-items: center; gap: 4px; color: var(--accent); margin-left: -6px; min-height: 44px; padding: 0 6px; font-size: 17px; }
.back:active { opacity: .45; }
.bar-actions { display: flex; gap: 2px; align-items: center; }
.text-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 8px; border-radius: 10px; color: var(--accent); font-weight: 600; font-size: 16px; }
.text-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { width: 40px; padding: 0; justify-content: center; }
.icon-btn svg { width: 22px; height: 22px; }
.aruco { shape-rendering: crispEdges; border-radius: 2px; }
.text-btn .aruco, .btn .aruco { fill: currentColor; stroke: none; }
.text-btn:active { opacity: .45; }
.search-row { margin-top: 6px; }
.search { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 6px 0 10px; border-radius: 11px; background: rgba(104, 100, 90, .12); color: var(--text-2); }
.search:focus-within { box-shadow: 0 0 0 3px var(--accent); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font-size: 17px; }
.search input::placeholder { color: var(--text-2); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.clear { width: 28px; height: 28px; border-radius: 14px; background: var(--text-3); color: var(--bg); font-size: 18px; line-height: 28px; }
.chips { display: flex; gap: 8px; margin: 8px calc(-1 * var(--pad-r)) 0 calc(-1 * var(--pad-l)); padding: 4px var(--pad-r) 4px var(--pad-l); overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.chips:empty { display: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 17px; background: var(--card); box-shadow: var(--edge-line); font-size: var(--t-label); font-weight: 500; display: inline-flex; align-items: center; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.chip:active { opacity: .7; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: rgba(118, 118, 128, .16); flex: none; }
.seg button { height: 30px; padding: 0 14px; border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--text); }

/* ── содержимое ─────────────────────────────────────────────────────────────── */
main { padding: 6px var(--pad-r) calc(var(--safe-b) + 108px) var(--pad-l); outline: none; }
.group { margin-top: 16px; }
.group-head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; font-size: var(--t-title); font-weight: 600; letter-spacing: -.012em; width: 100%; text-align: left; }
.group-head .count { font-size: var(--t-label); font-weight: 400; color: var(--text-3); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.sub-head { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 40px; padding: 6px 4px 0; font-size: var(--t-label); font-weight: 600; color: var(--text-2); text-align: left; }
.caret { width: 12px; height: 12px; flex: none; transition: transform .25s cubic-bezier(.32, .72, 0, 1); }
[aria-expanded="false"] > .caret { transform: rotate(-90deg); }
.section-h { font-size: 20px; font-weight: 700; margin: 22px 4px 8px; }
.empty { text-align: center; color: var(--text-2); padding: 56px 20px; max-width: 52ch; margin: 0 auto; }
.empty b { display: block; color: var(--text); font-size: var(--t-title); font-weight: 600; margin-bottom: 6px; }
.hint { font-size: var(--t-note); color: var(--text-2); padding: 0 4px; margin: 10px 0; max-width: 62ch; line-height: 1.45; }
.banner { background: var(--card-2); border-radius: 12px; padding: 10px 14px; font-size: 15px; margin: 8px 0; }
.warn { color: var(--orange); font-weight: 600; }

/* список */
.list { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--lift), var(--edge-line); }
.row-wrap { position: relative; overflow: hidden; }
.row-wrap + .row-wrap .row::before { content: ""; position: absolute; top: 0; left: 82px; right: 0; height: 1px; background: var(--sep); transform: scaleY(.5); }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 22px; font-weight: 600; color: #fff; }
.swipe-bg.left { background: var(--red); justify-content: flex-end; }
.row { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 12px; min-height: 74px; background: var(--card);
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; will-change: transform; cursor: pointer; }
.row:active, .tile:active { background: var(--card-2); }
.art { flex: none; width: 58px; height: 58px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.art { position: relative; }
.art svg { width: 100%; height: 100%; }
/* рисунок и фото вписаны в рамку при любой её форме (в листе рамка шире, чем выше) */
.art > .iso-svg, .art > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.art img { object-fit: cover; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 600; font-size: 16px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-spec { font-size: var(--t-note); color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.qty { font-size: var(--t-caption); color: var(--text-2); font-variant-numeric: tabular-nums; display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.boxtag { min-width: 44px; height: 28px; padding: 0 9px; border-radius: 8px; background: var(--card-2); font-weight: 700; font-size: 15px; color: var(--text);
  display: inline-flex; align-items: baseline; justify-content: center; gap: 2px; line-height: 28px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.boxtag small { font-weight: 500; font-size: 11px; color: var(--text-2); margin-right: 2px; }
.boxtag.big { height: 34px; line-height: 34px; min-width: 64px; font-size: 19px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.boxtag.big small { color: inherit; opacity: .9; }
a.boxtag:active { opacity: .6; }
.flag { color: var(--accent); font-size: 12px; font-weight: 700; }
.new-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--accent); flex: none; margin-right: 2px; }
.group.new .group-head .count { color: var(--accent); font-weight: 600; }
.state { font-size: 12px; font-weight: 700; }
.state.out { color: var(--text-2); }
.is-out .art, .is-out .row-name, .is-out .tile-name { opacity: .55; }

/* плитки */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr)); gap: 10px; }
.tile { position: relative; background: var(--card); box-shadow: var(--lift), var(--edge-line); border: 1px solid transparent; border-radius: var(--r); padding: 8px 8px 10px; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; will-change: transform; }
.tile .art { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; }
.tile-name { margin-top: 7px; font-size: var(--t-caption); font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 4px 6px; margin-top: 4px; font-size: 12px; color: var(--text-2); }
.tile-meta > span:first-child { display: flex; flex-wrap: wrap; gap: 0 6px; min-width: 0; line-height: 1.35; }
.tile-meta { flex-wrap: wrap; }
.tile-meta .boxtag { flex: none; margin-left: auto; }
.tile .boxtag { height: 26px; line-height: 26px; min-width: 40px; font-size: 13px; }

/* ящики */
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.boxcard { background: var(--card); box-shadow: var(--lift), var(--edge-line); border: 1px solid transparent; border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 132px; text-align: left; }
.boxcard:active { opacity: .75; }
.boxcard .num { font-size: 36px; font-weight: 700; letter-spacing: -.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.boxcard .ttl { font-weight: 600; font-size: var(--t-label); line-height: 1.25; }
.boxcard .cnt { margin-top: auto; font-size: var(--t-caption); color: var(--text-2); font-variant-numeric: tabular-nums; }
.boxcell { position: relative; display: grid; }
.box-del { position: absolute; top: -9px; left: -9px; width: 26px; height: 26px; border-radius: 13px; z-index: 2;
  background: var(--text-3); color: var(--bg); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg);
  animation: pop-in .22s cubic-bezier(.32, .72, 0, 1); }
.box-del::after { content: ""; position: absolute; inset: -9px; }
.box-del.hover-only { display: none; }
@media (hover: hover) and (pointer: fine) {   /* мышь: «−» показывается при наведении на ящик, без режима правки */
  .box-del.hover-only { display: grid; visibility: hidden; opacity: 0; animation: none; transition: opacity .15s, visibility 0s .15s; }
  .boxcell:hover .box-del.hover-only, .box-del.hover-only:focus-visible { visibility: visible; opacity: 1; transition-delay: 0s; }
}
.box-del svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.box-del:active { transform: scale(.9); }
@keyframes pop-in { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes jiggle { 0%, 100% { transform: rotate(-.8deg); } 50% { transform: rotate(.8deg); } }
.boxes.jiggle { padding-top: 6px; }
.boxes.jiggle .boxcell { animation: jiggle .36s cubic-bezier(.45, 0, .55, 1) infinite; animation-delay: var(--jd, 0s); transform-origin: 50% 60%; }
.boxcell.leaving { animation: none !important; transform: scale(.4); opacity: 0; transition: transform .22s cubic-bezier(.32, .72, 0, 1), opacity .18s; }
.boxcell .boxcard { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.boxcard.add { border: 1px dashed color-mix(in srgb, var(--text-3) 70%, transparent); box-shadow: none; color: var(--accent); background: transparent; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--green); color: #fff; align-self: flex-start; }
.badge.muted-b { background: var(--card-2); color: var(--text-2); }
.box-hero { display: flex; align-items: center; gap: 14px; background: var(--card); box-shadow: var(--lift), var(--edge-line); border-radius: var(--r); padding: 14px; margin: 8px 0; }
.box-hero .num { font-size: 44px; font-weight: 700; letter-spacing: -.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.box-hero .ttl { font-weight: 600; }
.box-hero-main { flex: 1; min-width: 0; }
.box-hero .num-edit { width: 2.1ch; min-width: 56px; padding: 0; border: 0; background: none; text-align: center; outline: 0; border-radius: 10px; }
.box-hero .num-edit:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.text-btn svg + * { margin-left: 0; }
.box-hero .ttl-edit { width: 100%; border: 0; background: none; padding: 2px 0; margin: -2px 0; font-size: var(--t-name); color: var(--text); outline: 0; border-bottom: 1px solid transparent; }
.box-hero .ttl-edit::placeholder { color: var(--text); opacity: 1; }           /* автоназвание выглядит как название, пока не начали печатать */
.box-hero .ttl-edit:focus { border-bottom-color: var(--accent); }
.box-hero .ttl-edit:focus::placeholder { color: var(--text-3); }
.hint-inline { color: var(--text-3); }
.box-hero.link { color: inherit; }
.box-hero.link:active { opacity: .7; }
.chev { margin-left: auto; font-size: 28px; color: var(--text-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.actions.center { justify-content: center; }
.btn { min-height: 44px; padding: 0 16px; border-radius: var(--r-ctl); background: var(--card-2); color: var(--accent); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; position: relative; overflow: hidden; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--red); }
.btn:active { opacity: .7; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.file { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.list.compact { margin: 6px 0; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 6px 14px; }
.line + .line { border-top: 1px solid var(--sep); }
.line > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
details.printer { margin: 8px 0 4px; }
details.printer summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; font-size: 15px; color: var(--text-2); cursor: pointer; }
details.printer summary::-webkit-details-marker { display: none; }
.dot { width: 9px; height: 9px; border-radius: 5px; flex: none; }
.dot.on { background: var(--green); } .dot.off { background: var(--orange); }

/* съёмка */
.shoot { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.picker { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); box-shadow: var(--lift), var(--edge-line); border-radius: var(--r); padding: 6px 6px 6px 14px; min-height: 56px; }
.select-btn { position: relative; color: var(--accent); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; padding: 0 10px; flex: none; }
.select-btn select { position: absolute; inset: 0; opacity: 0; font-size: 16px; }
.drop { display: grid; justify-items: center; text-align: center; gap: 8px; border-radius: 20px; background: var(--card); box-shadow: var(--lift), var(--edge-line); padding: 24px 18px; color: var(--text-2); }
.drop .big { width: 72px; height: 72px; border-radius: 36px; background: var(--card-2); display: grid; place-items: center; }
.drop .big svg { width: 34px; height: 34px; fill: none; stroke: var(--accent); stroke-width: 1.8; }
.drop strong { color: var(--text); font-size: 19px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.shot { display: block; width: 100%; padding: 0; position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card-2); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot span { position: absolute; left: 6px; bottom: 6px; font-size: 12px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: rgba(0, 0, 0, .66); color: #fff; }
.shot.err span { background: var(--red); }
.shot-full { width: 100%; border-radius: 12px; margin: 10px 0; display: block; }
.sheet-link { align-self: flex-start; }
.stepper { display: inline-flex; align-items: center; background: var(--card-2); border-radius: 10px; flex: none; }
.stepper button { width: 44px; height: 40px; font-size: 22px; color: var(--accent); }
.stepper button:active { opacity: .4; }
.stepper button[disabled] { opacity: .3; }
.stepper input { flex: none; width: 96px; min-height: 40px; border: 0; background: none; text-align: center; font-weight: 700; font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; outline: none; }
.stepper input:focus-visible { box-shadow: inset 0 -2px 0 var(--accent); }
.qty-picker { flex-wrap: wrap; gap: 8px 10px; }
.qty-picker > .muted { flex: none; }
.stepper output { min-width: 40px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── нижние вкладки ─────────────────────────────────────────────────────────── */
.tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: flex-end;
  padding: 6px var(--pad-r) calc(var(--safe-b) + 6px) var(--pad-l); background: var(--chrome); border-top: .5px solid var(--sep);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
.tab { flex: 1; max-width: 160px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; font-size: 12px; font-weight: 500; color: var(--text-3); }
.tab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.tab[aria-current="page"] { color: var(--accent); }
.tab:active { opacity: .5; }
.shoot-btn { width: 52px; height: 52px; margin-top: -22px; border-radius: 26px; background: var(--accent); display: grid; place-items: center; }
.tab-shoot svg { stroke: var(--accent-ink); }

/* ── выбор группы ──────────────────────────────────────────────────────────── */
.sel-toggle { flex: none; }
.selecting main { padding-bottom: calc(var(--safe-b) + 140px); }
.chips .sel-toggle[aria-pressed="true"] { color: var(--text); }
.pick { flex: none; width: 24px; height: 24px; border-radius: 12px; border: 1.5px solid var(--text-3); display: grid; place-items: center; background: var(--card); }
.tile .pick { position: absolute; z-index: 1; top: 12px; left: 12px; box-shadow: 0 0 0 2px var(--card); }
[aria-pressed="true"] > .pick { background: var(--accent); border-color: var(--accent); }
[aria-pressed="true"] > .pick::after { content: ""; width: 10px; height: 5px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.selecting .row[aria-pressed="true"], .selecting .tile[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.selecting .tile[aria-pressed="true"] { border-color: var(--accent); }
.selecting .boxtag { pointer-events: none; }
.selbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 6px var(--pad-r) calc(var(--safe-b) + 10px) var(--pad-l);
  background: var(--chrome); border-top: .5px solid var(--sep); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }
.selbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.selbar-row + .selbar-row { margin-top: 4px; }
.selbar-row .btn { flex: 1; }
#sel-count { font-weight: 600; font-size: 15px; text-align: center; flex: 1; }
.boxcard.folder { color: var(--text); }
.badge { font-size: 12px; }
.tabs .tab { font-size: 11px; letter-spacing: .01em; }
.folder-ico { width: 40px; height: 40px; fill: none; stroke: var(--text-2); stroke-width: 1.6; stroke-linejoin: round; }

/* ── перетаскивание ─────────────────────────────────────────────────────────── */

/* ── нижний лист ────────────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .32); opacity: 0; }
.sheet { position: fixed; z-index: 80; left: 0; right: 0; bottom: 0; max-height: 92dvh; display: flex; flex-direction: column; margin: 0 auto; max-width: 720px;
  background: var(--bg); border-radius: 14px 14px 0 0; box-shadow: var(--float); transform: translateY(100%); will-change: transform; }
.sheet:focus { outline: none; }
.sheet-top { position: relative; flex: none; height: 44px; touch-action: none; }
.grabber { position: absolute; inset: 0; display: grid; place-items: center; cursor: grab; }
.grabber::before { content: ""; width: 38px; height: 5px; border-radius: 3px; background: var(--text-3); }
.sheet-close { position: absolute; right: max(10px, var(--safe-r)); top: 4px; }
.sheet-body { overflow-y: auto; padding: 0 var(--pad-r) 20px var(--pad-l); overscroll-behavior: contain; }
.sheet-actions { flex: none; display: flex; gap: 10px; padding: 10px var(--pad-r) calc(var(--safe-b) + 10px) var(--pad-l); border-top: .5px solid var(--sep); background: var(--bg); }
.sheet-actions .btn { flex: 1; }
.sheet h2 { margin: 2px 0 2px; font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.018em; }
.figure { position: relative; border-radius: var(--r); background: var(--card); box-shadow: var(--lift), var(--edge-line); overflow: hidden; margin: 12px 0; }
.figure .art { width: 100%; height: auto; aspect-ratio: 1.25; border-radius: 0; max-height: 46dvh; }
.figure .seg { position: absolute; right: 10px; top: 10px; background: var(--chrome); }
.props { background: var(--card); box-shadow: var(--lift), var(--edge-line); border-radius: var(--r); overflow: hidden; }
.prop { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; font-size: var(--t-name); }
.prop + .prop { border-top: 1px solid var(--sep); }
.prop > span:first-child { color: var(--text-2); }
.prop > span:last-child { text-align: right; }
.section-title { font-size: var(--t-label); color: var(--text-2); font-weight: 600; margin: 20px 4px 6px; }
.status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.status button { min-height: 44px; border-radius: var(--r-ctl); background: var(--card); box-shadow: var(--edge-line); font-weight: 600; font-size: var(--t-label); }
.status button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }
.boxpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.boxpick button { height: 48px; border-radius: var(--r-ctl); background: var(--card); box-shadow: var(--lift), var(--edge-line); border: 0; font-weight: 700; font-size: 19px; font-variant-numeric: tabular-nums; }
.boxpick button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.props.edit { padding: 2px 14px; display: flex; flex-direction: column; }
.props.edit input, .props.edit textarea, .props.edit select { border: 0; outline: 0; background: none; font-size: 17px; padding: 11px 0; min-height: 44px; resize: none; color: var(--text); width: 100%; }
.props.edit > * + *, .spec + .spec { border-top: 1px solid var(--sep); }
.props.edit :focus-visible { outline: none; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.spec { display: grid; grid-template-columns: 2fr 3fr; gap: 10px; }
.spec .spec-k { color: var(--text-2); }
.picker input { flex: 1; min-width: 0; border: 0; background: none; font-size: 16px; min-height: 44px; color: var(--text); outline: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-size: 14px; color: var(--text-2); }
.field input, .field select { font-size: var(--t-body); min-height: 48px; padding: 0 14px; border-radius: var(--r-ctl); border: 0; box-shadow: var(--lift), var(--edge-line); background: var(--card); color: var(--text); }

.label-preview { display: block; width: 100%; max-width: 348px; height: auto; aspect-ratio: 58 / 40; margin: 10px auto; background: #fff;
  border-radius: 6px; box-shadow: var(--lift), 0 0 0 1px rgba(60, 58, 50, .18); image-rendering: auto; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: rgba(28, 28, 30, .94); color: #fff; padding: 8px 8px 8px 16px; border-radius: 14px; font-size: 15px; display: flex; gap: 10px; align-items: center;
  max-width: calc(100vw - 32px); min-height: 44px; box-shadow: var(--float); transition: transform .35s cubic-bezier(.32, .72, 0, 1), opacity .2s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { color: #8ec5ff; font-weight: 700; min-height: 36px; padding: 0 10px; white-space: nowrap; }

@media (hover: hover) {
  .row:hover, .tile:hover { background: var(--card-2); }
  .btn:hover, .chip:hover, .text-btn:hover { filter: brightness(.96); }
}
@media (min-width: 900px) {
  main { max-width: 1100px; margin: 0 auto; }
  .selbar { left: 50%; right: auto; transform: translateX(-50%); width: 560px; border-radius: 18px 18px 0 0; border: .5px solid var(--sep); border-bottom: 0; }
  .bar { padding-left: max(16px, calc(50vw - 534px)); padding-right: max(16px, calc(50vw - 534px)); }
  .tabs { left: 50%; right: auto; transform: translateX(-50%); width: 520px; border-radius: 18px 18px 0 0; border: .5px solid var(--sep); border-bottom: 0; }
  .sheet { max-height: 86dvh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } .boxes.jiggle .boxcell, .box-del { animation: none; } }
@media (prefers-reduced-transparency: reduce) {
  .bar, .tabs, .figure .seg { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .toast { background: #1c1c1e; }
}
