/* Монохром: чёрное на белом / белое на чёрном. Тема берётся из Telegram (или системы). */
:root {
  --bg: #ffffff; --surface: #ffffff; --soft: #f4f4f4; --text: #111111; --hint: #8c8c8c; --line: #e8e8e8; --line2: #dadada;
  --acc: #111111; --acc-text: #ffffff; --red: #d93025; --ph1: #eeeeee; --ph2: #e2e2e2; --toast: #111111; --toast-text: #fff;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #000000; --soft: #141414; --text: #f2f2f2; --hint: #7d7d7d; --line: #1f1f1f; --line2: #2e2e2e;
  --acc: #ffffff; --acc-text: #000000; --red: #ff6b5e; --ph1: #161616; --ph2: #202020; --toast: #f2f2f2; --toast-text: #000;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); }
body { margin: 0; font: 15px/1.38 -apple-system, "SF Pro Text", "Helvetica Neue", Roboto, Arial, sans-serif; color: var(--text);
  -webkit-font-smoothing: antialiased; }
#page { padding: 14px 16px 96px; min-height: 100vh; }
h2 { font-size: 26px; line-height: 1.1; font-weight: 650; letter-spacing: -.02em; margin: 6px 0 16px; }
h3 { font-size: 13px; margin: 20px 2px 8px; color: var(--hint); font-weight: 500; }
a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line2); }
svg.i { display: inline-block; vertical-align: -0.2em; flex: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.muted { color: var(--hint); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

/* совместимость со старыми именами */
:root, :root[data-theme="dark"] { --bg2: var(--soft); --green: var(--text); --orange: var(--text); --btn: var(--acc); --btn-text: var(--acc-text); }

/* нижнее меню */
#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg); border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
#tabs button { flex: 1; border: 0; background: none; color: var(--hint); padding: 4px 0; font: 500 10.5px/1.2 inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
#tabs button.on { color: var(--text); }
#tabs .dot { position: absolute; top: 0; left: calc(50% + 8px); min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  background: var(--acc); color: var(--acc-text); font-size: 10px; line-height: 16px; font-weight: 600; }

/* кнопки и поля */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 1px solid var(--acc); border-radius: 12px;
  padding: 14px; font: 600 16px/1.2 inherit; background: var(--acc); color: var(--acc-text); margin-top: 8px; text-align: center; text-decoration: none; }
.btn.green { background: var(--acc); color: var(--acc-text); }
.btn.sec { background: transparent; color: var(--text); border-color: var(--line2); font-weight: 500; }
.btn.red { background: transparent; color: var(--red); border-color: var(--red); }
.btn.small { display: inline-flex; width: auto; padding: 8px 12px; font-size: 14px; margin: 0; border-radius: 10px; }
.btn:disabled { opacity: .35; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: transparent; border: 1px solid var(--line2);
  border-radius: 12px; padding: 11px 12px; outline: none; }
input::placeholder { color: var(--hint); }
input:focus, select:focus, textarea:focus { border-color: var(--text); }
label.f { display: block; margin: 14px 2px 6px; font-size: 13px; color: var(--hint); }

/* чипы */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; border: 1px solid var(--line2); border-radius: 20px; padding: 7px 13px; background: transparent; color: var(--text);
  font: 14px/1.2 inherit; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--acc); color: var(--acc-text); border-color: var(--acc); }

/* каталог */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
.tile { position: relative; }
.tile .ph { aspect-ratio: 3/4; border-radius: 6px; background: linear-gradient(160deg, var(--ph1), var(--ph2)) center/cover no-repeat; }
.tile .info { padding: 8px 2px 0; }
.tile .price { font-weight: 650; font-size: 16px; }
.tile .t { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }
.grid.g3 .ph { aspect-ratio: 1; }
.grid.g3 .info, .grid.g3 .t { font-size: 12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  border: 1px solid var(--line2); color: var(--hint); background: var(--bg); }
.tile .badge { position: absolute; top: 6px; left: 6px; }
.st-sold { color: var(--text); border-color: var(--text); }
.st-in_transit, .st-purchased, .st-service, .st-gray { color: var(--text); }

/* статусы смены */
.sdot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; }
.sdot.on { background: var(--text); }
.sdot.off { border: 1.5px solid var(--hint); }

/* списки */
.li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .th { width: 46px; height: 58px; border-radius: 4px; background: linear-gradient(160deg, var(--ph1), var(--ph2)) center/cover; flex: none; }
.li input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: var(--acc); }
.li input.price { width: 96px; text-align: right; padding: 8px 10px; font-weight: 600; }

/* карточка вещи */
.gallery { display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; margin: -12px -14px 12px; border-radius: 12px 12px 0 0; }
.gallery img { height: 360px; max-width: 88%; object-fit: cover; scroll-snap-align: start; }
.gallery .noph { height: 120px; width: 100%; display: flex; align-items: center; justify-content: center; color: var(--hint); }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--hint); }
.kv span:last-child { text-align: right; }
.plus { color: var(--text); font-weight: 700; }
.minus { color: var(--red); font-weight: 700; }

.stat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat > div { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 19px; }

.search { display: flex; gap: 8px; margin-bottom: 10px; }
.iconbtn { flex: none; border: 0; border-radius: 12px; background: var(--acc); color: var(--acc-text); width: 46px;
  display: flex; align-items: center; justify-content: center; }

#toast { position: fixed; left: 16px; right: 16px; bottom: 84px; background: var(--toast); color: var(--toast-text); padding: 12px 14px;
  border-radius: 12px; font-size: 15px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; transform: none; }
.photos-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.photos-pick .th { width: 64px; height: 80px; border-radius: 6px; background: var(--soft) center/cover; }
.photos-pick label { width: 64px; height: 80px; border-radius: 6px; border: 1px dashed var(--line2); display: flex; align-items: center;
  justify-content: center; color: var(--hint); }
.empty { text-align: center; color: var(--hint); padding: 32px 10px; }
.chev { color: var(--hint); display: inline-flex; }

/* выбор плиток: нажатие или свайп (вбок, потом вниз) */
.sgrid { touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.stile { position: relative; cursor: pointer; }
.stile .ph { transition: opacity .12s; }
.stile .ck { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 12px; border: 1.5px solid #fff;
  background: rgba(0,0,0,.18); display: flex; align-items: center; justify-content: center; color: transparent; }
.stile.on .ph { outline: 2.5px solid var(--acc); outline-offset: -2.5px; opacity: .82; }
.stile.on .ck { background: var(--acc); border-color: var(--acc); color: var(--acc-text); }
.srow { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.srow:last-child { border-bottom: 0; }
.srow .ck { position: static; flex: none; width: 22px; height: 22px; border-radius: 11px; border: 1.5px solid var(--line2);
  display: flex; align-items: center; justify-content: center; color: transparent; }
.srow.on .ck { background: var(--acc); border-color: var(--acc); color: var(--acc-text); }
.srow .th { width: 46px; height: 58px; border-radius: 4px; background: linear-gradient(160deg, var(--ph1), var(--ph2)) center/cover; flex: none; }
.selbar { position: sticky; bottom: 76px; padding-top: 6px; background: linear-gradient(transparent, var(--bg) 30%); }
.hint-swipe { font-size: 12px; color: var(--hint); margin: 2px 2px 10px; }

.stile .info > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tile .badge.pbadge { position: absolute; top: 6px; right: 6px; left: auto; bottom: auto; background: var(--acc); color: var(--acc-text); border-color: var(--acc); }
