/* Tiyn — приложение: каркас, разделы, окна. Цвета только из токенов base.css. */

/* ================= каркас ================= */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.shell.noshop { grid-template-columns: minmax(0, 1fr); }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 20px;
  padding: 20px 16px 16px; background: var(--sheet-2); border-right: 1px solid var(--rule); overflow-y: auto; overflow-x: hidden;
}
.side .brand { padding: 4px 8px; }
.spine {
  position: relative; display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; min-width: 0;
  padding: 12px 12px 12px 16px; background: var(--sheet); border: 1px solid var(--rule); border-left: 7px solid var(--brass);
  border-radius: 4px var(--r-s) var(--r-s) 4px; box-shadow: inset 2px 0 0 color-mix(in srgb, var(--ink) 8%, transparent);
  transition: border-color .15s;
}
.spine:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--rule)); border-left-color: var(--brass); }
.spine::after { content: ''; position: absolute; right: 14px; top: 17px; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); }
.sp-name { font-weight: 600; font-size: 15px; line-height: 1.25; padding-right: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); min-width: 0; }
.sp-meta .st { display: inline-flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-ini, .spine .chv { display: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-i { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: var(--r-s); border: 1px solid transparent; color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s; }
.nav-i .ic, .tbtn .ic { width: 20px; height: 20px; flex: none; display: block; }
.nav-i .ic svg, .tbtn .ic svg { width: 20px; height: 20px; }
.nav-i:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.nav-i.on { background: var(--sheet); border-color: var(--rule); color: var(--ink); font-weight: 600; }
.nav-i.on .ic { color: var(--brass); }
.side-f { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-f .row { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--rule); padding: 14px 4px 0 8px; }
.ava { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.uname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tbtn { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--r-s); color: var(--ink-2); font-weight: 500; width: 100%; }
.tbtn:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.ghost { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); flex: none; }
.ghost:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.ghost svg { width: 20px; height: 20px; }

.main { min-width: 0; width: 100%; max-width: 1440px; margin: 0 auto; padding: 32px 40px 72px; }
.mtop, .mnav { display: none; }

.phead { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; min-height: 42px; }
.phead h1 { font: 500 28px/1.1 var(--f-disp); letter-spacing: -.02em; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--rule); background: var(--sheet-2); border-radius: var(--r-s); }
.seg button { height: 34px; padding: 0 16px; border-radius: 8px; color: var(--ink-2); font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--brass) inset; }
.seg.mini button { height: 30px; padding: 0 12px; font-size: 13px; }

.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); }
.page { display: flex; flex-direction: column; gap: 16px; }
.errbox { padding: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.banner { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: var(--r-m); background: var(--brass-soft); border: 1px solid color-mix(in srgb, var(--brass) 35%, transparent); }
.banner > .ic { width: 22px; height: 22px; color: var(--brass); flex: none; display: block; }
.banner .ic svg { width: 22px; height: 22px; }
.banner-t { flex: 1; min-width: 0; font-weight: 500; }
.banner.info { background: color-mix(in srgb, var(--wait) 14%, var(--sheet)); border-color: color-mix(in srgb, var(--wait) 35%, transparent); }
.banner.bad { background: var(--loss-soft); border-color: color-mix(in srgb, var(--loss) 35%, transparent); }
.banner.bad > .ic { color: var(--loss); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--wait) 30%, transparent); border-top-color: var(--wait); animation: spin .8s linear infinite; flex: none; }
#banner:not(:empty) { margin-bottom: 16px; }

/* ================= сводка ================= */
.sum { display: flex; flex-direction: column; gap: 16px; }
.hero { position: relative; display: grid; grid-template-columns: minmax(380px, .85fr) minmax(0, 1.15fr); overflow: hidden; }
.hero::before { content: ''; position: absolute; left: 18px; top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, var(--brass) 55%, transparent); }
.hero-l { padding: 28px 28px 24px 40px; border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hero-k { display: flex; align-items: baseline; gap: 10px; color: var(--ink-2); font-weight: 500; flex-wrap: wrap; }
.hero-k span:last-child { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.hero-v { font: 600 56px/1.1 var(--f-disp); letter-spacing: -.03em; white-space: nowrap; margin: 6px 0 2px; }
.hero-v .cur { font-family: var(--f-text); font-weight: 400; font-size: .5em; letter-spacing: 0; color: var(--ink-3); margin-left: .12em; }
.hero-d { font-size: 14px; }
.hero-spark { flex: 1; min-height: 72px; margin-top: 14px; display: flex; align-items: flex-end; }
.hero-spark svg { width: 100%; height: 72px; overflow: visible; }
.hero-spark .p { fill: var(--gain); opacity: .8; } .hero-spark .n { fill: var(--loss); opacity: .85; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: var(--r-pill); background: var(--sheet-2); border: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.pill b { color: var(--ink); font-weight: 600; }
.hero-r { padding: 24px 32px 20px 28px; min-width: 0; }
.rb-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; gap: 12px; }
.rb-h h3 { font-size: 15px; font-weight: 600; }
.rb-h span { font-size: 12.5px; color: var(--ink-3); }
.rb-wrap { position: relative; }
.rb-mark { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px dashed var(--ink); pointer-events: none; }
.rb-rows { margin-top: 14px; display: flex; flex-direction: column; }
.rb-row { display: grid; grid-template-columns: 128px minmax(40px, 1fr) 118px 54px; align-items: center; column-gap: 12px; min-height: 30px; font-size: 13.5px; }
.rb-n { display: flex; align-items: center; gap: 8px; color: var(--ink-2); white-space: nowrap; min-width: 0; }
.rb-n i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rb-t { height: 6px; border-radius: 3px; background: var(--sheet-2); position: relative; }
.rb-t i { position: absolute; top: 0; bottom: 0; border-radius: 3px; min-width: 2px; }
.rb-a { text-align: right; white-space: nowrap; }
.rb-p { text-align: right; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.rb-row.z { opacity: .5; }
.rb-row.tot { margin-top: 6px; padding-top: 8px; border-top: 3px double var(--ink-2); min-height: 40px; font-weight: 600; font-size: 15px; }
.rb-row.tot .rb-n, .rb-row.rev .rb-n { color: var(--ink); }
.rb-row.rev { font-weight: 500; }
.info { display: inline-grid; place-items: center; width: 18px; height: 18px; color: var(--ink-3); cursor: help; border-radius: 50%; }
.info:hover { color: var(--brass); }
.info svg { width: 16px; height: 16px; }

.mets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.met { padding: 16px 18px 14px; min-width: 0; }
.met-l { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.met-v { font: 600 28px/1.1 var(--f-text); letter-spacing: -.02em; margin: 8px 0 6px; white-space: nowrap; }
.met-v .cur { font-size: .5em; font-weight: 400; letter-spacing: 0; margin-left: .15em; }
.met-s { font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 2px 8px; min-height: 18px; }

.g2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.g-eq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.ch-card { padding: 20px 24px 12px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h3 { font-size: 15px; font-weight: 600; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.ln { height: 0; width: 16px; border-top: 2px solid var(--brass); border-radius: 0; }
.lg-g { background: var(--gain); } .lg-l { background: var(--loss); } .lg-b { background: var(--brass); } .lg-w { background: var(--wait); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .zero { stroke: var(--ink-3); stroke-width: 1; }
.chart .ax { fill: var(--ink-3); font-size: 11px; font-family: var(--f-text); font-variant-numeric: tabular-nums; }
.chart .b-pos { fill: var(--gain); } .chart .b-neg { fill: var(--loss); } .chart .b-rev { fill: var(--brass); } .chart .b-ord { fill: var(--wait); }
.chart .rline { fill: none; stroke: var(--brass); stroke-width: 1.5; stroke-linejoin: round; }
.chart .hov { fill: var(--sheet-2); }
.ctip { position: absolute; top: 0; z-index: 3; display: none; pointer-events: none; min-width: 176px; padding: 10px 12px; border-radius: 10px; background: var(--sheet); border: 1px solid var(--rule); box-shadow: var(--shadow-pop); font-size: 12.5px; line-height: 1.6; }
.ctip b { font-weight: 600; }
.ctip .t { display: block; margin-bottom: 2px; font-weight: 600; }
.ctip .r { display: flex; justify-content: space-between; gap: 16px; }
.ctip .r span:first-child { color: var(--ink-3); }

.lst { padding: 20px 24px 16px; min-width: 0; display: flex; flex-direction: column; }
.tb { display: flex; flex-direction: column; }
.tb-r { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'n p' 'b q'; align-items: center; column-gap: 16px; row-gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.tb-r:first-child { padding-top: 4px; }
.tb-r:last-child { border-bottom: 0; }
.tb-r .tb-n { grid-area: n; } .tb-r .tb-p { grid-area: p; } .tb-r .tb-q { grid-area: q; text-align: right; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; } .tb-r .bar-t { grid-area: b; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tb-n { min-width: 0; }
.tb-n b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-n small { font-size: 12px; color: var(--ink-3); }
.bar-t { height: 6px; border-radius: 3px; background: var(--sheet-2); overflow: hidden; }
.bar-t i { display: block; height: 100%; border-radius: 3px; background: var(--gain); }
.bar-t i.l { background: var(--loss); }
.bar-t i.b { background: var(--brass); }
.none-ok { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--r-s); background: var(--gain-soft); color: var(--gain); font-weight: 500; margin-top: 4px; }
.none-ok svg { width: 20px; height: 20px; flex: none; }
.rs-l { display: flex; flex-direction: column; gap: 14px; }
.rs-t { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.rs-t span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-t .num { color: var(--ink-2); }
.cx-sum { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.empty-s { color: var(--ink-3); padding: 24px 0; }

/* ================= товары ================= */
.tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search .inp { padding-left: 38px; }
.tools .sp { flex: 1; }
.sel.m-sort { display: none; }

.ptbl { --cols: minmax(220px, 1fr) 72px 112px 108px 100px 116px 112px 44px; overflow: clip; }
.pt-h, .pt-r, .pt-t { display: grid; grid-template-columns: var(--cols); align-items: center; column-gap: 12px; padding: 0 16px; }
.pt-h { position: sticky; top: 0; z-index: 2; background: var(--sheet-2); border-bottom: 1px solid var(--rule); }
.th { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-3); height: 42px; min-width: 0; white-space: nowrap; text-align: left; font-weight: 500; transition: color .15s; }
.th:hover { color: var(--ink); }
.th.r { justify-content: flex-end; }
.th.c { justify-content: center; }
.th.on { color: var(--ink); }
.th .ar { width: 8px; height: 10px; flex: none; opacity: 0; fill: currentColor; }
.th.on .ar { opacity: 1; }
.th.on.asc .ar { transform: rotate(180deg); }
.pt-r { min-height: 60px; border-bottom: 1px solid var(--rule); position: relative; transition: background .15s; }
.pt-r:hover { background: color-mix(in srgb, var(--sheet-2) 60%, transparent); }
.pt-r.neg-r { background: linear-gradient(90deg, var(--loss-soft), transparent 45%); box-shadow: inset 4px 0 0 var(--loss); }
.pt-r .nm { min-width: 0; padding: 8px 0; }
.pt-r .nm b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-r .nm small { display: block; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-c { display: flex; justify-content: flex-end; }
.cost { width: 100%; max-width: 104px; text-align: right; min-height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink); font: inherit; outline: none; font-variant-numeric: tabular-nums; transition: border-color .15s, background .15s; }
.pt-r:hover .cost { border-color: var(--rule); background: var(--sheet); }
.cost:focus { border-color: var(--brass) !important; background: var(--sheet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brass) 22%, transparent); }
.cost.empty { background: var(--brass-soft) !important; border-color: color-mix(in srgb, var(--brass) 45%, transparent) !important; }
.cost.empty::placeholder { color: var(--brass); font-weight: 500; opacity: 1; text-align: right; }
.mg { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.mg .bar-t { width: 100%; height: 4px; }
.cls { display: inline-grid; place-items: center; width: 28px; height: 24px; border-radius: 8px; font-weight: 600; font-size: 12px; justify-self: center; background: var(--sheet-2); color: var(--ink-3); }
.cls.A { background: var(--gain-soft); color: var(--gain); }
.cls.B { background: var(--brass-soft); color: var(--brass); }
.pt-t { min-height: 54px; border-top: 3px double var(--ink-2); background: var(--sheet-2); font-weight: 600; }
.pt-t .lbl { color: var(--ink-2); }
.pt-empty { padding: 48px 24px; text-align: center; color: var(--ink-3); }
.pt-r .lb { display: none; }

/* ================= заказы ================= */
.ogrps { display: flex; flex-direction: column; gap: 16px; }
.dgrp { overflow: hidden; }
.dh { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 24px; flex-wrap: wrap; padding: 14px 16px; background: var(--sheet-2); border-bottom: 1px solid var(--rule); }
.dh h3 { font: 500 15px/1.2 var(--f-disp); letter-spacing: -.01em; }
.dh h3 span { color: var(--ink-3); font-family: var(--f-text); font-weight: 400; font-size: 14px; letter-spacing: 0; }
.dh-s { display: flex; gap: 20px; flex-wrap: wrap; color: var(--ink-3); font-size: 13px; }
.dh-s b { font-weight: 600; color: var(--ink); }
.og { border-bottom: 1px solid var(--rule); }
.og:last-child { border-bottom: 0; }
.or { display: grid; grid-template-columns: 52px 112px minmax(0, 1fr) 96px 120px 120px 24px; align-items: center; column-gap: 12px; width: 100%; text-align: left; padding: 12px 16px; min-height: 58px; transition: background .15s; }
.or:hover, .or.open { background: color-mix(in srgb, var(--sheet-2) 60%, transparent); }
.or .tm { color: var(--ink-3); }
.or .cd { font-weight: 500; }
.or .it { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.or .it small { color: var(--ink-3); }
.or .chv { color: var(--ink-3); transition: transform .18s var(--ease); display: grid; place-items: center; }
.or .chv svg { width: 18px; height: 18px; }
.or.open .chv { transform: rotate(180deg); }
.or .lb { display: none; }
.od { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 40px; padding: 8px 16px 20px 176px; background: color-mix(in srgb, var(--sheet-2) 60%, transparent); }
.od-l, .od-r { display: flex; flex-direction: column; min-width: 0; }
.od h4 { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 6px; }
.oe { display: grid; grid-template-columns: minmax(0, 1fr) 56px 112px; column-gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.oe .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe .q { color: var(--ink-3); text-align: right; }
.lg-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.lg-row.t { border-top: 3px double var(--ink-2); margin-top: 4px; padding-top: 9px; font-weight: 600; }
.lg-row span:first-child { color: var(--ink-2); }
.lg-row.t span:first-child { color: var(--ink); }
.lg-warn { margin-top: 8px; padding: 8px 12px; border-radius: var(--r-s); background: var(--brass-soft); color: var(--brass); font-size: 13px; font-weight: 500; }
.more { display: flex; justify-content: center; padding: 8px 0 0; }
.orders-end { text-align: center; color: var(--ink-3); font-size: 13px; padding-top: 4px; }

/* ================= настройки ================= */
.sgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.scol { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sheetc { padding: 22px 24px 24px; }
.sheetc > h2 { font: 500 16px/1.2 var(--f-disp); letter-spacing: -.01em; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fgrid { display: grid; gap: 16px; }
.fgrid.c2 { grid-template-columns: 1fr 1fr; }
.fgrid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.tokrow { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.tokrow .tk { flex: 1; font-size: 15px; letter-spacing: .08em; }
.sync-r { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sync-r .btn { margin-left: auto; }
.jobs { border: 1px solid var(--rule); border-radius: var(--r-s); max-height: 300px; overflow: auto; }
.job { display: grid; grid-template-columns: 10px 112px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.job:last-child { border-bottom: 0; }
.job-d { color: var(--ink-3); }
.job-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-note { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-s); background: var(--brass-soft); color: var(--ink); font-weight: 500; }
.errline { padding: 10px 14px; border-radius: var(--r-s); background: var(--loss-soft); color: var(--loss); margin-bottom: 12px; font-size: 13px; }
.cats { border: 1px solid var(--rule); border-radius: var(--r-s); max-height: 380px; overflow: auto; }
.cat { display: grid; grid-template-columns: minmax(0, 1fr) 148px; gap: 12px; align-items: center; padding: 8px 12px 8px 14px; border-bottom: 1px solid var(--rule); }
.cat:last-child { border-bottom: 0; }
.cat.head { position: sticky; top: 0; z-index: 1; background: var(--sheet-2); font-size: 12px; color: var(--ink-3); padding-top: 10px; padding-bottom: 10px; }
.cat-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-r { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.cat-r .sfx { width: 104px; }
.exp-f { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; align-items: end; }
.exp-f .full { grid-column: 1 / -1; }
.exp-f .chips { gap: 6px; flex-wrap: nowrap; }
.exp-f .chip { height: 40px; flex: 1; justify-content: center; border-radius: var(--r-s); }
.exps { border: 1px solid var(--rule); border-radius: var(--r-s); max-height: 300px; overflow: auto; }
.ex { display: grid; grid-template-columns: 84px auto minmax(0, 1fr) auto 32px; gap: 12px; align-items: center; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.ex:last-child { border-bottom: 0; }
.ex-d { color: var(--ink-3); }
.ex-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.listempty { padding: 18px; text-align: center; color: var(--ink-3); }
.danger-c { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-color: color-mix(in srgb, var(--loss) 30%, var(--rule)); }
.danger-c h3 { font: 500 16px var(--f-disp); margin-bottom: 4px; }
.savebar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 20px;
  padding: 10px 10px 10px 20px; background: var(--ink); color: var(--paper); border-radius: var(--r-m); box-shadow: var(--shadow-pop); font-weight: 500;
}
.savebar .btn { background: transparent; color: var(--paper); border-color: color-mix(in srgb, var(--paper) 30%, transparent); }
.savebar .btn:hover { background: color-mix(in srgb, var(--paper) 12%, transparent); }
.savebar .btn.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.sb-b { display: flex; gap: 8px; }

/* ================= подключение ================= */
.noshop .main { max-width: 1120px; }
.nstop { display: flex; align-items: center; justify-content: space-between; margin-bottom: 40px; }
.nstop .r { display: flex; align-items: center; gap: 8px; }
.connect { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.cn-l { padding: 32px 36px; display: flex; flex-direction: column; gap: 18px; }
.cn-l h2 { font: 500 20px/1.2 var(--f-disp); letter-spacing: -.01em; }
.cn-r h3 { font: 500 16px/1.2 var(--f-disp); letter-spacing: -.01em; }
.cn-r { padding: 32px 36px; background: var(--sheet-2); border-left: 1px solid var(--rule); display: flex; flex-direction: column; gap: 18px; border-radius: 0 var(--r-m) var(--r-m) 0; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; align-items: flex-start; gap: 14px; }
.steps b { width: 28px; height: 28px; border-radius: 50%; background: var(--sheet); border: 1.5px solid var(--brass); color: var(--brass); display: grid; place-items: center; font: 600 13px var(--f-disp); flex: none; }
.steps span { padding-top: 3px; }
.sec-l { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; margin-top: auto; }
.sec-l svg { width: 18px; height: 18px; color: var(--brass); flex: none; }
.cn-l .btn.lg, .cn-r .btn { align-self: flex-start; }
.mdl .connect { margin: -24px; }

/* ================= окна, выпадающие, тосты ================= */
.ovl { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--ink) 45%, transparent); opacity: 0; transition: opacity .18s var(--ease); overflow-y: auto; }
.ovl.in { opacity: 1; }
.mdl { width: 100%; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-m); box-shadow: var(--shadow-pop); outline: none; transform: translateY(10px); transition: transform .2s var(--ease); }
.ovl.in .mdl { transform: none; }
.mdl-h { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 16px 16px 24px; border-bottom: 1px solid var(--rule); }
.mdl-t { font: 500 16px/1.2 var(--f-disp); letter-spacing: -.01em; }
.x { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); }
.x:hover { background: var(--sheet-2); color: var(--ink); }
.x svg { width: 20px; height: 20px; }
.mdl-b { padding: 24px; overflow: auto; flex: 1; min-height: 0; }
.mdl-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--rule); background: var(--sheet-2); border-radius: 0 0 var(--r-m) var(--r-m); }
.ask-b { display: flex; flex-direction: column; gap: 14px; }
.ask-t { color: var(--ink-2); }
.ask-in { display: flex; flex-direction: column; gap: 8px; }
.range-g { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.range-l { margin-bottom: 8px; color: var(--ink-3); }
.range-l b { color: var(--ink); font-weight: 600; }
.cal { width: 100%; max-width: 320px; }
.cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-t { font-weight: 600; }
.cal-w, .cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-w span { font-size: 12px; color: var(--ink-3); padding: 6px 0; }
.day { aspect-ratio: 1; max-height: 40px; border-radius: 8px; font-weight: 500; font-variant-numeric: tabular-nums; }
.day:hover:not(:disabled) { background: var(--sheet-2); }
.day.today { box-shadow: inset 0 0 0 1.5px var(--brass); }
.day.on { background: var(--ink); color: var(--paper); }
.day:disabled { color: var(--ink-3); opacity: .35; pointer-events: none; }
.cal-pop { padding: 12px; width: 296px; }

.pop { position: fixed; z-index: 200; background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; max-height: 60vh; overflow: auto; animation: popin .15s var(--ease); }
@keyframes popin { from { opacity: 0; transform: translateY(-4px); } }
.opts { display: flex; flex-direction: column; gap: 2px; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; text-align: left; min-height: 40px; }
.opt:hover, .opt:focus { background: var(--sheet-2); outline: none; }
.opt.on { font-weight: 600; }
.opt-l { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-ck { color: var(--brass); display: grid; }
.opt .ic { width: 18px; height: 18px; display: block; }
.opt .ic svg, .opt-ck svg { width: 18px; height: 18px; }
.opt-sep { height: 1px; background: var(--rule); margin: 4px 6px; }
.sel { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--sheet); text-align: left; }
.sel:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--rule)); }
.sel.open { border-color: var(--brass); }
.sel-v { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel .ic, .sel .sel-c { width: 18px; height: 18px; display: block; color: var(--ink-3); }
.sel .ic svg, .sel-c svg { width: 18px; height: 18px; }

#toasts { position: fixed; z-index: 300; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; background: var(--ink); color: var(--paper); border-radius: var(--r-s); box-shadow: var(--shadow-pop); font-weight: 500; pointer-events: auto; animation: tin .2s var(--ease); max-width: min(420px, calc(100vw - 32px)); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .22s, transform .22s; }
.toast-i { display: grid; color: var(--gain); } .toast.err .toast-i { color: var(--loss); }
.toast-i svg { width: 18px; height: 18px; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.tip { position: fixed; z-index: 400; background: var(--ink); color: var(--paper); padding: 6px 10px; border-radius: 8px; font-size: 12px; max-width: 260px; pointer-events: none; line-height: 1.4; }

/* ---------- csv ---------- */
.csv-g { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: stretch; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; min-height: 190px; padding: 24px; border: 1.5px dashed color-mix(in srgb, var(--brass) 60%, var(--rule)); border-radius: var(--r-m); background: var(--brass-soft); cursor: pointer; transition: background .15s; }
.drop:hover, .drop.over { background: color-mix(in srgb, var(--brass-soft) 70%, var(--brass)); }
.drop svg { width: 28px; height: 28px; color: var(--brass); }
.csv-info { font-size: 13px; color: var(--ink-2); margin-top: 10px; min-height: 18px; }
.ptable { border: 1px solid var(--rule); border-radius: var(--r-s); overflow: hidden; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--rule); }
.prow:last-child { border-bottom: 0; }
.prow.head { background: var(--sheet-2); color: var(--ink-3); font-size: 12px; }
.csv-prev { min-height: 190px; display: flex; flex-direction: column; justify-content: center; }
.csv-prev .ph { color: var(--ink-3); text-align: center; }
.csv-res { display: flex; flex-direction: column; gap: 12px; }
.res-t { display: flex; gap: 20px; align-items: baseline; }
.sku-l { display: flex; flex-wrap: wrap; gap: 6px; }
.sku { padding: 2px 8px; border-radius: 6px; background: var(--sheet-2); font-size: 12px; }

/* ================= адаптив ================= */
@media (min-width: 1500px) {
  .hero { grid-template-columns: minmax(440px, .9fr) minmax(0, 1.1fr); }
}
@media (max-width: 1279px) {
  .shell { grid-template-columns: 72px minmax(0, 1fr); }
  .side { padding: 16px 10px; align-items: center; gap: 16px; }
  .side .brand span, .nav-i .lbl, .tbtn .lbl, .uname { display: none; }
  .side .brand { padding: 4px; }
  .spine { width: 44px; height: 44px; padding: 0; border-left-width: 6px; align-items: center; justify-content: center; }
  .spine .sp-name, .spine .sp-meta { display: none; }
  .spine::after { display: none; }
  .spine .sp-ini { display: block; font-weight: 600; font-size: 16px; }
  .nav-i, .tbtn { justify-content: center; padding: 0; width: 44px; }
  .side-f { align-items: center; }
  .side-f .row { padding: 10px 0 0; flex-direction: column; }
  .main { padding: 28px 28px 64px; }
  .hero { grid-template-columns: minmax(340px, 1fr) minmax(0, 1.1fr); }
  .hero-l { padding-left: 36px; }
  .ptbl { --cols: minmax(180px, 1fr) 64px 100px 104px 92px 108px 100px 40px; }
  .or { grid-template-columns: 48px 100px minmax(0, 1fr) 90px 112px 112px 24px; }
  .od { padding-left: 160px; gap: 28px; }
}
@media (max-width: 1099px) {
  .mets { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .met { grid-column: span 2; }
  .met:nth-child(n+4) { grid-column: span 3; }
  .g2, .g-eq { grid-template-columns: minmax(0, 1fr); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 > :last-child { grid-column: 1 / -1; }
  .sgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .mtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; padding: 10px 12px 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--paper); border-bottom: 1px solid var(--rule); }
  .mtop .brand img { width: 30px; height: 30px; }
  .mtop .brand span { display: none; }
  .mtop .spine { flex: 1; width: auto; min-width: 0; height: 44px; padding: 0 10px 0 12px; border-left-width: 6px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; }
  .mtop .spine .sp-name { display: block; padding: 0; flex: 1; font-size: 14px; }
  .mtop .spine .sp-meta { display: flex; flex: none; }
  .mtop .spine .sp-meta .st { display: none; }
  .mtop .spine .sp-ini { display: none; }
  .mtop .spine::after { display: none; }
  .mtop .spine .chv { display: block; width: 16px; height: 16px; color: var(--ink-3); flex: none; }
  .mtop .spine .chv svg { width: 16px; height: 16px; }
  .mnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--sheet); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
  .mnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 58px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); position: relative; }
  .mnav a .ic svg { width: 22px; height: 22px; }
  .mnav a.on { color: var(--ink); }
  .mnav a.on .ic { color: var(--brass); }
  .mnav a.on::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--brass); border-radius: 0 0 2px 2px; }
  .main { padding: 20px 16px calc(84px + env(safe-area-inset-bottom)); }
  .noshop .main { padding-bottom: 32px; }
  .phead { margin-bottom: 16px; gap: 12px; }
  .phead h1 { font-size: 20px; width: 100%; }
  .seg:not(.mini) { display: flex; width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px; gap: 8px; border: 0; background: none; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg:not(.mini) button { height: 36px; border: 1px solid var(--rule); background: var(--sheet); border-radius: var(--r-pill); flex: none; }
  .seg:not(.mini) button.on { border-color: var(--brass); background: var(--brass-soft); box-shadow: none; }

  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-l { border-right: 0; border-bottom: 1px solid var(--rule); padding: 22px 20px 20px 30px; }
  .hero-r { padding: 20px 20px 16px 30px; }
  .hero::before { left: 14px; }
  .mets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .met, .met:nth-child(n+4) { grid-column: span 1; }
  .met:last-child { grid-column: 1 / -1; }
  .met-v { font-size: 24px; }
  .ch-card { padding: 16px 16px 8px; }
  .lst { padding: 16px; }

  .tools { gap: 8px; }
  .search { flex: 1 1 100%; max-width: none; }
  .tools .sp { display: none; }
  .tools .chips { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .tools .chips::-webkit-scrollbar { display: none; }
  .tools .chip { flex: none; }
  .sel.m-sort { display: flex; flex: 1 1 100%; width: 100%; }
  .btn-csv { flex: 1 1 100%; }
  .pt-h { display: none; }
  .ptbl { background: none; border: 0; border-radius: 0; overflow: visible; }
  .pt-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
  .pt-r, .pt-t { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 12px; column-gap: 8px; padding: 16px; border: 1px solid var(--rule); border-radius: var(--r-m); background: var(--sheet); align-items: start; min-height: 0; }
  .pt-r { grid-template-areas: 'nm nm cls' 'profit mg qty' 'cost cost cost'; }
  .pt-t { grid-template-areas: 'lbl lbl lbl' 'profit mg qty'; border-top: 3px double var(--ink-2); background: var(--sheet-2); margin-top: 4px; }
  .pt-t .lbl { grid-area: lbl; }
  .pt-r:hover { background: var(--sheet); }
  .pt-r.neg-r { background: linear-gradient(90deg, var(--loss-soft), var(--sheet) 70%); box-shadow: none; border-left: 4px solid var(--loss); }
  .pt-r .nm { grid-area: nm; padding: 0; }
  .pt-r .nm b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .c-cls { grid-area: cls; justify-self: end; }
  .c-profit { grid-area: profit; } .c-mg { grid-area: mg; } .c-qty { grid-area: qty; } .c-cost { grid-area: cost; }
  .c-rev, .c-ppu, .pt-t .c-cost, .pt-t .c-cls { display: none; }
  .lb { display: block !important; font-size: 12px; color: var(--ink-3); margin-bottom: 2px; font-weight: 400; }
  .c-profit, .c-mg, .c-qty { text-align: left !important; }
  .c-profit .m { font-size: 17px; font-weight: 600; }
  .mg, .c-mg { align-items: flex-start; }
  .cost-c { justify-content: stretch; }
  .cost { max-width: none; border: 1px solid var(--rule); background: var(--sheet); min-height: 42px; text-align: left; }
  .cost.empty::placeholder { text-align: left; }

  .or { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'tm cd st' 'it it it' 'sm sm pr'; row-gap: 8px; column-gap: 12px; padding: 14px 16px; }
  .or .tm { grid-area: tm; } .or .cd { grid-area: cd; } .or .st { grid-area: st; justify-self: end; } .or .it { grid-area: it; white-space: normal; }
  .or .sm { grid-area: sm; text-align: left; } .or .pr { grid-area: pr; } .or .chv { display: none; }
  .or .lb { display: inline !important; margin-right: 6px; margin-bottom: 0; }
  .od { grid-template-columns: minmax(0, 1fr); padding: 4px 16px 18px; gap: 16px; }
  .dh { padding: 12px 16px; }
  .dh-s { gap: 4px 16px; font-size: 12.5px; }

  .savebar { bottom: calc(72px + env(safe-area-inset-bottom)); left: 12px; right: 12px; transform: none; justify-content: space-between; gap: 8px; }
  .savebar > span { font-size: 13px; }
  #toasts { right: 12px; left: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .nstop { margin-bottom: 24px; }
}
@media (max-width: 719px) {
  .connect { grid-template-columns: minmax(0, 1fr); }
  .cn-r { border-left: 0; border-top: 1px solid var(--rule); border-radius: 0 0 var(--r-m) var(--r-m); }
  .cn-l, .cn-r { padding: 24px 20px; }
  .csv-g, .range-g { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .g3 { grid-template-columns: minmax(0, 1fr); }
  .fgrid.c3, .fgrid.c2 { grid-template-columns: 1fr; }
  .ovl { padding: 12px; align-items: end; }
  .mdl { max-height: calc(100vh - 24px); }
  .mdl-b { padding: 20px 16px; }
  .mdl .connect { margin: -20px -16px; }
  .mdl-h { padding-left: 16px; } .mdl-f { padding: 12px 16px; }
  .danger-c { flex-direction: column; align-items: stretch; }
  .sheetc { padding: 18px 16px 20px; }
  .exp-f { grid-template-columns: 1fr; }
  .ex { grid-template-columns: 70px auto minmax(0, 1fr) auto 32px; gap: 8px; padding-left: 10px; }
  .ex-n { display: none; }
  .job { grid-template-columns: 10px 96px minmax(0, 1fr); }
  .rb-row { grid-template-columns: minmax(0, 1fr) auto 50px; grid-template-areas: 'n a p' 't t t'; row-gap: 4px; padding: 7px 0; }
  .rb-row .rb-n { grid-area: n; } .rb-row .rb-a { grid-area: a; } .rb-row .rb-p { grid-area: p; } .rb-row .rb-t { grid-area: t; }
  .rb-row.tot .rb-t { display: none; }
  .rb-row.tot { padding-top: 10px; }
  .hero-v { font-size: 40px; }
  .cat { grid-template-columns: minmax(0, 1fr) 132px; }
  .cat-r .sfx { width: 90px; }
  .range-g .cal { max-width: none; }
}

/* ---------- мелочи ---------- */
.main-w { min-width: 0; }
.demo-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r-s); background: var(--brass-soft); border: 1px solid color-mix(in srgb, var(--brass) 35%, transparent); }
.demo-card b { font-weight: 600; }
.demo-card .btn { background: var(--sheet); }
@media (max-width: 1279px) { .demo-card { display: none; } }
@media (max-width: 719px) {
  .banner { flex-wrap: wrap; }
  .banner-t { flex: 1 1 calc(100% - 40px); }
  .banner .btn { width: 100%; }
}
.demo-note .ic svg { width: 20px; height: 20px; color: var(--brass); }
