/* Инвентарь: строится на классах магазина (.shop-*), здесь только своё. */
.inv { --inv-ok: #389e0d; --inv-warn: #ad6800; --inv-info: #0958d9; --inv-danger: #cf1322; }
.inv-badge {
    display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
    border-radius: 9px; background: var(--inv-danger); color: #fff; font-size: 11px; font-weight: 700;
}
.inv-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.inv-stats .shop-stat strong { font-variant-numeric: tabular-nums; }
.inv-stat-link { text-decoration: none; color: inherit; transition: border-color .15s; }
.inv-stat-link:hover, .inv-stat-link.is-on { border-color: var(--shop-blue); }
.inv-stat--danger { border-color: #ffccc7; background: #fff1f0; }
.inv-filters select { height: 40px; padding: 0 10px; border: 1px solid var(--shop-line); border-radius: 10px; background: var(--shop-card); font-size: 14px; color: var(--shop-ink); }
.inv-last-count { margin-left: auto; font-size: 13px; color: var(--shop-muted); text-decoration: none; }
.inv-last-count:hover { color: var(--shop-blue); }
.inv-muted { margin: 0; padding: 8px 0; color: var(--shop-muted); font-size: 14px; }
.inv-c-ok { color: var(--inv-ok); }
.inv-c-warn { color: var(--inv-warn); }
.inv-c-info { color: var(--inv-info); }
.inv-c-danger { color: var(--inv-danger); font-weight: 600; }

/* Таблица имущества */
.inv-wrap { background: var(--shop-card); border: 1px solid var(--shop-line); border-radius: var(--shop-radius); overflow: hidden; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.inv-table th {
    padding: 9px 14px; text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
    color: var(--shop-muted); background: var(--shop-well); border-bottom: 1px solid var(--shop-line);
}
.inv-table td { padding: 10px 14px; border-bottom: 1px solid var(--shop-line); vertical-align: middle; }
.inv-table tr:last-child td { border-bottom: 0; }
.inv-tr:hover td { background: var(--crm-hover, #f7faff); }
.inv-tr.is-archived { opacity: .55; }
.inv-table th { white-space: nowrap; }
.inv-table .c-num { width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
.inv-table .c-money { width: 130px; text-align: right; white-space: nowrap; }
.inv-table .c-branch { width: 160px; color: var(--shop-muted); }
.inv-table .c-name a { font-weight: 600; color: var(--shop-ink); text-decoration: none; }
.inv-table .c-name a:hover { color: var(--shop-blue); }
.inv-table .c-name { position: relative; padding-left: 62px; }
.inv-table .c-name small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--shop-muted); }
.inv-thumb {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; overflow: hidden;
    display: grid; place-items: center; border-radius: 9px; background: var(--crm-soft, #e6f4ff);
    color: var(--shop-blue); font-weight: 700; font-size: 15px;
}
.inv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inv-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.inv-cat {
    padding: 6px 12px; border: 1px solid var(--shop-line); border-radius: 999px; background: var(--shop-card);
    font: inherit; font-size: 13px; color: var(--shop-ink); cursor: pointer; transition: all .15s;
}
.inv-cat:hover { border-color: var(--shop-blue); color: var(--shop-blue); }
.inv-cat.is-own { border-style: solid; background: var(--shop-well); font-weight: 600; }
.inv-cat.is-on { background: var(--shop-blue); border-color: var(--shop-blue); color: #fff; }
.inv-cat:disabled { opacity: .5; cursor: default; }
.inv-opt { font-weight: 400; color: var(--shop-muted); }
.inv-photo { display: flex; gap: 14px; align-items: center; }
.inv-photo__box {
    position: relative; flex: none; width: 112px; height: 112px; display: grid; place-items: center; overflow: hidden;
    border: 2px dashed var(--shop-line); border-radius: 12px; background: var(--shop-well); cursor: pointer; transition: border-color .15s;
}
.inv-photo__box:hover { border-color: var(--shop-blue); }
.inv-photo__box img { width: 100%; height: 100%; object-fit: cover; }
.inv-photo__box input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.inv-photo__ph { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--shop-muted); text-align: center; }
.inv-photo__ph svg { width: 28px; height: 28px; }
.inv-photo__text { font-size: 12.5px; color: var(--shop-muted); line-height: 1.4; }
.inv-photo__text .shop-check { margin-top: 8px; }
.inv-num { display: inline-block; min-width: 28px; padding: 2px 8px; border-radius: 7px; font-weight: 600; }
.inv-num--ok { background: #f6ffed; color: var(--inv-ok); }
.inv-num--zero { background: var(--shop-well); color: var(--shop-muted); }
.inv-num--warn { background: #fff7e6; color: var(--inv-warn); }
.inv-num--info { background: var(--crm-soft, #e6f4ff); color: var(--inv-info); }
.inv-dash { color: var(--shop-line); }

/* Карточка */
.inv-form-layout { display: grid; gap: 16px; align-items: start; }
.inv-form-layout.has-side { grid-template-columns: minmax(0, 1fr) 340px; }
.inv-main { min-width: 0; }
.inv-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
.inv-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.inv-fieldset input[type=date], .inv-date {
    width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--shop-line); border-radius: 10px;
    background: var(--shop-card); color: var(--shop-ink); font: inherit; font-size: 15px;
}
.inv-form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 16px; text-align: center; }
.inv-summary span { display: block; font-size: 11.5px; color: var(--shop-muted); }
.inv-summary strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.inv-summary__meta { grid-column: 1 / -1; margin: 6px 0 0; font-size: 12.5px; color: var(--shop-muted); }
.inv-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.inv-acts label { position: relative; cursor: pointer; }
.inv-acts input { position: absolute; opacity: 0; pointer-events: none; }
.inv-acts span {
    display: inline-block; padding: 6px 12px; border: 1px solid var(--shop-line); border-radius: 999px;
    font-size: 13px; font-weight: 500; background: var(--shop-card); transition: all .15s;
}
.inv-acts input:checked + span { background: var(--shop-ink); border-color: var(--shop-ink); color: #fff; }
.inv-acts input:focus-visible + span { box-shadow: 0 0 0 3px var(--crm-blue-soft, rgba(22, 119, 255, .15)); }
.inv-act-hint { margin: 0 0 12px; font-size: 12.5px; color: var(--shop-muted); line-height: 1.4; }
.inv-actions .shop-field { margin-bottom: 10px; }
.inv-archive { text-align: center; }
.inv-btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* Выдачи */
.inv-subtabs { margin-bottom: 10px; }
.inv-list { padding: 4px 16px; }
.inv-issue { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--shop-line); }
.inv-issue:last-child { border-bottom: 0; }
.inv-issue.is-overdue { box-shadow: inset 3px 0 0 var(--inv-danger); padding-left: 10px; }
.inv-issue.is-returned { opacity: .7; }
.inv-issue__main { min-width: 0; }
.inv-issue__main b a { color: inherit; }
.inv-issue__what { margin-left: 6px; font-size: 14px; }
.inv-issue__main small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--shop-muted); }
.inv-issue__side { display: flex; gap: 8px; align-items: center; flex: none; }
.inv-pill--danger { background: #fff1f0; border-color: #ffa39e; color: var(--inv-danger); }

/* История */
.inv-move {
    display: grid; grid-template-columns: 112px 128px 48px minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
    padding: 8px 0; border-bottom: 1px solid var(--shop-line); font-size: 13.5px;
}
.inv-move:last-child { border-bottom: 0; }
.inv-move time { color: var(--shop-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-move__qty { font-weight: 700; color: var(--inv-ok); font-variant-numeric: tabular-nums; }
.inv-move__qty.is-minus { color: var(--inv-danger); }
.inv-move__text { min-width: 0; overflow-wrap: anywhere; }
.inv-move__text small { color: var(--shop-muted); }
.inv-move__who { font-size: 12.5px; color: var(--shop-muted); white-space: nowrap; }
.inv-kind { justify-self: start; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--shop-well); white-space: nowrap; }
.inv-kind--create, .inv-kind--add, .inv-kind--return, .inv-kind--repaired { background: #f6ffed; color: var(--inv-ok); }
.inv-kind--writeoff { background: #fff1f0; color: var(--inv-danger); }
.inv-kind--repair { background: #fff7e6; color: var(--inv-warn); }
.inv-kind--issue, .inv-kind--move { background: var(--crm-soft, #e6f4ff); color: var(--inv-info); }
.inv-kind--count { background: #f9f0ff; color: #531dab; }

/* Пересчёт */
.inv-count-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.inv-count-sum { font-size: 13px; color: var(--shop-muted); }
.inv-count { display: flex; flex-direction: column; margin-bottom: 16px; }
.inv-count__group { padding: 12px 0 4px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--shop-muted); }
.inv-count__row {
    display: grid; grid-template-columns: minmax(0, 1fr) 72px 92px 52px; gap: 10px; align-items: center;
    padding: 8px 10px; border-radius: 10px; transition: background .15s;
}
.inv-count__row + .inv-count__row { border-top: 1px solid var(--shop-line); }
.inv-count__name b { display: block; font-weight: 600; }
.inv-count__name small { font-size: 12.5px; color: var(--shop-muted); }
.inv-count__exp { text-align: center; font-variant-numeric: tabular-nums; color: var(--shop-muted); }
.inv-count__exp small { display: block; font-size: 11px; }
.inv-count__row input {
    width: 100%; height: 40px; padding: 0 8px; border: 1px solid var(--shop-line); border-radius: 10px;
    text-align: center; font-size: 16px; font-weight: 600; background: var(--shop-card); color: var(--shop-ink);
}
.inv-count__row input:focus { outline: none; border-color: var(--shop-blue); }
.inv-count__diff { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-count__row.is-ok { background: rgba(82, 196, 26, .07); }
.inv-count__row.is-ok .inv-count__diff { color: var(--inv-ok); }
.inv-count__row.is-minus { background: rgba(245, 34, 45, .06); }
.inv-count__row.is-minus .inv-count__diff { color: var(--inv-danger); }
.inv-count__row.is-plus { background: rgba(22, 119, 255, .06); }
.inv-count__row.is-plus .inv-count__diff { color: var(--inv-info); }
.inv-count--result .inv-count__row { grid-template-columns: minmax(0, 1fr) 84px 84px 52px; }
.inv-count-note { max-width: 520px; }
.inv-count-hist {
    display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--shop-line);
    font-size: 14px; color: var(--shop-ink); text-decoration: none;
}
.inv-count-hist:last-child { border-bottom: 0; }
.inv-count-hist:hover { color: var(--shop-blue); }
.inv-count-hist time { font-variant-numeric: tabular-nums; }
.inv-count-hist small { margin-left: auto; color: var(--shop-muted); }

@media (max-width: 1000px) {
    .inv-form-layout.has-side { grid-template-columns: 1fr; }
    .inv-side { position: static; }
}
@media (max-width: 760px) {
    .inv-table thead { display: none; }
    .inv-table, .inv-table tbody { display: block; }
    .inv-tr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 6px; padding: 10px 12px; border-bottom: 1px solid var(--shop-line); }
    .inv-tr:last-child { border-bottom: 0; }
    .inv-tr td { display: block; padding: 0; border: 0; width: auto !important; text-align: center; }
    .inv-tr .c-name { position: relative; }
    .inv-tr .c-name, .inv-tr .c-branch, .inv-tr .c-money { grid-column: 1 / -1; text-align: left; }
    .inv-tr .c-name { padding-left: 48px; min-height: 38px; }
    .inv-thumb { left: 0; }
    .inv-tr .c-branch { font-size: 12.5px; }
    .inv-tr .c-num::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--shop-muted); }
    .inv-tr .c-money::before { content: 'Стоимость: '; color: var(--shop-muted); font-size: 12.5px; }
    .inv-move { grid-template-columns: auto auto 1fr; }
    .inv-move__text { grid-column: 1 / -1; }
    .inv-move__who { grid-column: 1 / -1; }
    .inv-count__row { grid-template-columns: minmax(0, 1fr) 46px 72px 40px; gap: 6px; padding: 8px 4px; }
    .inv-issue { flex-direction: column; align-items: stretch; }
    .inv-issue__side { justify-content: space-between; }
    .inv-last-count { margin-left: 0; }
    .inv-summary strong { font-size: 19px; }
    .inv-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .inv-stats .shop-stat { padding: 10px 12px; }
    .inv-stats .shop-stat span { font-size: 12px; }
    .inv-stats .shop-stat strong { font-size: 18px; }
}
