/* 7KM — мобильный интерфейс. Светлая и тёмная темы через переменные. */
:root {
  --bg: #f2f5f3; --surface: #ffffff; --surface2: #eef2ef; --ink: #15201a; --ink2: #44514a; --muted: #737f79;
  --line: #e1e7e3; --brand: #16804a; --brand-strong: #0f6a3c; --brand-soft: #e2f2e8; --brand-ink: #ffffff;
  --neg: #c62828; --neg-soft: #fdeceb; --pos: #15803d; --warn: #b45309; --warn-soft: #fff3df;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 4px 14px rgba(20, 40, 30, .06);
  --r: 14px; --tabh: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1311; --surface: #171f1b; --surface2: #1f2924; --ink: #e7eee9; --ink2: #b6c2bb; --muted: #8a9690;
    --line: #29342e; --brand: #2ea865; --brand-strong: #46c27c; --brand-soft: #16301f; --brand-ink: #ffffff;
    --neg: #ff6f6a; --neg-soft: #3a1d1c; --pos: #4fd685; --warn: #f2a23a; --warn-soft: #36280f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}
body.noscroll { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { flex: none; }
h1, h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.pad { padding: 4px 4px 8px; margin: 0; }
.grow { flex: 1; min-width: 0; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
.warn-text { color: var(--warn); margin: 8px 0 0; }
[hidden] { display: none !important; }

/* ── каркас ── */
.view { min-height: 100vh; min-height: 100dvh; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 8px) 12px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.top h1 { flex: 1; min-width: 0; font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; gap: 6px; align-items: center; }
.logo-sm { display: flex; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--ink); flex: none; }
.icon-btn:active { background: var(--surface2); }
.icon-btn.boxed { background: var(--surface2); border: 1px solid var(--line); height: 46px; width: 46px; align-self: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; max-width: 46vw; }
.pill svg { width: 18px; height: 18px; color: var(--brand); }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding: 4px 16px calc(var(--tabh) + var(--safe-b) + 24px); display: flex; flex-direction: column; gap: 12px; }
.main > [data-co], .main > [data-r], .main > [data-list], .main > [data-rep], .main > [data-bal] { display: flex; flex-direction: column; gap: 12px; }
.main.has-cartbar { padding-bottom: calc(var(--tabh) + var(--safe-b) + 92px); }
.main.has-actionbar { padding-bottom: calc(var(--safe-b) + 96px); }

/* нижнее меню */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabh) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 92%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tab.on { color: var(--brand); }
.tab-ic { display: grid; place-items: center; }
.tab-sell .tab-ic { width: 48px; height: 48px; margin-top: -22px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px rgba(22, 128, 74, .35); border: 4px solid var(--bg); }
.tab-sell { color: var(--brand); }

/* ── общие блоки ── */
.card { background: var(--surface); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.card-title svg { width: 20px; height: 20px; color: var(--brand); }
.section-title { font-weight: 700; font-size: 15px; padding: 6px 4px 0; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.section-title svg { width: 18px; height: 18px; color: var(--muted); }
.loading { display: grid; place-items: center; padding: 48px 0; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; color: var(--muted); text-align: center; }
.empty svg { width: 40px; height: 40px; opacity: .5; }
.empty p { margin: 0; white-space: pre-line; }
.empty.err { padding-top: 30vh; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; color: var(--ink); text-align: left; width: 100%; }
.banner.neg-soft { background: var(--neg-soft); box-shadow: none; }
.banner.neg-soft b { color: var(--neg); }
.banner.warn-soft { background: var(--warn-soft); box-shadow: none; justify-content: flex-start; color: var(--warn); font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--ink2); white-space: nowrap; }
.tag svg { width: 14px; height: 14px; }
.tag.neg { background: var(--neg-soft); color: var(--neg); }
.tag.pos { background: var(--brand-soft); color: var(--pos); }
.tag.np { background: #fde8e8; color: #b91c1c; }
.tag.bus { background: #e6effd; color: #1d4ed8; }
@media (prefers-color-scheme: dark) { .tag.np { background: #3b1c1c; color: #fca5a5; } .tag.bus { background: #18263f; color: #93c5fd; } }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 14px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

/* кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 16px;
  border-radius: 12px; background: var(--surface2); color: var(--ink); font-weight: 600; font-size: 15px; text-align: center;
  border: 1px solid var(--line); transition: transform .08s, opacity .15s;
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary-soft { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.btn.ghost { background: transparent; color: var(--brand); border-color: transparent; }
.btn.danger { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.btn.danger-soft { background: transparent; color: var(--neg); border-color: var(--line); }
.btn.big { min-height: 54px; font-size: 17px; border-radius: 14px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > * { flex: 1; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-grid > .btn { min-width: 0; font-size: 14px; padding: 10px; }
.center-btn { align-self: center; }
.link-btn { color: var(--brand); font-weight: 600; padding: 6px 0; align-self: flex-start; }
.link-btn.small { font-size: 12px; padding: 2px 0; }

/* поля */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink2); }
.field small { color: var(--muted); font-size: 12px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface2); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; min-height: 46px; width: 100%; outline: none; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea { min-height: 60px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.with-btn { display: flex; gap: 8px; align-items: flex-end; }
.with-btn .field { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--brand); -webkit-appearance: checkbox; appearance: auto; }
.hint { margin: 0; color: var(--ink2); font-size: 14px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px; padding: 0 12px; box-shadow: var(--shadow); }
.search svg { color: var(--muted); width: 20px; height: 20px; }
.search input { background: none; border: 0; box-shadow: none; padding: 10px 0; }
.search input:focus { box-shadow: none; }
.sticky-tools { position: sticky; top: calc(var(--safe-t) + 56px); z-index: 10; display: flex; flex-direction: column; gap: 8px;
  margin: 0 -16px; padding: 4px 16px 8px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* чипы и сегменты */
.chips { display: flex; gap: 6px; }
.chips.scroll { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.sheet .chips.scroll { margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.chip svg { width: 16px; height: 16px; display: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.on svg { display: block; }
.chip b { background: rgba(255, 255, 255, .25); padding: 0 6px; border-radius: 99px; font-size: 12px; }
.chip:not(.on) b { background: var(--brand-soft); color: var(--brand); }
.seg { display: flex; background: var(--surface2); border-radius: 12px; padding: 3px; gap: 3px; border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 38px; border-radius: 9px; font-weight: 600; font-size: 14px; line-height: 1.15; color: var(--ink2); padding: 0 6px; }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.seg.small button { min-height: 32px; font-size: 13px; }

/* миниатюры */
.thumb { width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface2); display: grid; place-items: center; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.ph { background: hsl(var(--h) 42% 90%); color: hsl(var(--h) 45% 28%); }
@media (prefers-color-scheme: dark) { .thumb.ph { background: hsl(var(--h) 22% 22%); color: hsl(var(--h) 55% 80%); } }
.thumb.ph span { font-weight: 800; font-size: 15px; letter-spacing: .02em; padding: 4px; text-align: center; word-break: break-all; }
.thumb.sm { width: 46px; height: 46px; border-radius: 10px; }
.thumb.sm span { font-size: 10px; }
.thumb.md { width: 76px; height: 76px; }
.thumb.md span { font-size: 12px; }
.thumb.xl { aspect-ratio: 4 / 3; max-height: 340px; border-radius: var(--r); }
.thumb.xl span { font-size: 32px; }

/* списки */
.list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card .list, .sheet .list, .list.card { box-shadow: none; }
.list.card { padding: 0; gap: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: var(--ink); text-align: left; width: 100%; border-bottom: 1px solid var(--line); min-height: 56px; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface2); }
.row > svg { width: 18px; height: 18px; color: var(--muted); }
.row b { font-weight: 650; }
.row small { display: block; font-size: 12.5px; margin-top: 1px; }
.row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: none; }
.row.canceled, .sumrow.canceled { opacity: .5; }
.row.canceled b { text-decoration: line-through; }
.row-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface2); color: var(--ink2); flex: none; }
.row-ic svg { width: 20px; height: 20px; }
.rank { width: 18px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }

/* цветные значки */
.c-green { background: #e2f4e9 !important; color: #15803d !important; }
.c-blue { background: #e5effd !important; color: #2563eb !important; }
.c-amber { background: #fdf1d8 !important; color: #b45309 !important; }
.c-violet { background: #efe9fd !important; color: #7c3aed !important; }
.c-teal { background: #dcf3f1 !important; color: #0f766e !important; }
.c-orange { background: #fde9dc !important; color: #c2410c !important; }
.c-gray { background: var(--surface2) !important; color: var(--ink2) !important; }
.c-red { background: var(--neg-soft) !important; color: var(--neg) !important; }
@media (prefers-color-scheme: dark) {
  .c-green { background: #173323 !important; color: #6ee7a0 !important; }
  .c-blue { background: #172a45 !important; color: #8ab4ff !important; }
  .c-amber { background: #3a2c10 !important; color: #fbbf5c !important; }
  .c-violet { background: #2a2045 !important; color: #c4a8ff !important; }
  .c-teal { background: #113330 !important; color: #5eead4 !important; }
  .c-orange { background: #3a2214 !important; color: #fdba8c !important; }
}

/* ── вход ── */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: calc(var(--safe-t) + 16px) 20px 32px; max-width: 460px; margin: 0 auto; }
.auth-lang { align-self: flex-end; width: 220px; }
.auth-logo { text-align: center; padding: 6vh 0 4px; }
.auth-logo svg { width: 64px; height: 64px; }
.auth-logo h1 { font-size: 30px; margin-top: 8px; letter-spacing: .02em; }
.auth-logo p { margin: 4px 0 0; color: var(--muted); }

/* ── главная ── */
.hello { font-size: 22px; font-weight: 750; padding: 2px 2px 0; }
.hero { display: block; color: #fff; border-radius: 18px; padding: 16px; background: linear-gradient(135deg, #16804a 0%, #1f9d5c 55%, #2bb673 100%); box-shadow: 0 10px 24px rgba(22, 128, 74, .28); }
.hero-top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; opacity: .92; }
.hero-top svg { width: 18px; height: 18px; }
.hero-num { font-size: 36px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-num.dark { color: var(--ink); }
.hero-num.dark.neg { color: var(--neg); }
.hero-sub { opacity: .85; font-size: 14px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .25); }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 17px; }
.hero-stats span { font-size: 12px; opacity: .85; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); text-align: left; color: var(--ink); }
.mini span { font-size: 12.5px; color: var(--muted); }
.mini b { font-size: 17px; }
.mini.big b { font-size: 22px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; background: var(--surface); border-radius: var(--r); padding: 16px 8px; box-shadow: var(--shadow); }
.tile { display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; line-height: 1.2; }
.tile-ic { position: relative; width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; }
.tile-ic svg { width: 26px; height: 26px; }
.badge { position: absolute; top: -5px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--neg); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }

/* ── продажа ── */
.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .pgrid { grid-template-columns: repeat(3, 1fr); } }
.pcard { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; text-align: left; }
.pcard .thumb { border-radius: 0; }
.pcard.out { opacity: .55; }
.pc-badge { position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; background: var(--brand); color: #fff; font-weight: 800; font-size: 14px; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.pc-body { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 10px; }
.pc-art { font-size: 13px; }
.pc-name { font-size: 13px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 3px; gap: 4px; }
.pc-price { color: var(--brand); font-size: 16px; }
.pc-stock { font-size: 12px; color: var(--muted); white-space: nowrap; }
.cartbar {
  position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(var(--tabh) + var(--safe-b) + 10px);
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--brand); color: #fff;
  box-shadow: 0 10px 24px rgba(22, 128, 74, .35); font-weight: 700;
}
.cb-ic { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .18); }
.cb-ic i { position: absolute; top: -6px; right: -8px; font-style: normal; background: #fff; color: var(--brand); border-radius: 99px; font-size: 12px; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 5px; }
.cb-sum { flex: 1; font-size: 18px; display: flex; flex-direction: column; line-height: 1.15; }
.cb-sum small { font-size: 12px; font-weight: 500; opacity: .9; }
.cb-go { display: flex; align-items: center; gap: 2px; }
.cb-go svg { width: 18px; height: 18px; }

/* окно выбора размеров */
.pk-head { display: flex; gap: 12px; align-items: center; }
.pk-meta { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pk-price { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.money-input { display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--ink); font-size: 18px; }
.money-input input { width: 92px; min-height: 40px; padding: 6px 8px; font-weight: 700; text-align: right; font-size: 18px; }
.pk-colors { padding-top: 2px; }
.pk-grid { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pk-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.pk-row:last-child { border-bottom: 0; }
.pk-row > b { font-size: 16px; }
.pk-th { font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; background: var(--surface2); }
.pk-th span:last-child { text-align: center; width: 132px; }
.pk-row .zero { color: var(--muted); opacity: .6; }
.pk-row.over { background: var(--neg-soft); }
.pk-row.over input { color: var(--neg); border-color: var(--neg); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 11px; background: var(--surface2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); }
.stepper button:active { background: var(--brand-soft); color: var(--brand); }
.stepper button svg { width: 20px; height: 20px; }
.stepper input { width: 48px; min-height: 40px; padding: 4px; text-align: center; font-weight: 700; font-size: 17px; }
.pk-pack { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); }
.pk-pack-btns { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.pk-total { flex: 1; font-size: 14px; }

/* строки документа */
.line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.line:first-of-type { padding-top: 0; }
.line-btns { display: flex; flex-direction: column; gap: 2px; margin: -6px -8px 0 0; }
.line-btns .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.line-btns svg { width: 19px; height: 19px; }
.cust { display: flex; align-items: center; gap: 10px; }
.sumrow { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; }
.sumrow.big { font-size: 19px; padding-top: 2px; }
.sumrow.muted { font-size: 13.5px; }
.sumrow.neg { color: var(--neg); }
.sumrow.pos { color: var(--pos); font-weight: 600; }
.sumrow.pos svg { width: 20px; height: 20px; }
.sumrow.warn { color: var(--warn); }
.sumrow .right { text-align: right; }
.done { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 14px; }
.done-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.done-ic svg { width: 36px; height: 36px; stroke-width: 2.4; }

/* клиент */
.debt-big { display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; }
.debt-big span { font-size: 13px; color: var(--muted); font-weight: 600; }
.debt-big b { font-size: 34px; font-weight: 800; }
.debt-big.neg b { color: var(--neg); }
.debt-big.pos b { color: var(--pos); }
.debt-big small { color: var(--muted); }
.kv { display: flex; flex-direction: column; gap: 8px; }
.kv > a, .kv > span { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.kv svg { width: 18px; height: 18px; color: var(--muted); }
.kv-link { color: var(--brand) !important; font-weight: 600; }
.kvrow { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.kvrow > span:first-child { color: var(--muted); }
.kvrow > span:last-child { text-align: right; font-weight: 600; }
.calc:empty { display: none; }
.calc { padding: 10px 12px; border-radius: 12px; background: var(--surface2); display: flex; flex-direction: column; gap: 4px; }
.profile { flex-direction: row; align-items: center; gap: 14px; }
.swap-btn { align-self: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; transform: rotate(90deg); margin: -4px 0; }

/* касса */
.actionbar { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 10px 16px calc(var(--safe-b) + 12px); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.actionbar .btn { min-height: 50px; }

/* отправки */
.ship { text-align: left; gap: 4px; width: 100%; color: var(--ink); }
.ship-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.ttn { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; font-size: 15px; letter-spacing: .04em; color: var(--brand); }

/* товар */
.product-hero .thumb { width: 100%; }
.p-title { font-size: 20px; }
.price-row { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.price-row b { font-size: 24px; color: var(--brand); }
.matrix-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.matrix { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
.matrix th, .matrix td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.matrix thead th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.matrix tbody th { text-align: left; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.matrix td.zero { color: var(--muted); opacity: .5; }
.matrix tr:last-child th, .matrix tr:last-child td { border-bottom: 0; }
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-pick { width: 120px; height: 120px; border-radius: var(--r); border: 2px dashed var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; overflow: hidden; cursor: pointer; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick svg { width: 30px; height: 30px; }
.photo-pick.busy { opacity: .5; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.pack-grid label { display: flex; flex-direction: column; gap: 3px; align-items: center; font-weight: 700; font-size: 13px; }
.pack-grid input { text-align: center; padding: 8px 4px; min-height: 42px; font-weight: 700; }

/* ── отчёты ── */
.hero-card { gap: 2px; }
.delta { font-size: 13px; font-weight: 700; margin-top: 6px; }
.delta.up { color: var(--pos); }
.delta.down { color: var(--neg); }
.delta .muted { font-weight: 500; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat b { font-size: 21px; font-variant-numeric: tabular-nums; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--brand); }
.chart g.on .bar { fill: var(--brand-strong); }
.chart .hit { fill: transparent; }
.chart g.on .hit { fill: var(--brand-soft); opacity: .6; }
.tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: var(--surface); padding: 5px 9px; border-radius: 8px; font-size: 12.5px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); }
.tip .muted { color: inherit; opacity: .7; }
.daytable summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; padding: 4px 0; }
.daytable .list { margin-top: 6px; border: 1px solid var(--line); }
.daytable .row { min-height: 40px; padding: 8px 12px; }
.meters { display: flex; flex-direction: column; gap: 10px; }
.meter-row { display: grid; grid-template-columns: minmax(70px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: 14px; }
.meter-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-track { height: 8px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.meter-track i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }

/* ── всплывающие окна ── */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(8, 15, 11, .45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 20px 20px 0 0; transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
  max-width: 640px; margin: 0 auto; box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
}
.sheet.tall { height: 90vh; height: 90dvh; }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 6px 16px; }
.sheet-head b { flex: 1; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-body:last-child { padding-bottom: calc(var(--safe-b) + 18px); }
.sheet-foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(var(--safe-b) + 12px); border-top: 1px solid var(--line); }
.sheet-foot .btn { min-width: 120px; }
.share-ta { min-height: 240px; font-size: 14px; }

.toast { position: fixed; z-index: 80; left: 16px; right: 16px; top: calc(var(--safe-t) + 10px); margin: 0 auto; max-width: 480px; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--surface); font-weight: 600; box-shadow: 0 8px 26px rgba(0, 0, 0, .25); transform: translateY(-140%); transition: transform .25s; white-space: pre-line; }
.toast.err { background: var(--neg); color: #fff; }
.toast.show { transform: none; }
.offline-bar { display: none; position: fixed; z-index: 90; top: 0; left: 0; right: 0; padding: calc(var(--safe-t) + 4px) 12px 4px; background: var(--warn); color: #fff; text-align: center; font-size: 12.5px; font-weight: 700; }
body.offline .offline-bar { display: block; }

@media (min-width: 720px) {
  .view { max-width: 640px; margin: 0 auto; }
  .tabbar { max-width: 640px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .cartbar { max-width: 616px; margin: 0 auto; }
}
