/* ================= the stock of a salon (spec docs/niches/beauty/05-stock-tech.md) =================
   The page #/stock, its sheets (receipt, write-off, count, transfer, document, material), the materials of a visit,
   the tech card of the price list, the report «Материалы и маржа». Theme tokens only: every niche theme, light or
   dark, gives the colours. Phones (≤ 599px): one column, nothing wider than the screen. */

/* ---------- the head: branch, debt, documents ---------- */
.stk-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.stk-head__info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex: 1 1 260px; min-width: 0; }
.stk-head__acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.stk-act-more { display: none; width: 44px; padding: 0; }
.stk-branches { flex-wrap: wrap; overflow: visible; }
.stk-debt { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; text-align: left; }
.stk-debt span { overflow-wrap: anywhere; }
.stk-debt:hover { box-shadow: inset 0 0 0 1px currentColor; }

/* ---------- the tabs ---------- */
.stk-tabs { display: flex; gap: 2px; margin: 0 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.stk-tabs::-webkit-scrollbar { display: none; }
.stk-tabs a { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 44px; padding: 0 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.stk-tabs a:hover { color: var(--ink); }
.stk-tabs a.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.stk-tabs__n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); font-size: 11.5px; font-weight: 700; }

/* ---------- the three numbers ---------- */
.stk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.stk-stat { display: grid; align-content: start; gap: 2px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: inherit; transition: border-color .15s; }
a.stk-stat:hover { border-color: var(--accent); }
.stk-stat small { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.stk-stat b { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; overflow-wrap: anywhere; }
.stk-stat__sub { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.stk-stat.is-alert { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.stk-stat.is-alert b { color: var(--bad); }

/* ---------- search, filters, empty states ---------- */
.stk-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 4px; }
.stk-search { flex: 1 1 240px; min-width: 0; max-width: 420px; }
.stk-filter, .stk-kinds { flex-wrap: wrap; overflow: visible; }
.stk-kinds { margin-bottom: 12px; }
.stk-intro { max-width: 72ch; margin-bottom: 10px; }
.stk-more-hint { margin-top: 8px; }
.stk-fresh { display: grid; justify-items: center; gap: 8px; padding: 28px 20px; text-align: center; }
.stk-fresh__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); }
.stk-fresh__icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.stk-fresh p { max-width: 46ch; }
.stk-fresh__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }

/* ---------- lists ---------- */
/* a card that clips its rows to its corners. In a sheet's body (a grid of limited height) a box with overflow: hidden
   is squeezed to the room left and its rows hide behind the next field: clip does not make it a scroll container, and
   the rows of the stock's sheets take the height of their content (the body scrolls) */
.stk-list, .stk-crows, .stk-dlines, .stk-hist { overflow: hidden; overflow: clip; }
.stk-sheet .sheet__body.form-grid { grid-auto-rows: max-content; }
.stk-group { margin-top: 18px; }
.stk-group .section__head { margin-bottom: 6px; }
.stk-group__n { font-size: 12px; }

/* a material in the branch */
.stk-row {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.1fr) 96px;
  grid-template-areas: "main qty state value"; gap: 12px; align-items: center;
  width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line);
}
.stk-row:last-child { border-bottom: 0; }
.stk-row:hover { background: var(--surface); }
.stk-row__main { grid-area: main; }
.stk-row__qty { grid-area: qty; }
.stk-row__state { grid-area: state; align-items: flex-start; }
.stk-row__value { grid-area: value; text-align: right; font-size: 13.5px; color: var(--ink-2); }
.stk-row__main, .stk-row__qty, .stk-row__state { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stk-row__main b { font-weight: 600; overflow-wrap: anywhere; }
.stk-row__qty b { font-weight: 600; }
.stk-row small { font-size: 12.5px; overflow-wrap: anywhere; }
.stk-row__state small { color: var(--ink-2); }
.stk-row.is-ordered .stk-row__state small { color: var(--accent-text); font-weight: 600; }
.stk-row.is-low .stk-row__qty b { color: var(--warn); }
.stk-row.is-out .stk-row__qty b, .stk-row.is-negative .stk-row__qty b { color: var(--bad); }
.stk-row--untracked { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main qty"; }
.stk-row--untracked .stk-row__qty { align-items: flex-end; text-align: right; }
.stk-untracked .card { border-style: dashed; background: var(--surface); }
.stk-untracked .stk-row:hover { background: var(--surface-2); }
.stk-untracked__hint { margin: -2px 2px 8px; max-width: 72ch; }

/* a state: an icon and a word; "in order" stays quiet */
.stk-status { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.stk-status.is-ok { padding-left: 0; background: none; color: var(--ink-3); font-weight: 500; }
.stk-status.is-low { background: var(--warn-soft); color: var(--warn); }
.stk-status.is-out, .stk-status.is-negative { background: var(--bad-soft); color: var(--bad); }

/* ---------- «Заказать» ---------- */
.stk-supplier { margin-top: 18px; }
.stk-supplier .section__head { align-items: baseline; }
.stk-supplier__name { font-size: 15px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.stk-supplier__sum { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.stk-supplier__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.stk-oline {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 140px 96px;
  grid-template-areas: "main status packs sum" "ordered ordered packs sum";
  column-gap: 12px; row-gap: 2px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.stk-oline:last-child { border-bottom: 0; }
.stk-oline__main { grid-area: main; display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
.stk-oline__main b { font-weight: 600; overflow-wrap: anywhere; }
.stk-oline__main:hover b { text-decoration: underline; text-underline-offset: 3px; }
.stk-oline__main small { font-size: 12.5px; overflow-wrap: anywhere; }
.stk-oline__status { grid-area: status; }
.stk-oline__packs { grid-area: packs; }
.stk-oline__sum { grid-area: sum; text-align: right; font-weight: 600; white-space: nowrap; }
.stk-oline__ordered { grid-area: ordered; font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.stk-oline__ordered:empty { display: none; }
.stk-oline.is-ordered { background: var(--accent-wash); }
.stk-oline.has-error .input { border-color: var(--bad); }

/* ---------- «Документы» ---------- */
.stk-doc {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; grid-template-areas: "icon main tags total";
  gap: 12px; align-items: center; width: 100%; min-height: 60px; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line);
}
.stk-doc:last-child { border-bottom: 0; }
.stk-doc:hover { background: var(--surface); }
.stk-doc__icon { grid-area: icon; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface); color: var(--ink-2); }
.stk-doc.is-receipt .stk-doc__icon { background: var(--ok-soft); color: var(--ok); }
.stk-doc.is-writeoff .stk-doc__icon { background: var(--bad-soft); color: var(--bad); }
.stk-doc.is-count .stk-doc__icon { background: var(--accent-soft); color: var(--accent-text); }
.stk-doc__main { grid-area: main; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stk-doc__main b { font-weight: 600; overflow-wrap: anywhere; }
.stk-doc__main small { font-size: 12.5px; overflow-wrap: anywhere; }
.stk-doc__tags { grid-area: tags; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.stk-doc__tags:empty { display: none; }
.stk-doc__total { grid-area: total; text-align: right; font-weight: 600; white-space: nowrap; }
.stk-doc.is-voided .stk-doc__main b, .stk-doc.is-voided .stk-doc__total { color: var(--ink-3); text-decoration: line-through; }
.tag--bad { background: var(--bad-soft); color: var(--bad); }
.tag--accent { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- «Материалы» ---------- */
.stk-mat {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "main price meta";
  gap: 12px; align-items: center; width: 100%; min-height: 56px; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line);
}
.stk-mat:last-child { border-bottom: 0; }
.stk-mat:hover { background: var(--surface); }
.stk-mat__main { grid-area: main; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stk-mat__main b { font-weight: 600; overflow-wrap: anywhere; }
.stk-mat__main small { font-size: 12.5px; overflow-wrap: anywhere; }
.stk-mat__price { grid-area: price; font-size: 13.5px; }
.stk-mat__meta { grid-area: meta; font-size: 12.5px; color: var(--ink-2); text-align: right; overflow-wrap: anywhere; }

/* the documents beside the receipt, on a phone */
.stk-acts__item { display: inline-flex; align-items: center; gap: 10px; }
.stk-acts__item .ic { color: var(--ink-2); }

/* ---------- sheets: inputs with a unit, quantities in packs or units ---------- */
.stk-sheet .kv dd { min-width: 0; overflow-wrap: anywhere; }
.stk-num { position: relative; display: block; min-width: 0; }
.stk-num .input { padding-right: 56px; text-align: right; }
.stk-num__unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); max-width: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-size: 13px; pointer-events: none; }
/* a box says what it takes until it is filled; before a material is picked there is no unit, its room goes to the words */
.stk-num .input, .stk-qty__box .input { text-overflow: ellipsis; }
.stk-num .input::placeholder, .stk-qty__box .input::placeholder { font-size: 13px; }
.stk-num:has(> .stk-num__unit:empty) .input { padding-right: 12px; }
/* «₼» is one sign: the price of a pack keeps the rest of the box for its words */
.stk-line__price .input { padding-right: 28px; }
/* a wide receipt names its columns in the head row: there the boxes stay clean (a phone has no head, its boxes speak) */
@media (min-width: 600px) { .stk-line--receipt .input::placeholder { color: transparent; } }
.stk-qty { display: grid; gap: 2px; min-width: 0; }
.stk-qty__box { display: flex; align-items: stretch; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; transition: border-color .15s; }
.stk-qty__box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus-ring); }
.stk-qty__box .input { flex: 1; min-width: 0; border: 0; border-radius: 0; text-align: right; box-shadow: none; }
.stk-qty__unit { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: none; min-width: 68px; max-width: 96px; padding: 0 10px; border-left: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.stk-qty__unit span { overflow: hidden; text-overflow: ellipsis; }
.stk-qty__unit:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.stk-qty__unit:disabled { cursor: default; }
.stk-qty__unit.is-fixed .ic { display: none; }
.stk-qty__conv { min-height: 16px; font-size: 12px; color: var(--ink-3); }
.stk-qty.has-error .stk-qty__box { border-color: var(--bad); }
.stk-choice .chip { min-height: 44px; padding: 0 14px; }
.stk-at .segmented { justify-self: start; }

/* lines of a document */
.stk-lines__rows { display: grid; }
.stk-lines__head { display: grid; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 12px; font-weight: 600; }
.stk-lines__right { text-align: right; }
.stk-lines__add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.stk-line { display: grid; gap: 4px 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stk-line__mat { grid-area: mat; }
.stk-line__del { grid-area: del; width: 36px; height: 36px; color: var(--ink-3); }
.stk-line__hint { grid-area: hint; font-size: 12px; color: var(--ink-3); }
.stk-line__hint:empty { display: none; }
.stk-line.has-error .select, .stk-line.has-error .stk-num .input, .stk-line.has-error .stk-qty__box { border-color: var(--bad); }
/* a receipt's line: the material, packs, the price of a pack, the sum; under it what it comes to and «подарок» */
.stk-line--receipt { grid-template-columns: minmax(0, 1fr) 112px 124px 92px 36px; grid-template-areas: "mat packs price sum del" "hint hint hint gift gift"; }
.stk-lines__head.stk-line--receipt { grid-template-areas: none; }
.stk-line__packs { grid-area: packs; }
.stk-line__price { grid-area: price; }
.stk-line__gift { grid-area: gift; justify-self: end; min-height: 36px; gap: 6px; font-size: 13px; white-space: nowrap; }
.stk-line__sum { grid-area: sum; text-align: right; font-weight: 600; white-space: nowrap; }
.stk-line.is-gift .stk-line__sum { color: var(--ok); }
/* a write-off's or a transfer's line: the material, the quantity; under the quantity «Остаток вскрытой упаковки» */
.stk-line--qty { grid-template-columns: minmax(0, 1fr) 220px 36px; grid-template-areas: "mat qty del" "hint open open"; align-items: start; }
.stk-line--qty.has-tick { grid-template-columns: 28px minmax(0, 1fr) 220px 36px; grid-template-areas: "tick mat qty del" ". hint open open"; }
.stk-line__tick { grid-area: tick; display: grid; place-items: center; min-height: 44px; cursor: pointer; }
.stk-line__tick input { width: 20px; height: 20px; accent-color: var(--accent); }
.stk-line__qty { grid-area: qty; min-width: 0; }
.stk-line__open { grid-area: open; justify-self: start; min-height: 32px; padding: 0 8px; white-space: normal; text-align: left; line-height: 1.2; }
.stk-line--qty .stk-line__del { margin-top: 4px; }
@media (min-width: 960px) { .sheet--wide.stk-sheet { width: 860px; } }
.stk-line.is-off .stk-line__mat, .stk-line.is-off .stk-line__qty, .stk-line.is-off .stk-line__open { opacity: .45; }

/* the sum of a receipt */
.stk-sum { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); }
.stk-sum__discount { width: 190px; max-width: 100%; }
.stk-sum__total { display: grid; gap: 2px; margin-left: auto; text-align: right; }
.stk-sum__total > div { display: flex; justify-content: flex-end; align-items: baseline; gap: 12px; color: var(--ink-2); font-size: 13px; }
.stk-sum__main dd { color: var(--ink); font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.stk-sum__value { color: var(--ink-2); font-size: 14px; text-align: right; }
.stk-sum__value:empty { display: none; }
.stk-route .field { min-width: 0; }

/* ---------- the inventory ---------- */
.stk-count__tools { position: sticky; top: -8px; z-index: 2; display: grid; gap: 10px; margin: -8px -20px 0; padding: 8px 20px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.stk-count__filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.stk-count__groups { flex-wrap: wrap; overflow: visible; }
.stk-when { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.stk-when label { min-height: 44px; padding: 6px 8px; line-height: 1.25; text-align: center; white-space: normal; }
.stk-cgroup { padding: 10px 14px 4px; background: var(--surface); color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.stk-cgroup + .stk-crow { border-top: 0; }
.stk-crow { display: grid; grid-template-columns: minmax(0, 1fr) 220px 88px; grid-template-areas: "name qty diff"; gap: 12px; align-items: start; padding: 10px 14px; border-top: 1px solid var(--line); }
.stk-crows > .stk-crow:first-child { border-top: 0; }
.stk-crow__name { grid-area: name; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-top: 4px; }
.stk-crow__name b { font-weight: 600; overflow-wrap: anywhere; }
.stk-crow__name small { font-size: 12.5px; overflow-wrap: anywhere; }
.stk-crow__qty { grid-area: qty; min-width: 0; }
.stk-crow__diff { grid-area: diff; padding-top: 12px; color: var(--ink-3); font-size: 14px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.stk-crow.is-done { background: var(--accent-wash); }
.stk-crow.is-minus .stk-crow__diff { color: var(--bad); }
.stk-crow.is-plus .stk-crow__diff { color: var(--ok); }
.stk-count__foot { flex-wrap: wrap; align-items: center; }
.stk-count__sum { flex: 1 1 100%; color: var(--ink-2); font-size: 13px; }
@media (min-width: 640px) { .stk-count__sum { flex: 1 1 auto; margin-right: auto; } }

/* ---------- a document ---------- */
.stk-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.stk-tags:empty { display: none; }
.stk-dline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name qty sum"; gap: 12px; align-items: center; padding: 10px 14px; }
.stk-dline + .stk-dline { border-top: 1px solid var(--line); }
.stk-dline__name { grid-area: name; display: flex; flex-direction: column; min-width: 0; }
.stk-dline__name b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.stk-dline__name small { font-size: 12.5px; overflow-wrap: anywhere; }
.stk-dline__qty { grid-area: qty; color: var(--ink-2); font-size: 13.5px; text-align: right; white-space: nowrap; }
.stk-dline__sum { grid-area: sum; min-width: 72px; text-align: right; white-space: nowrap; }
.stk-dline.is-minus .stk-dline__qty { color: var(--bad); font-weight: 600; }
.stk-dline.is-plus .stk-dline__qty { color: var(--ok); font-weight: 600; }
.stk-dtotal { display: grid; gap: 4px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); }
.stk-dtotal > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.stk-dtotal > div:last-child { font-weight: 600; }
.stk-dtotal > div:last-child dd { font-family: var(--font-display); font-size: 18px; }
.stk-sheet.is-voided .stk-dlines, .stk-sheet.is-voided .stk-dtotal { opacity: .6; }
.stk-link { min-height: 32px; padding: 0 8px; color: var(--accent-text); }
.stk-doc-foot { flex-wrap: wrap; }

/* ---------- a material ---------- */
.stk-unit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; max-width: 420px; }
.stk-mc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); }
.stk-mc-bal { display: grid; gap: 2px; min-width: 0; }
.stk-mc-bal small { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.stk-mc-bal b { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.stk-mc-bal span { font-size: 13px; overflow-wrap: anywhere; }
.stk-sheet.is-untracked .stk-mc-bal b { color: var(--ink-2); font-size: 18px; }
.stk-mc-kv { margin-bottom: 12px; }
.stk-mc-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.stk-mc-hist { margin: 18px 0 8px; }
.stk-hist li + li { border-top: 1px solid var(--line); }
.stk-hrow { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; min-height: 52px; padding: 9px 12px; text-align: left; }
.stk-hrow:not(:disabled):hover { background: var(--surface); }
.stk-hrow:disabled { cursor: default; }
.stk-hrow__icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface); color: var(--ink-2); }
.stk-hrow.is-receipt .stk-hrow__icon, .stk-hrow.is-transfer_in .stk-hrow__icon { background: var(--ok-soft); color: var(--ok); }
.stk-hrow.is-writeoff .stk-hrow__icon { background: var(--bad-soft); color: var(--bad); }
.stk-hrow.is-count .stk-hrow__icon { background: var(--accent-soft); color: var(--accent-text); }
.stk-hrow__main { display: flex; flex-direction: column; min-width: 0; }
.stk-hrow__main b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.stk-hrow__main small { font-size: 12px; overflow-wrap: anywhere; }
.stk-hrow__qty { color: var(--ok); font-weight: 600; white-space: nowrap; }
.stk-hrow.is-minus .stk-hrow__qty { color: var(--ink); }
.stk-hrow.is-voided { opacity: .55; }
.stk-hrow.is-voided .stk-hrow__qty { text-decoration: line-through; }

/* ---------- the materials of a visit ---------- */
.vm { display: grid; gap: 8px; }
.vm__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.vm__head .section__title { margin: 0; }
.vm__acts { display: flex; flex-wrap: wrap; gap: 6px; }
.vm__mode { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: 13.5px; }
.vm__mode .ic { flex: none; margin-top: 2px; color: var(--ink-3); }
.vm__mode span { min-width: 0; overflow-wrap: anywhere; }
.vm[data-mode="written"] .vm__mode { background: var(--ok-soft); color: color-mix(in srgb, var(--ok) 70%, var(--ink)); }
.vm[data-mode="written"] .vm__mode .ic { color: var(--ok); }
.vm[data-mode="none"] .vm__mode { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 62%, var(--ink)); }
.vm[data-mode="none"] .vm__mode .ic { color: var(--warn); }
.vm[data-mode="own"] .vm__mode { background: var(--accent-wash); color: var(--ink); }
.vm__lines { display: grid; }
.vm-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: baseline; padding: 7px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.vm-line:last-child { border-bottom: 0; }
.vm-line__name { min-width: 0; overflow-wrap: anywhere; }
.vm-line__tags { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.vm-line__tags:empty { display: none; }
.vm-line__tags .tag { padding: 0 6px; font-size: 11px; }
.vm-line__qty { font-weight: 600; white-space: nowrap; }
.vm-line__cost { min-width: 56px; color: var(--ink-3); font-size: 13px; text-align: right; white-space: nowrap; }
.vm-line__cost:empty { min-width: 0; }
.vm__disp summary { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 2px; color: var(--ink-2); font-size: 13.5px; cursor: pointer; list-style: none; }
.vm__disp summary::-webkit-details-marker { display: none; }
.vm__disp summary .ic { transition: transform .15s var(--ease); }
.vm__disp[open] summary .ic { transform: rotate(180deg); }
.vm__disp .vm-line { font-size: 13px; }
.vm__miss { display: grid; gap: 6px; }
.vm__miss:empty { display: none; }
.vm-miss { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 6px 6px 6px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 62%, var(--ink)); font-size: 13.5px; }
.vm-miss .ic { flex: none; color: var(--warn); }
.vm-miss span { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.vm__cost { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 8px 2px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.vm__cost small { color: var(--warn); font-size: 12.5px; font-weight: 500; }
.vm__cost.is-minus span { color: var(--bad); }
.vm__setup { color: var(--accent-text); font-size: 13px; font-weight: 600; }
.vm__write { justify-self: start; }
.vm-add { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); }
.vm-add.has-error .select, .vm-add.has-error .input { border-color: var(--bad); }
.vm-edit { display: grid; gap: 14px; }
.vm-edit:empty { display: none; }
.vm-edit__group .section__title { margin-bottom: 4px; }
.vm-edit__row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 44px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.vm-edit__name { display: flex; flex-direction: column; min-width: 0; }
.vm-edit__name b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.vm-edit__name small { font-size: 12px; overflow-wrap: anywhere; }
.vm-edit__row.has-error .input { border-color: var(--bad); }

/* ---------- the tech card of a service (the price list) ---------- */
.tc__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 8px; }
.tc__per { font-size: 12px; }
.tc__rows { display: grid; }
.tc-row { display: grid; grid-template-columns: minmax(0, 1fr) 136px 80px 36px; grid-template-areas: "mat qty cost del" "note note note note"; gap: 4px 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tc-row__mat { grid-area: mat; }
.tc-row__qty { grid-area: qty; }
.tc-row__cost { grid-area: cost; color: var(--ink-2); font-size: 13px; text-align: right; white-space: nowrap; }
.tc-row__del { grid-area: del; width: 36px; height: 36px; color: var(--ink-3); }
.tc-row__note { grid-area: note; color: var(--warn); font-size: 12px; }
.tc-row__note:empty { display: none; }
.tc-row.is-archived .tc-row__mat { border-color: color-mix(in srgb, var(--warn) 55%, var(--line-strong)); }
.tc-row.has-error .select, .tc-row.has-error .input { border-color: var(--bad); }
.tc__empty { padding: 6px 0; font-size: 13px; }
.tc__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.tc__sum { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 2px 8px; margin-left: auto; font-size: 14px; font-weight: 600; text-align: right; }
.tc__sum small { font-size: 12px; font-weight: 500; }
.tc-off { color: var(--warn); }

/* ---------- the master's own materials (the staff sheet) ---------- */
.stk-own { width: 100%; max-width: 420px; }
.stk-own label { white-space: normal; text-align: center; line-height: 1.25; }
.stk-own-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; margin-top: 4px; }

/* ---------- «Материалы и маржа» (the reports) ---------- */
.mrep__hint { margin-top: 8px; }
.mrep__hint:empty { display: none; }
.mrep__table { margin-top: 12px; overflow: hidden; }
.mrep__title { margin: 0; padding: 12px 14px 8px; }
.mrep__row { display: grid; grid-template-columns: minmax(140px, 1.6fr) 56px repeat(6, minmax(0, 1fr)); gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.mrep__row:last-child { border-bottom: 0; }
.mrep__head { border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-3); font-size: 12px; font-weight: 600; }
.mrep__head span:not(:first-child), .mrep__cell { text-align: right; }
.mrep__cell { min-width: 0; overflow-wrap: anywhere; }
.mrep__cell small { display: none; }
.mrep__name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mrep__name b { font-weight: 600; overflow-wrap: anywhere; }
.mrep__name .dot { width: 8px; height: 8px; border-radius: 50%; }
.mrep__row.is-over .mrep__over span { color: var(--bad); font-weight: 600; }
.mrep__row.is-loss .mrep__margin b { color: var(--bad); }
.mrep__top { margin-top: 12px; }
@media (max-width: 899px) {
  .mrep__head { display: none; }
  .mrep__row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 14px; }
  .mrep__name { grid-column: 1 / -1; }
  .mrep__cell { display: flex; flex-direction: column; text-align: left; }
  .mrep__cell small { display: block; color: var(--ink-3); font-size: 11.5px; }
}

/* ---------- phones ---------- */
@media (max-width: 599px) {
  .stk-head__acts { width: 100%; flex-wrap: nowrap; }
  .stk-head__acts .btn--primary { flex: 1; }
  .stk-act-wide { display: none; }
  .stk-act-more { display: inline-flex; }
  .stk-stats { gap: 6px; }
  .stk-stat { padding: 10px; }
  .stk-stat small { font-size: 11px; line-height: 1.25; }
  .stk-stat b { font-size: 18px; }
  .stk-search { max-width: none; }

  .stk-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main state" "qty value"; row-gap: 4px; }
  .stk-row__state { align-items: flex-end; text-align: right; }
  .stk-row__qty { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .stk-row__value { align-self: end; }

  .stk-oline { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main status" "packs sum" "ordered ordered"; row-gap: 8px; }
  .stk-oline__packs { max-width: 180px; }
  .stk-supplier__acts .btn { flex: 1 1 auto; }

  .stk-doc { grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "icon main total" "icon tags tags"; row-gap: 4px; }
  .stk-doc__tags { justify-content: flex-start; }

  .stk-mat { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main price" "meta meta"; row-gap: 2px; }
  .stk-mat__meta { text-align: left; }

  .stk-lines__head { display: none; }
  .stk-line--receipt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; grid-template-areas: "mat mat del" "packs price price" "gift sum sum" "hint hint hint"; }
  .stk-line--receipt .stk-line__gift { justify-self: start; }
  .stk-line--qty, .stk-line--qty.has-tick { grid-template-columns: minmax(0, 1fr) 36px; grid-template-areas: "mat del" "qty qty" "open open" "hint hint"; }
  .stk-line--qty.has-tick { grid-template-columns: 28px minmax(0, 1fr) 36px; grid-template-areas: "tick mat del" "qty qty qty" "open open open" "hint hint hint"; }
  .stk-line__open { min-height: 44px; }
  .stk-sum__discount { width: 100%; }

  /* the inventory on a phone: the tools scroll away with the list (a sticky block would leave no room for the rows) */
  .stk-count__tools { position: static; margin: 0; padding: 0 0 10px; }
  .stk-count__filter { flex-wrap: nowrap; gap: 10px; }
  .stk-count__filter .stk-search { flex: 1 1 auto; }
  .stk-blind { flex: none; }
  .stk-count__groups { flex-wrap: nowrap; overflow-x: auto; }
  .stk-crow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name diff" "qty qty"; row-gap: 6px; }
  .stk-crow__diff { padding-top: 4px; }

  .stk-dline { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name sum" "qty qty"; row-gap: 2px; }
  .stk-dline__qty { text-align: left; }

  .stk-mc-bal b { font-size: 24px; }
  .stk-mc-acts .btn { flex: 1 1 auto; }

  .vm-add { grid-template-columns: minmax(0, 1fr) auto; }
  .vm-add .select { grid-column: 1 / -1; }
  .vm-edit__row { grid-template-columns: minmax(0, 1fr) 112px 44px; }

  .tc-row { grid-template-columns: minmax(0, 1fr) 112px 36px; grid-template-areas: "mat qty del" "note cost cost"; }
  .tc-row__cost:empty { display: none; }

  .stk-tabs a { padding: 0 9px; font-size: 13.5px; }
}

/* ---- salons: the price grid of a service (module pricing): rows the masters' levels, columns the hair lengths ---- */
.pg { gap: 8px; }
.pg__grid { display: grid; grid-template-columns: minmax(84px, 140px) repeat(var(--cols, 1), minmax(0, 1fr)); gap: 6px 8px; align-items: center; }
.pg__grid[hidden] { display: none; }
.pg__corner { min-height: 1px; }
.pg__head { font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; }
.pg__level { display: grid; gap: 1px; min-width: 0; padding-top: 2px; align-self: start; }
.pg__level b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.pg__level small { font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.pg__cell { display: grid; gap: 4px; min-width: 0; }
.pg__cell .input { min-width: 0; padding-left: 10px; padding-right: 34px; }
.pg__cell .input-wrap__unit { right: 10px; font-size: 12px; }
.pg__cell .input::placeholder { color: var(--ink-3); opacity: 1; }
.pg__cell--base .input { font-weight: 600; }
.pg__cell.has-error .input { border-color: var(--bad); }
.pg .switch { margin: 2px 0 4px; }
/* a phone: the level's name a line of its own, its prices under it across the width */
@media (max-width: 520px) {
  .pg__grid { grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); }
  .pg__corner { display: none; }
  .pg__level { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; padding-top: 6px; }
}

/* the masters' levels sheet */
.lv-list { display: grid; gap: 10px; }
.lv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 104px; gap: 8px 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.lv-row--basic { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-wash); }
.lv-row__on { grid-column: 1 / -1; }
.lv-row .input:disabled { color: var(--ink-3); }
.lv-add { justify-self: start; }
@media (max-width: 520px) {
  .lv-row { grid-template-columns: minmax(0, 1fr) 96px; }
  .lv-row > .field:first-child { grid-column: 1 / -1; }
}

/* the booking form: the hair length chips under the services */
.appt-variant .segmented { display: grid; }
.appt-variant.has-error .segmented { box-shadow: 0 0 0 1px var(--bad); border-radius: 10px; }
