/* Склад — интерфейс. Палитра «деним»: индиго, меловой фон, медь заклёпки для бирок размеров. */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --ink: #162036;
  --ink-2: #44516d;
  --muted: #6b7792;
  --line: #dde3ee;
  --denim: #2f4b8c;
  --denim-soft: #e3e9f6;
  --copper: #b8742a;
  --copper-soft: #f7ecdf;
  --danger: #c23a2b;
  --danger-soft: #fbe9e6;
  --ok: #2f7d45;
  --shadow: 0 1px 2px rgba(22, 32, 54, .06), 0 4px 14px rgba(22, 32, 54, .05);
  --radius-l: 18px;
  --radius-m: 12px;
  --radius-s: 8px;
  --tabbar-h: 64px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1422;
  --surface: #172036;
  --surface-2: #1d2742;
  --ink: #e8edf8;
  --ink-2: #c1cadf;
  --muted: #8f9bb8;
  --line: #2a3553;
  --denim: #8ea7ee;
  --denim-soft: #23305a;
  --copper: #e2a55c;
  --copper-soft: #3a2c1c;
  --danger: #f07a68;
  --danger-soft: #3c1f1d;
  --ok: #6cc286;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0e1422;
  --surface: #172036;
  --surface-2: #1d2742;
  --ink: #e8edf8;
  --ink-2: #c1cadf;
  --muted: #8f9bb8;
  --line: #2a3553;
  --denim: #8ea7ee;
  --denim-soft: #23305a;
  --copper: #e2a55c;
  --copper-soft: #3a2c1c;
  --danger: #f07a68;
  --danger-soft: #3c1f1d;
  --ok: #6cc286;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25);
  color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--denim); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------- каркас ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 0 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0 10px;
  background: var(--bg);
}
.topbar h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.topbar .sync { font-size: 12px; color: var(--muted); margin-top: 2px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.demo-note {
  font-size: 13px; color: var(--copper); background: var(--copper-soft);
  border-radius: var(--radius-s); padding: 8px 12px; margin-bottom: 10px;
}

/* ---------- нижние вкладки ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { display: flex; width: 100%; max-width: 760px; }
.tab {
  flex: 1; height: var(--tabbar-h); border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-selected="true"] { color: var(--denim); }

/* ---------- элементы управления ---------- */
.segmented {
  display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-m);
  background: var(--denim-soft); margin-bottom: 10px;
}
.segmented button {
  flex: 1; border: 0; background: none; padding: 7px 4px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.search {
  position: relative; margin-bottom: 10px;
}
.search input {
  width: 100%; height: 44px; border-radius: var(--radius-m);
  border: 1px solid var(--line); background: var(--surface);
  padding: 0 40px 0 40px; font-size: 15px;
}
.search input::placeholder { color: var(--muted); }
.search > svg { position: absolute; left: 13px; top: 13px; width: 18px; height: 18px; color: var(--muted); }
.search .clear { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); font-size: 20px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  display: inline-flex; gap: 6px; align-items: center;
}
.chip .n { color: var(--muted); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip[aria-pressed="true"] .n { color: color-mix(in srgb, var(--surface) 70%, transparent); }

.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.error-box {
  background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-m);
  padding: 14px 16px; margin: 12px 0; font-size: 14px;
}
.error-box button { margin-top: 10px; border: 0; background: var(--danger); color: #fff; border-radius: var(--radius-s); padding: 7px 14px; font-weight: 600; }
.skeleton { height: 128px; border-radius: var(--radius-l); background: var(--surface); margin-bottom: 10px; opacity: .6; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- бирка размера — главный элемент ---------- */
.size-tag {
  flex: none; position: relative;
  min-width: 58px; height: 64px; padding: 0 8px;
  display: grid; place-items: center;
  background: var(--copper-soft); color: var(--copper);
  border-radius: 10px;
  font-weight: 800; font-size: 22px; letter-spacing: -.02em; line-height: 1;
}
.size-tag::after {
  content: ""; position: absolute; inset: 4px;
  border: 1.5px dashed color-mix(in srgb, var(--copper) 55%, transparent);
  border-radius: 7px; pointer-events: none;
}
.size-tag.long { font-size: 16px; }
.size-tag.small { min-width: 44px; height: 46px; font-size: 17px; border-radius: 8px; }
.size-tag.small::after { inset: 3px; border-radius: 6px; }

/* ---------- заказы ---------- */
.day-head { font-size: 13px; font-weight: 700; color: var(--muted); margin: 14px 2px 8px; display: flex; justify-content: space-between; }
.order {
  background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow);
  margin-bottom: 10px; overflow: hidden;
}
.order-main { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 14px 14px 12px; }
.order-items { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; }
.item-text { min-width: 0; }
.item-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.item-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.order-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--ink-2); min-width: 0; }
.status i { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--st, var(--muted)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st, var(--muted)) 22%, transparent); }
.payout { text-align: right; }
.payout b { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.payout small { display: block; font-size: 11px; color: var(--muted); }
.ship { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.copy {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-s);
  padding: 4px 8px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
}
.copy span { color: var(--muted); }
.copy b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.order-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.order-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-details { border-top: 1px dashed var(--line); padding: 10px 14px 14px; font-size: 14px; }
.kv { display: grid; grid-template-columns: 128px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.kv a { color: var(--denim); }
.profit-pos { color: var(--ok); font-weight: 700; }
.profit-neg { color: var(--danger); font-weight: 700; }

/* ---------- склад ---------- */
.stock-hero {
  background: var(--denim); color: #fff; border-radius: var(--radius-l);
  padding: 18px 18px 16px; margin-bottom: 12px;
}
:root[data-theme="dark"] .stock-hero { background: #263a73; }
.stock-hero .row { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-end; }
.stock-hero .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.stock-hero .lbl { font-size: 13px; opacity: .8; margin-top: 3px; }
.stock-hero .minor { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.18); font-size: 13px; }
.stock-hero .minor b { font-weight: 800; }
.stock-hero .minor span { opacity: .85; }

.group { margin-bottom: 18px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 6px 2px 8px; }
.group-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.group-head .sum { font-size: 13px; color: var(--muted); text-align: right; }
.group-head .sum b { color: var(--ink); }
.size-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 2px 10px; }
.size-strip span { font-size: 12px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.size-strip b { font-weight: 800; }

.model {
  background: var(--surface); border-radius: var(--radius-m); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 8px;
}
.model-top { display: flex; justify-content: space-between; gap: 12px; }
.model-name { font-weight: 700; line-height: 1.3; }
.model-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.model-qty { text-align: right; flex: none; }
.model-qty b { font-size: 18px; font-weight: 800; }
.model-qty small { display: block; font-size: 12px; color: var(--muted); }
.sizes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sz {
  min-width: 52px; border-radius: 8px; padding: 4px 8px 5px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line);
}
.sz .s { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.sz .q { display: block; font-size: 16px; font-weight: 800; line-height: 1.15; }
.sz .r { display: block; font-size: 10.5px; color: var(--copper); font-weight: 700; }
.sz.low { background: var(--copper-soft); border-color: color-mix(in srgb, var(--copper) 40%, transparent); }
.sz.zero { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.sz.zero .q { color: var(--danger); }

/* ---------- аналитика ---------- */
.hero-metric { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 16px 16px 14px; margin-bottom: 10px; }
.hero-metric .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.hero-metric .big { font-size: 34px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; margin-top: 2px; }
.delta { display: inline-block; font-size: 13px; font-weight: 700; margin-top: 4px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta small { color: var(--muted); font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface); border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 12px 14px; }
.tile .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tile .val { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; }
.tile .delta { margin-top: 0; font-size: 12px; }

.card { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 14px 16px 16px; margin-bottom: 10px; }
.card h3 { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.readout { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); min-height: 38px; }
.readout b { color: var(--ink); font-size: 15px; }
.chart svg { display: block; width: 100%; height: 150px; touch-action: pan-y; }
.axis-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.chart .bar { fill: var(--denim); }
.chart .bar.dim { fill: color-mix(in srgb, var(--denim) 45%, var(--surface)); }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }

.hbar { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin-bottom: 10px; }
.hbar .name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.hbar .num { font-size: 13px; color: var(--ink-2); text-align: right; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 4px; background: var(--denim); }
.hbar .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

.size-bars { display: flex; gap: 6px; align-items: flex-end; height: 140px; padding-top: 18px; }
.size-bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.size-bars .v { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.size-bars .b { width: 100%; max-width: 44px; background: var(--copper); border-radius: 4px 4px 0 0; min-height: 2px; }
.size-bars .s { font-size: 12px; font-weight: 700; color: var(--muted); }

.status-list { display: flex; flex-direction: column; gap: 8px; }
.status-list .row { display: flex; justify-content: space-between; font-size: 14px; }

.rates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

/* ---------- вход ---------- */
.login { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 14px; padding: 24px; }
.login h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login p { margin: 0; color: var(--muted); max-width: 340px; }
.login .size-tag { margin-bottom: 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px); opacity: 0;
  background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- заказы: крупно имя и трек (для упаковки), период по датам ---------- */
.segmented.periods { flex-wrap: wrap; }
.segmented.periods button { flex: 1 0 22%; padding: 7px 2px; }
.daterange { display: flex; gap: 8px; margin-bottom: 10px; }
.daterange label { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 0 10px; height: 44px; }
.daterange input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; }
.work-head { margin: 4px 2px 0; font-size: 14px; color: var(--ink-2); }
.work-head b { font-size: 18px; color: var(--ink); }

.who { font-size: 20px; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; margin-bottom: 8px; overflow-wrap: anywhere; }
.track-big {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-m);
  padding: 9px 12px; margin-bottom: 12px; font-size: 14px; color: var(--ink);
}
.track-big .dl { color: var(--muted); font-size: 12px; font-weight: 700; flex: none; max-width: 38%; }
.track-big b { flex: 1; min-width: 0; font-size: 19px; font-weight: 800; letter-spacing: .02em; overflow-wrap: anywhere; }
.track-big svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.track-big.none b { color: var(--muted); font-size: 15px; font-weight: 600; letter-spacing: 0; }
.order-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.order-foot .acc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy.sm { padding: 2px 7px; font-size: 12px; }

/* ---------- аналитика: размеры у лучших моделей ---------- */
.msizes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.msz { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.msz b { font-weight: 800; color: var(--ink); }
.msz.top { background: var(--copper-soft); border-color: color-mix(in srgb, var(--copper) 40%, transparent); }
.more { width: 100%; margin-top: 4px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
  border-radius: var(--radius-m); padding: 9px; font-size: 13px; font-weight: 700; }

/* последние 4 символа трека: крупнее и в аккуратной рамке */
.t4 {
  display: inline-block; margin-left: .22em; padding: 0 .38em; white-space: nowrap;
  font-size: 1.22em; line-height: 1.25; letter-spacing: .05em;
  border: 1.5px solid color-mix(in srgb, var(--copper) 70%, transparent); border-radius: 7px;
  background: var(--copper-soft); color: var(--ink);
}
.track-big b { overflow-wrap: normal; word-break: break-all; }
.track-big .t4 { word-break: normal; }
/* служба доставки — маленькой строкой над треком, чтобы трек поместился в одну строку */
.track-big { flex-wrap: wrap; row-gap: 3px; padding: 8px 12px 9px; }
.track-big .dl { flex: 1 0 100%; max-width: 100%; }
.track-big b { white-space: nowrap; word-break: normal; overflow-wrap: normal; }
@media (max-width: 340px) { .track-big b { font-size: 17px; } }

/* ---------- фото товара ---------- */
.photo { flex: none; width: 52px; height: 64px; padding: 0; overflow: hidden; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .2s; }
.photo img[src] { opacity: 1; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8, 12, 20, .84); display: grid; place-items: center; padding: 16px; }
.lb-card { position: relative; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb-card img { max-width: 100%; max-height: calc(100vh - 140px); min-width: 120px; min-height: 120px; object-fit: contain; border-radius: 14px; background: var(--surface); }
.lb-title { color: #fff; font-weight: 700; text-align: center; max-width: 90vw; }
.lb-close { position: absolute; top: -10px; right: -10px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--ink); font-size: 22px; box-shadow: var(--shadow); }

/* фото модели в «Складе» */
.model-top .photo { width: 48px; height: 60px; }
.model-info { flex: 1; min-width: 0; }

/* фото целиком: форма рамки по форме фото (ширина = высота × --pr), без обрезки */
.photo { --ph: 76px; --pr: .75; height: var(--ph); width: calc(var(--ph) * var(--pr)); }
.photo img { object-fit: contain; }
.model-top .photo { --ph: 72px; height: var(--ph); width: calc(var(--ph) * var(--pr)); }

/* ---------- закупка ---------- */
.tabbar-inner .tab { min-width: 0; }
.ctl-label { font-size: 12px; font-weight: 700; color: var(--muted); margin: 2px 2px 6px; }
.sec-title { font-size: 16px; margin: 18px 2px 8px; }
.sec-title span { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.buy-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.buy-title { min-width: 0; }
.buy-title .model-sub b { color: var(--ink); }
.buy-rows { display: flex; flex-direction: column; gap: 6px; }
.buy-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.buy-row.hot { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.buy-row.warn { background: var(--copper-soft); border-color: color-mix(in srgb, var(--copper) 40%, transparent); }
.br-text { flex: 1; min-width: 0; font-size: 14px; }
.br-text b { display: block; }
.br-text span { color: var(--muted); font-size: 12px; }
.br-need { text-align: right; flex: none; }
.br-need b { font-size: 18px; font-weight: 800; display: block; line-height: 1.1; }
.br-need small { font-size: 11px; color: var(--muted); }
.stale-sum { margin-bottom: 10px; }
.stale-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.stale-row:last-of-type { border-bottom: 0; }
.stale-text { flex: 1; min-width: 0; }

/* ---------- чат с покупателем и срок подтверждения ---------- */
.chat-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; border: 1px solid color-mix(in srgb, var(--denim) 45%, transparent);
  background: var(--denim-soft); color: var(--denim); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; }
.chat-btn svg { width: 16px; height: 16px; }
.deadline { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding: 6px 10px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.deadline b { color: var(--ink); white-space: nowrap; }
.deadline.warn { background: var(--copper-soft); border-color: color-mix(in srgb, var(--copper) 40%, transparent); }
.deadline.hot { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.deadline.hot b { color: var(--danger); }

/* срок подтверждения: подпись, дата и время раздельно, чтобы цифры не сливались */
.deadline { align-items: center; padding: 8px 12px; }
.dl-main small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dl-when { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.dl-when b { font-size: 17px; font-weight: 800; color: var(--ink); }
.dl-time { font-size: 15px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 1px 8px; }
.dl-left { font-size: 14px; font-weight: 800; color: var(--ink); text-align: right; }
.deadline.hot .dl-left { color: var(--danger); }
.deadline.warn .dl-left { color: var(--copper); }

/* этикетка, пометки */
.label-btn { background: var(--copper-soft); color: var(--copper); border-color: color-mix(in srgb, var(--copper) 45%, transparent); }
.chat-btn.busy { opacity: .55; pointer-events: none; }
.order-foot { flex-wrap: wrap; row-gap: 8px; }
.flags { margin-top: 8px; }
.flag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--danger); background: var(--danger-soft);
  border-radius: 999px; padding: 3px 10px; }

/* ---------- запись в МойСклад ---------- */
.fix-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 4px; padding: 10px 12px;
  border-radius: var(--radius-m); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); font-size: 14px; }
.fix-bar button { border: 0; background: var(--danger); color: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; }
.fill-btn { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.sheet-back { position: fixed; inset: 0; z-index: 90; background: rgba(8, 12, 20, .6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0, 0, 0, .3); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 18px; margin-bottom: 8px; }
.sheet-x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 20px; }
.sheet-info { padding: 10px 12px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); font-size: 14px; margin-bottom: 10px; }
.who-s { font-weight: 800; font-size: 16px; margin-bottom: 2px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 38vh; overflow-y: auto; margin-bottom: 10px; }
.pick-row { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 6px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; }
.pick-row .photo { --ph: 48px; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--copper-soft); margin-bottom: 8px; }
.picked button { border: 0; background: none; color: var(--denim); font-weight: 700; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sz.pick { cursor: pointer; color: var(--ink); }
.sz.pick.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.sz.pick.on .s, .sz.pick.on .q { color: var(--surface); }
.price-in { width: 100%; height: 48px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 20px; font-weight: 800; padding: 0 14px; }
.store-note { margin: 10px 2px; font-size: 13px; color: var(--ink-2); }
.sheet-err { margin: 6px 0; padding: 8px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 600; }
.primary { width: 100%; height: 50px; margin-top: 6px; border: 0; border-radius: var(--radius-m); background: var(--denim); color: #fff; font-size: 16px; font-weight: 800; }
.primary:disabled { opacity: .4; }

/* ---------- этикетки пачкой, режим упаковки ---------- */
.label-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 4px; padding: 10px 12px;
  border-radius: var(--radius-m); background: var(--copper-soft); border: 1px solid color-mix(in srgb, var(--copper) 40%, transparent); font-size: 14px; }
.pack-search input { font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.pack-card { background: var(--surface); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 16px 16px 14px; margin-bottom: 14px; }
.pack-who { font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; margin-bottom: 10px; overflow-wrap: anywhere; }
.pack-track { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; width: 100%; text-align: left; padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-m); color: var(--ink); }
.pack-track .dl { flex: 1 0 100%; font-size: 12px; font-weight: 700; color: var(--muted); }
.pack-track b { flex: 1; font-size: 24px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }
.pack-track .t4 { font-size: 1.25em; }
.pack-track svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.pack-multi { margin-bottom: 10px; padding: 8px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 800; }
.pack-item { margin-bottom: 12px; }
.pack-photo { display: block; width: 100%; min-height: 160px; max-height: 300px; padding: 0; margin-bottom: 10px; overflow: hidden;
  border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface-2); }
.pack-photo img { display: block; width: 100%; max-height: 300px; object-fit: contain; opacity: 0; transition: opacity .2s; }
.pack-photo img[src] { opacity: 1; }
.pack-line { display: flex; align-items: center; gap: 14px; }
.pack-line .size-tag { min-width: 84px; height: 92px; font-size: 38px; border-radius: 14px; }
.pack-line .size-tag::after { inset: 6px; border-radius: 10px; }
.pack-model .item-name { font-size: 20px; }
.pack-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.pack-actions .chat-btn { padding: 9px 16px; font-size: 14px; }
.pack-foot { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; }
.pack-queue-title { margin: 14px 2px 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { display: flex; flex-direction: column; align-items: center; min-width: 76px; padding: 8px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.pchip b { font-size: 20px; font-weight: 800; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.pchip small { font-size: 11px; color: var(--muted); max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pchip.on small { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.pchip.done { opacity: .45; }
.pchip.done small { color: var(--ok, #3e8a47); font-weight: 800; }

/* упаковка: размер и модель сверху, фото ниже и поменьше */
.pack-line { margin-bottom: 10px; }
.pack-photo { min-height: 120px; max-height: 240px; margin: 0 0 4px; }
.pack-photo img { max-height: 240px; }
.pack-track b { font-size: 22px; }
.pack-who { font-size: 24px; }

/* упаковка: канал и служба доставки; артикул в списке моделей */
.pack-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ptag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.ptag.svc { background: var(--denim-soft); color: var(--denim); border-color: color-mix(in srgb, var(--denim) 35%, transparent); }
.pchip .svc { font-size: 10px; font-weight: 700; margin-top: 1px; color: var(--denim); }
.pchip.on .svc { color: color-mix(in srgb, var(--surface) 80%, transparent); }
.pr-name small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 1px; }

/* упаковка: сводка по службам доставки */
.pack-sum { margin: 12px 0 4px; padding: 12px; border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow); }
.pack-sum-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.pack-sum-title span { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.sum-row { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; margin-bottom: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 14px; }
.sum-row .sn { font-weight: 700; }
.sum-row .sc b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sum-row .sd { color: var(--ok, #3e8a47); font-weight: 800; font-size: 13px; }
.sum-row .sl { color: var(--muted); font-size: 12.5px; font-weight: 700; min-width: 74px; text-align: right; }
.sum-row.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.sum-row.on .sl { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.sum-note { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* аналитика: размеры строками, фото у лучших моделей */
.size-hit { margin: 0 0 12px; font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.size-hit b { color: var(--ink); }
.size-rows { display: flex; flex-direction: column; gap: 7px; }
.size-row { display: grid; grid-template-columns: 46px 1fr auto 40px; align-items: center; gap: 10px; }
.sr-size { font-weight: 800; font-size: 15px; }
.sr-bar { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.sr-bar i { display: block; height: 100%; border-radius: 6px; background: color-mix(in srgb, var(--denim) 45%, var(--surface-2)); }
.size-row.top .sr-bar i { background: var(--copper); }
.sr-num { font-size: 13px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.sr-num b { color: var(--ink); font-weight: 800; }
.sr-pct { font-size: 13px; font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.size-row.top .sr-pct { color: var(--ink); }
.size-none { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.top-model { grid-template-columns: auto 1fr auto; align-items: center; column-gap: 10px; }
.top-model .photo { --ph: 44px; grid-row: 1 / span 3; }
.top-model .track, .top-model .sub, .top-model .msizes { grid-column: 2 / -1; }
/* лучшие модели: фото одной ширины, чтобы текст стоял ровно */
.top-model .photo { --ph: 52px; width: 42px; height: var(--ph); }

/* ---------- «Внимание» ---------- */
.segmented.m4 button { font-size: 12.5px; padding: 7px 2px; white-space: nowrap; }
.badge { display: inline-block; min-width: 18px; margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff;
  font-style: normal; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; vertical-align: 1px; }
.att-note { margin: 8px 2px; font-size: 13px; color: var(--ink-2); }
.att-group { margin-bottom: 8px; }
.att-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 2px 8px; font-size: 15px; }
.att-head span { min-width: 24px; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 800; text-align: center; color: #fff; background: var(--copper); }
.att-head.hot span { background: var(--danger); }
.att-item { margin-bottom: 10px; }
.att-reason { margin: 0 0 -6px; padding: 8px 12px 14px; border-radius: var(--radius-l) var(--radius-l) 0 0; font-size: 13.5px; font-weight: 700;
  background: var(--copper-soft); color: var(--copper); }
.att-reason.hot { background: var(--danger-soft); color: var(--danger); }
.att-item .order { margin-bottom: 0; }

/* аналитика: прибыль по моделям и возвраты */
.pm-note { margin: 0 0 10px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.pm { border-top: 1px solid var(--line); }
.pm:first-of-type { border-top: 0; }
.pm-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 0; text-align: left; border: 0; background: none; color: var(--ink); }
.pm-head .photo { display: block; --ph: 44px; width: 36px; flex: none; }
.pm-main { flex: 1; min-width: 0; }
.pm-main b { display: block; font-size: 14px; line-height: 1.25; }
.pm-main small, .pm-profit small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.pm-profit { text-align: right; flex: none; }
.pm-profit b { font-size: 16px; font-weight: 800; }
.neg { color: var(--danger); }
.ret.mid { color: var(--copper); font-weight: 700; }
.ret.hi { color: var(--danger); font-weight: 800; }
.pm-sizes { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.pm-tr { display: grid; grid-template-columns: 54px 1fr 1.2fr 1.2fr; gap: 6px; padding: 5px 0; font-size: 13px; align-items: baseline; }
.pm-tr span { text-align: right; font-variant-numeric: tabular-nums; }
.pm-th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.pm-warn { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--copper-soft); color: var(--ink); font-size: 12.5px; line-height: 1.4; }

/* вход по паролю */
.top-btns { display: flex; gap: 8px; }
.pw-form { display: flex; flex-direction: column; gap: 10px; width: min(320px, 100%); margin: 14px auto 6px; text-align: left; }
.pw-form input { height: 48px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 16px; padding: 0 14px; }
.pw-form .primary { height: 48px; margin-top: 2px; }
.pw-err { min-height: 18px; font-size: 13.5px; font-weight: 600; color: var(--danger); text-align: center; }
.login-or { display: flex; align-items: center; gap: 12px; width: min(320px, 100%); margin: 8px auto 12px; color: var(--muted); font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* устаревшие заказы в рабочей зоне */
.stale-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 4px; padding: 9px 12px; border-radius: var(--radius-m);
  background: var(--surface-2); border: 1px dashed var(--line); font-size: 13px; color: var(--ink-2); }
.stale-bar button { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 12.5px; }
.stale-note { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 700; line-height: 1.35; }

/* подтверждение заказа на Авито */
.confirm-btn { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chk { display: flex; gap: 10px; align-items: flex-start; margin: 6px 2px 10px; padding: 10px 12px; border-radius: var(--radius-m);
  background: var(--copper-soft); border: 1px solid color-mix(in srgb, var(--copper) 35%, transparent); font-size: 14px; font-weight: 700; color: var(--ink); }
.chk input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--copper); }
.chk small { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- чаты ---------- */
.chat-card { display: block; width: 100%; text-align: left; border: 0; color: var(--ink); font: inherit; cursor: pointer; }
.chat-card.waiting { border-left: 4px solid var(--copper); }
.chat-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.wait-badge { padding: 2px 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-weight: 800; }
.chat-item { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chat-text { margin-top: 6px; font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-order { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--denim); }
.linkbtn { background: none; border: 0; color: var(--denim); font-weight: 700; font-size: 14px; padding: 8px 2px; cursor: pointer; }
.msgs { max-height: 38vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.msg { max-width: 85%; padding: 8px 10px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; background: var(--surface); border: 1px solid var(--line); }
.msg.mine { align-self: flex-end; background: var(--denim); color: #fff; border-color: transparent; }
.msg small { display: block; margin-top: 2px; font-size: 10px; opacity: .7; }
.tpl-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.tpl { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; }
#reply, .tpl-edit textarea { width: 100%; box-sizing: border-box; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 12px; font: inherit; font-size: 15px; resize: vertical; }
.tpl-edit { margin-bottom: 10px; }
.tpl-edit .price-in { margin-bottom: 6px; }
.chat-card.unanswered { background: color-mix(in srgb, var(--denim) 9%, var(--surface)); }
.chat-card.unanswered .chat-text { font-weight: 800; }
.udot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--denim); vertical-align: 1px; }
.chat-card { display: flex; gap: 12px; align-items: flex-start; }
.chat-body { flex: 1; min-width: 0; }
.cphoto { flex: none; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--line); }
.cphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cphoto.big { width: 72px; height: 72px; }
.chat-info { display: flex; gap: 12px; align-items: flex-start; }
.stock-card { padding: 8px 12px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; }
.stock-card .ctl-label { margin-top: 2px; }
.sizes.mini { gap: 4px; margin: 4px 0 6px; }
.sz.mini { padding: 3px 8px; min-width: 34px; text-align: center; }
.sz.mini .q { font-size: 14px; }
.alt { margin-top: 4px; font-size: 13px; }
.msg { flex: none; }
.sheet-back.top { z-index: 100; }
.item-card { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.item-msg.mine .item-card { color: #fff; }
.tpl.attach { border-style: dashed; }
.pick-row.big { display: flex; gap: 12px; align-items: center; padding: 10px 12px; }
.pick-row.big .cphoto { width: 84px; height: 84px; }
.pick-row.big .pr-name { font-size: 16px; font-weight: 800; }
.pick-row.big .pr-name small { display: block; margin-top: 4px; font-size: 14px; }
.msg-note { flex: none; align-self: center; max-width: 90%; text-align: center; font-size: 12px; color: var(--muted); padding: 4px 10px; }
.chat-note { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--copper); }
.mark-row { display: flex; gap: 6px; margin: 6px 0; }
.tpl.on { background: var(--denim); color: #fff; border-color: transparent; }
.note-in { height: 40px; font-size: 14px; margin-bottom: 8px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.media-item { position: relative; }
.media-pick { width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; color: var(--ink); }
.media-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--line); }
.media-pick span { display: block; padding: 4px 6px; font-size: 12px; font-weight: 700; }
.media-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 16px; line-height: 1; }
.bc-list { margin: 8px 0; max-height: 36vh; overflow-y: auto; }
.bc-row { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.bc-row small { display: block; color: var(--muted); font-size: 12px; }
.bc-row span { flex: 1; min-width: 0; }
.bc-row em { font-style: normal; font-size: 12px; font-weight: 700; }
.bc-row input { width: 20px; height: 20px; accent-color: var(--copper); }
.media-grid .empty { grid-column: 1 / -1; }

/* окно чата: шапка и поле ответа всегда на экране, прокручивается только переписка */
.sheet.chat-sheet { height: min(94vh, 94dvh); max-height: none; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 10px; }
.chat-sheet .sheet-head { flex: none; }
.chat-itemrow { flex: none; display: flex; gap: 10px; align-items: center; padding: 8px 10px; margin-bottom: 8px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.chat-itemrow .cphoto { width: 48px; height: 48px; }
.chat-itemrow .ci-text { flex: 1; min-width: 0; }
.chat-itemrow .tpl { flex: none; }
.chat-more { flex: none; max-height: 48vh; overflow-y: auto; margin-bottom: 8px; }
.chat-sheet .msgs { flex: 1; min-height: 0; max-height: none; margin: 0 0 8px; }
.composer { flex: none; }
.tpl-row.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 0 6px; padding-bottom: 2px; }
.tpl-row.scroll .tpl { flex: none; }
#reply { margin: 0; }
.send-row { display: flex; gap: 8px; margin-top: 6px; }
.send-row .primary { margin-top: 0; flex: 1; height: 46px; }
.send-row .tool { flex: none; width: 46px; height: 46px; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); font-size: 20px; }
.msg { position: relative; }
.msg-del { position: absolute; top: 2px; right: 2px; border: 0; background: none; font-size: 12px; opacity: .45; padding: 4px; }
.msg.mine { padding-right: 26px; }
.chat-img { padding: 0; border: 0; background: none; display: block; }
.chat-img img { display: block; max-width: 220px; max-height: 260px; border-radius: 8px; background: var(--line); min-width: 120px; min-height: 90px; }
.tpl-row.scroll { scrollbar-width: none; } .tpl-row.scroll::-webkit-scrollbar { display: none; }
.chart-grid { display: grid; grid-template-columns: 54px repeat(4, 1fr); gap: 6px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.chart-grid.head { font-size: 11px; font-weight: 700; color: var(--muted); }
.chart-grid.lim { grid-template-columns: 1fr 1fr 1fr 1fr; }
.chart-grid input { width: 100%; box-sizing: border-box; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0 8px; font: inherit; }
.chart-note { width: 100%; box-sizing: border-box; border-radius: var(--radius-m); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 12px; font: inherit; }
.calc { margin-top: 8px; padding: 8px 12px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); }
.calc select, .calc-row input { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 0 8px; font: inherit; font-size: 14px; }
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.calc-row select { grid-column: 1 / -1; }
.advice { margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.advice.ok { background: color-mix(in srgb, #2e9b5a 15%, var(--surface)); }
.advice.warn { background: var(--copper-soft); }
.advice.bad { background: var(--danger-soft); }
.advice-note { margin-top: 4px; font-size: 12px; color: var(--muted); }
.lst-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.lst-row .cphoto { width: 56px; height: 56px; }
.lst-main { flex: 1; min-width: 0; font-size: 14px; }
.lst-main select { display: block; width: 100%; margin-top: 6px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0 8px; font: inherit; font-size: 14px; }
.lst-main .linkbtn { padding: 4px 0 0; text-align: left; font-size: 13px; }
.mx-wrap { overflow-x: auto; margin: 6px 0; }
.mx { border-collapse: collapse; font-size: 12px; }
.mx th { padding: 2px 4px; color: var(--muted); font-weight: 700; text-align: center; white-space: nowrap; }
.mx td { padding: 1px; }
.mx-c { width: 40px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 800; padding: 0; }
.mx-c.empty { background: transparent; border-style: dashed; opacity: .6; }
.mx-c.bord { background: var(--copper-soft); }
.cphoto.dim { opacity: .55; outline: 2px dashed var(--line); }
.lst-art { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 13px; }
.lst-art b { background: var(--tag, #e8f0ff); border-radius: 6px; padding: 2px 8px; }
.lst-chk { display: flex; gap: 6px; align-items: center; margin-left: auto; font-size: 13px; }
.lst-open { display: block; margin-top: 2px; font-size: 12px; color: var(--denim); }
.sheet-back.top2 { z-index: 110; }
.pickbtn { display: block; width: 100%; margin-top: 6px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 6px 10px; font: inherit; font-size: 14px; text-align: left; }
.ai-note { margin: 0 0 6px; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--denim) 10%, var(--surface)); font-size: 13px; font-weight: 700; }
.ai-note.warn { background: var(--copper-soft); }
.ai-note details { font-weight: 500; margin-top: 4px; }
.ai-note pre { white-space: pre-wrap; margin: 4px 0 0; font: inherit; font-size: 12px; color: var(--muted); max-height: 22vh; overflow-y: auto; }
.stuck-row { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stuck-it { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stuck-list { margin-top: 8px; max-height: 48vh; overflow-y: auto; }
.rc-progress { margin: 6px 0; font-size: 13px; }
.rc-bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 4px; overflow: hidden; }
.rc-bar i { display: block; height: 100%; background: var(--denim); transition: width .2s; }
.rc-model { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); margin-bottom: 8px; overflow: hidden; }
.rc-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; }
.rc-name { flex: 1; font-weight: 800; font-size: 14px; }
.rc-name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.rc-sizes { padding: 2px 10px 8px; }
.rc-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.rc-size { width: 52px; font-weight: 800; font-size: 15px; }
.rc-info { flex: 1; font-size: 12px; color: var(--muted); }
.rc-in { width: 84px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-align: center; font: inherit; font-size: 17px; font-weight: 800; }
.rc-diff { max-height: 40vh; overflow-y: auto; margin: 6px 0; }
.rc-drow { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rc-drow em { font-style: normal; font-weight: 800; }
.rc-drow .up { color: #2e7d4a; } .rc-drow .down { color: var(--danger); }
.sz .r.tr { color: var(--denim); }
.hist-sizes { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.hist-ev { font-size: 12px; padding: 3px 8px; margin-top: 3px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.hist-ev.in { background: color-mix(in srgb, var(--denim) 8%, var(--surface)); }
.stuck-list.hist { max-height: 52vh; }
.sz.clk { cursor: pointer; font: inherit; color: inherit; }
.sz .r.rt { color: var(--danger); }
.svc-box { margin: 2px 0 8px; padding: 6px 10px; border-radius: var(--radius-m); background: var(--surface); border: 1px dashed var(--line); }
/* ---------- маркировка ---------- */
.mk-box { margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); }
.mk-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.mk-count { padding: 2px 10px; border-radius: 999px; background: var(--copper-soft); font-weight: 800; font-size: 13px; }
.mk-count.ok { background: color-mix(in srgb, #2e9b5a 22%, var(--surface)); }
.mk-wants { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.mk-code { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 2px 0; }
.mk-in { width: 100%; box-sizing: border-box; height: 48px; margin-top: 6px; border-radius: var(--radius-m); border: 2px solid var(--denim); background: var(--bg); color: var(--ink); padding: 0 12px; font: inherit; font-size: 16px; }
.mk-msg { margin-top: 6px; padding: 8px 10px; border-radius: 10px; font-size: 14px; font-weight: 700; }
.mk-msg.ok { background: color-mix(in srgb, #2e9b5a 16%, var(--surface)); }
.mk-msg.bad { background: var(--danger-soft); color: var(--danger); }
.mk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.mk-stat { background: var(--surface); border-radius: var(--radius-m); padding: 8px 6px; text-align: center; box-shadow: var(--shadow); }
.mk-stat b { display: block; font-size: 20px; } .mk-stat span { font-size: 11px; color: var(--muted); }
.mk-h { margin: 14px 2px 6px; font-size: 15px; }
.mk-order { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; } .mk-order small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.mk-order.late { color: var(--danger); }
.mk-art-head small .warn { color: var(--danger); font-weight: 700; }
.mk-map { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.mk-map select { flex: 1; max-width: 62%; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; padding: 0 6px; }

.mk-big { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.mk-color { font-weight: 800; font-size: 20px; padding: 4px 12px; border-radius: 10px; background: rgba(255,255,255,.12); }
.mk-size { font-weight: 800; font-size: 28px; min-width: 52px; text-align: center; padding: 2px 14px; border-radius: 10px; background: #fff; color: #10151f; }
.mk-ki { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; opacity: .85; word-break: break-all; }
.mk-ki b { font-size: 13px; opacity: 1; letter-spacing: .02em; }
.mk-lines { margin: 8px 0 0; display: grid; gap: 4px; }
.mk-line { font-size: 12px; color: var(--muted, #9aa3b5); }
.mk-line span { font-weight: 700; }

.ad-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.ad-kpis div { background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 6px; text-align: center; }
.ad-kpis b { display: block; font-size: 16px; }
.ad-kpis span { font-size: 11px; opacity: .7; }
@media (max-width: 520px) { .ad-kpis { grid-template-columns: repeat(2, 1fr); } }
.ad-help { margin: 8px 0; font-size: 13px; line-height: 1.45; }
.ad-help summary { cursor: pointer; font-weight: 700; }
.ad-day { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.ad-day input[type=date] { background: rgba(255,255,255,.08); color: inherit; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 6px 8px; }
.ad-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.ad-n { width: 22px; text-align: right; opacity: .5; font-weight: 700; }
.ad-title { font-weight: 700; display: block; color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.ad-nums { font-size: 12px; opacity: .8; margin-top: 2px; }
.ad-badge { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.1); }
.ad-promote, .ad-good { background: rgba(60,190,110,.22); color: #7fe3a3; }
.ad-keep { background: rgba(240,180,60,.2); color: #f3cd7b; }
.ad-stop, .ad-no_stock { background: rgba(235,90,80,.22); color: #f19a93; }
.ad-check { background: rgba(110,150,255,.22); color: #a9c0ff; }

/* экран на всю страницу (реклама) */
.sheet-back.full { align-items: stretch; background: var(--bg); }
.sheet-back.full .sheet { max-width: 1040px; width: 100%; max-height: none; height: 100%; border-radius: 0; box-shadow: none; padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet-back.full .sheet-head { position: sticky; top: -12px; z-index: 2; background: var(--bg); padding: 8px 0; margin: 0 0 6px; font-size: 20px; }
.sheet-back.full .ad-row { padding: 14px 0; }
.sheet-back.full .ad-title { font-size: 16px; }
.sheet-back.full .ad-nums { font-size: 13px; }
.sheet-back.full .ad-kpis b { font-size: 20px; }
.sheet-back.full .ad-kpis span { font-size: 12px; }
.ad-few { background: rgba(255,255,255,.1); }

.rv-run { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.rv-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.rv-urgent { color: #f19a93; }
.ad-row input[type=checkbox] { width: 22px; height: 22px; margin-top: 4px; }

/* ---------- личные расходы ---------- */
.ex-month { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; font-size: 18px; text-transform: capitalize; }
.ex-form { display: grid; gap: 8px; }
.ex-cats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ex-cats .tpl.on { background: var(--denim); color: #fff; }
.ex-row { display: flex; gap: 8px; }
.ex-row input[type=date] { flex: 1; background: var(--surface); color: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.ex-row .primary { flex: 1; }
.ex-bar { margin: 8px 0; }
.ex-bar-top { display: flex; justify-content: space-between; font-size: 14px; }
.ex-bar-fill { height: 8px; border-radius: 4px; background: var(--denim); margin-top: 4px; }
.ex-days { display: flex; align-items: flex-end; gap: 3px; height: 110px; overflow-x: auto; }
.ex-day { flex: 1; min-width: 12px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; font-size: 10px; color: var(--muted); }
.ex-day > div { width: 100%; border-radius: 3px 3px 0 0; background: var(--denim); }
.ex-item { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.ex-tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
@media (max-width: 460px) { .tabbar-inner .tab { font-size: 10px; } .tab svg { width: 22px; height: 22px; } }

/* закреплённая нижняя панель: отдельный слой, чтобы Safari не терял её положение */
.tabbar { transform: translateZ(0); -webkit-transform: translateZ(0); will-change: transform; }
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
html, body { overflow-x: hidden; }

/* ---------- метка «остановился здесь» ---------- */
.mark-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 6px 0 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #f0b43c 22%, var(--surface)); border: 1px solid color-mix(in srgb, #f0b43c 55%, transparent); font-size: 14px; }
.mark-flag { margin: -4px 0 8px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, #f0b43c 28%, var(--surface)); font-weight: 700; font-size: 14px; }
.order.marked { outline: 2px solid #f0b43c; }
.pchip.mark { outline: 2px solid #f0b43c; }
.pchip.done { opacity: .5; }
.mark-btn { display: block; margin: 10px auto 0; font-weight: 700; }
