/* =====================================================================
   ODIX WMS — основной стиль интерфейса
   Фирменные цвета логотипа ODIX: #E85A2A (оранжевый), #F0A03C (жёлто-оранжевый)
   ===================================================================== */

:root {
    --brand:          #E85A2A;
    --brand-2:        #F0A03C;
    --brand-soft:     #FDF1EC;
    --brand-line:     #F2D5CC;
    --text:           #4A4A4A;
    --text-strong:    #2E2E2E;
    --muted:          #8A8A8A;
    --line:           #E6E6E6;
    --bg:             #F5F6F8;
    --surface:        #FFFFFF;
    --success:        #1F8A4C;
    --success-soft:   #E8F7EE;
    --danger:         #C0392B;
    --danger-soft:    #FCEDEA;
    --info:           #2C6FA8;
    --info-soft:      #EAF2F9;
    --radius:         10px;
    --shadow:         0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
    --sidebar-w:      256px;
    --font:           "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--text-strong); margin: 0 0 12px; }

.mono {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12.5px;
}

.muted { color: var(--muted); }
.num, .table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 20px; }
.inline-form { display: inline; }

/* ---------------------------------------------------------------------
   Каркас приложения
   --------------------------------------------------------------------- */
body.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: #23262B;
    color: #D6D9DE;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 700;
    font-size: 17px;
}
.brand-mark--lg { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: .5px; }
.brand-text small { color: #9AA0A8; font-size: 11px; }

.sidebar__nav { padding: 12px 10px; flex: 1; }

.nav-group { margin: 12px 0 4px; }
.nav-group__title {
    display: block;
    padding: 4px 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #7C838C;
}

.nav-item {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: #D6D9DE;
    font-size: 13.5px;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.nav-item.is-active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }

.sidebar__footer { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); }
.badge-role {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(240, 160, 60, .18);
    color: var(--brand-2);
    font-size: 11.5px;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 58px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar__burger { display: none; font-size: 20px; cursor: pointer; color: var(--text); }
.topbar__search { flex: 1; max-width: 520px; }
.topbar__search input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13.5px;
    background: #FAFAFB;
}
.topbar__search input:focus { outline: none; border-color: var(--brand-2); background: #fff; }

.topbar__user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar__name { font-weight: 600; color: var(--text-strong); font-size: 13.5px; }

.content { padding: 22px 24px 40px; flex: 1; }
.content--plain { max-width: 720px; margin: 0 auto; }

.footer {
    padding: 12px 24px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    background: var(--surface);
}
.footer__sep { margin: 0 6px; }

/* ---------------------------------------------------------------------
   Компоненты
   --------------------------------------------------------------------- */
.page-head { margin-bottom: 18px; }
.page-title { font-size: 21px; margin: 0; }
.page-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.card__title { font-size: 14.5px; margin: 0 0 12px; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow);
}
.stat__label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat__value { font-size: 24px; font-weight: 700; color: var(--text-strong); font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.table thead th {
    background: #FAFAFB;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    font-weight: 600;
}
.table tbody tr:hover { background: var(--brand-soft); }

.stage-list { margin: 0; padding-left: 20px; color: var(--text); }
.stage-list li { margin-bottom: 4px; }

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    background: #EDEFF2;
    color: var(--text-strong);
    transition: filter .15s ease;
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn--primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.field__input, .field select, .field textarea {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-strong);
    background: #fff;
}
.field textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.field__input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--brand-2);
    box-shadow: 0 0 0 3px rgba(240, 160, 60, .15);
}
.field__hint { color: var(--muted); font-size: 12px; }
.field__error { color: var(--danger); font-size: 12px; }

/* Оповещения */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert--success { background: var(--success-soft); color: var(--success); border-color: #C7E8D3; }
.alert--error   { background: var(--danger-soft);  color: var(--danger);  border-color: #F3CFC8; }
.alert--info    { background: var(--info-soft);    color: var(--info);    border-color: #CFE0EE; }

/* ---------------------------------------------------------------------
   Экран входа
   --------------------------------------------------------------------- */
body.bare {
    background: linear-gradient(135deg, #23262B 0%, #35393F 60%, #4A4A4A 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 26px 26px 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-title { font-size: 19px; margin: 0; }
.auth-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.auth-hint { text-align: center; color: var(--muted); font-size: 11.5px; margin: 18px 0 0; }

/* ---------------------------------------------------------------------
   Страницы ошибок
   --------------------------------------------------------------------- */
.error-page { text-align: center; padding: 60px 20px; }
.error-page__code {
    display: block;
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.error-page__title { margin: 10px 0 6px; font-size: 20px; }
.error-page__text { color: var(--muted); margin-bottom: 20px; }

.trace {
    text-align: left;
    background: #23262B;
    color: #E8E8E8;
    padding: 14px;
    border-radius: 8px;
    font-size: 12px;
    overflow: auto;
    max-height: 340px;
}

/* ---------------------------------------------------------------------
   Адаптивность от 360 px (раздел 13.1 ТЗ)
   --------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .grid--2, .grid--3 { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
    .topbar__burger { display: block; }
}

@media (max-width: 560px) {
    .grid--4 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
    .topbar { padding: 0 12px; gap: 10px; }
    .topbar__name { display: none; }
}

/* ---------------------------------------------------------------------
   Списки, фильтры, таблицы данных
   --------------------------------------------------------------------- */
.nowrap { white-space: nowrap; }
.mb-3 { margin-bottom: 20px; }

.page-head--row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.breadcrumbs { margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.breadcrumbs__link { color: var(--muted); }
.breadcrumbs__link:hover { color: var(--brand); }
.breadcrumbs__sep { margin: 0 8px; color: #C4C7CC; }
.breadcrumbs__current { color: var(--text-strong); font-weight: 600; }

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.toolbar__input, .toolbar__select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-strong);
    background: #fff;
}
.toolbar__input { flex: 1; min-width: 200px; }
.toolbar__input--date { flex: 0 0 160px; min-width: 140px; }
.toolbar__input:focus, .toolbar__select:focus {
    outline: none;
    border-color: var(--brand-2);
    box-shadow: 0 0 0 3px rgba(240, 160, 60, .15);
}

.card--flush { padding: 0; overflow: hidden; }
.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px 0;
}
.card--flush .card__title { padding: 14px 18px; margin: 0; }
.card--flush .card__head .card__title { padding: 0; }
.card--flush .table th:first-child, .card--flush .table td:first-child { padding-left: 18px; }
.card--flush .table th:last-child, .card--flush .table td:last-child { padding-right: 18px; }

.table--kv th {
    width: 42%;
    background: transparent;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    padding-left: 0;
}
.table--kv td { padding-right: 0; }

.row--muted td { color: var(--muted); }
.row--muted .badge { opacity: .85; }
.row--danger td { background: #FFF8F7; }

.empty { padding: 26px 18px; text-align: center; color: var(--muted); margin: 0; }

.table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 12px;
    font-size: 12.5px;
    flex-wrap: wrap;
}

/* Бейджи и чипы */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.badge--brand  { background: var(--brand-soft); color: var(--brand); }
.badge--ok     { background: var(--success-soft); color: var(--success); }
.badge--off    { background: #EFF1F3; color: #7C838C; }
.badge--muted  { background: #F1F3F5; color: #5C636B; }
.badge--warn   { background: #FFF4E0; color: #A86A00; }
.badge--danger { background: var(--danger-soft); color: var(--danger); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--text);
}
.chip strong { color: var(--brand); }
.chip--muted { color: var(--muted); border-style: dashed; }

/* Пагинация */
.pagination { display: flex; gap: 4px; align-items: center; }
.pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
}
.pagination__item:hover { border-color: var(--brand-2); text-decoration: none; }
.pagination__item--active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}
.pagination__gap { color: #B9BDC3; padding: 0 2px; }

/* Формы: сетка, группы кнопок, флажки */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

.fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 4px 0 0;
}
.fieldset__legend {
    padding: 0 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-strong);
}

.field--check { align-items: flex-start; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }

/* Раскрывающиеся блоки (JSON изменений в аудите) */
.details summary { cursor: pointer; color: var(--brand); font-size: 12.5px; }
.details__block { margin-top: 6px; }
.details__label { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.details__json {
    margin: 4px 0 0;
    padding: 8px;
    background: #F7F8FA;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 11.5px;
    max-width: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 860px) {
    .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
    .page-head--row { flex-direction: column; align-items: stretch; }
}

/* ---------------------------------------------------------------------
   Топология склада: карточки, дерево, полки (раздел 4 ТЗ)
   --------------------------------------------------------------------- */
.field--wide { grid-column: 1 / -1; }

.field__input--scan {
    font-size: 17px;
    height: 46px;
    letter-spacing: .5px;
}

.card--entity { display: flex; flex-direction: column; gap: 10px; }
.card--entity .card__title { margin: 0; font-size: 15.5px; }
.card--entity.card--off { opacity: .72; border-style: dashed; }

.card__foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    margin-top: auto;
}

.metrics { display: flex; gap: 18px; margin: 4px 0 0; }
.metrics div { display: flex; flex-direction: column; }
.metrics dt { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.metrics dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; color: var(--text-strong); }

/* Дерево */
.tree { display: flex; flex-direction: column; gap: 16px; }

.tree__zone {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand-2);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
}
.tree__node--off { border-left-color: #C9CCD1; opacity: .8; }

.tree__zone-head, .tree__rack-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.tree__zone-head strong { font-size: 15px; color: var(--text-strong); }
.tree__icon { color: var(--brand); margin-right: 6px; }
.tree__actions { display: flex; gap: 6px; flex-wrap: wrap; }

.tree__racks { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.tree__rack {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #FCFCFD;
}

.tree__shelves {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.shelf-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}
.shelf-card:hover { border-color: var(--brand-2); text-decoration: none; box-shadow: var(--shadow); }
.shelf-card--off { opacity: .6; border-style: dashed; }
.shelf-card__code { font-size: 12.5px; font-weight: 600; color: var(--text-strong); }
.shelf-card__meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tree__empty { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------------
   Товарный каталог (раздел 5 ТЗ)
   --------------------------------------------------------------------- */
.small { font-size: 12px; }
.pre-line { white-space: pre-line; margin: 0; }
.text-warn { color: #A86A00; }
.price { font-variant-numeric: tabular-nums; color: var(--text-strong); }

.row--child td:first-child { padding-left: 28px; color: var(--text); }
.tree-branch { color: #C4C7CC; margin-right: 4px; }

.field__input--file {
    height: auto;
    padding: 8px 12px;
    background: #FAFAFB;
    cursor: pointer;
}

/* Сетка каталога */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.product-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.product-card:hover { border-color: var(--brand-2); box-shadow: 0 3px 12px rgba(16, 24, 40, .09); }
.product-card--off { opacity: .65; border-style: dashed; }

.product-card__image {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: #F4F5F7;
}
.product-card__image img { width: 100%; height: 100%; object-fit: contain; display: block; }

.product-card__flag {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #FFF4E0;
    color: #A86A00;
    font-size: 11px;
    font-weight: 700;
}

.product-card__body { display: flex; flex-direction: column; gap: 5px; padding: 12px 13px; flex: 1; }
.product-card__sku { font-size: 11.5px; color: var(--muted); }
.product-card__name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-strong);
    line-height: 1.3;
    min-height: 2.6em;
}
.product-card__meta { font-size: 11.5px; }

.product-card__prices { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.product-card__price { font-size: 17px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }

.product-card__stock {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12.5px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}
.product-card__stock.is-low { color: #A86A00; }

.product-card__actions {
    display: flex;
    gap: 6px;
    padding: 0 13px 12px;
}

/* Карточка товара */
.product-view {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.product-view__media { padding: 12px; }
.product-view__main {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #F4F5F7;
    border-radius: 8px;
    display: block;
}

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs__item {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 6px;
    background: #F4F5F7;
    cursor: pointer;
}
.thumbs__item.is-main { border-color: var(--brand); }

/* Менеджер изображений в форме */
.image-manager {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.image-manager__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FCFCFD;
}
.image-manager__item.is-main { border-color: var(--brand); background: var(--brand-soft); }
.image-manager__item img {
    width: 100%;
    height: 88px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
}

@media (max-width: 1100px) {
    .product-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------------
   Складские документы: строки позиций и автоподстановка товара (раздел 9 ТЗ)
   --------------------------------------------------------------------- */
.field__input--sm {
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
}

.field__input--scan-sm {
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
    max-width: 300px;
    border: 1px dashed var(--brand-line);
    background: #FFFDFB;
}

.lines { position: relative; }
.lines__table { margin-top: 4px; }
.lines__table td { vertical-align: top; }

.line__product { position: relative; min-width: 220px; }
.line__name { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }

.autocomplete {
    position: absolute;
    z-index: 30;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .14);
    margin-top: 2px;
}

.autocomplete__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
}
.autocomplete__item:hover { background: var(--brand-soft); }
.autocomplete__name { color: var(--text-strong); font-weight: 600; }
.autocomplete__meta { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.autocomplete__empty { padding: 8px 10px; color: var(--muted); font-size: 12.5px; }

.chip--active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}
.chip--active:hover { text-decoration: none; color: #fff; }

.table tfoot td {
    border-top: 2px solid var(--line);
    background: #FAFAFB;
}

/* =====================================================================
   POS: оформление продажи (раздел 6.1 ТЗ)
   ===================================================================== */
.sale-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}

.sale-side {
    position: sticky;
    top: 16px;
}

.lines__table--sale td {
    vertical-align: top;
}

.lines__table--sale .line__product {
    min-width: 240px;
}

.sale-total {
    font-size: 17px;
    font-weight: 700;
}

.parts {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.parts__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.parts[hidden] { display: none; }

.chip--button {
    background: transparent;
    cursor: pointer;
    font: inherit;
    transition: background .15s ease;
}
.chip--button:hover { background: var(--brand-soft); }

.payment-form {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}
.payment-form input { width: 96px; }
.payment-form select { width: 92px; }

.doc-note-like {
    background: #FBFBFC;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text);
}

/* =====================================================================
   Настройки компании: логотип и шаблоны (раздел 7.1 ТЗ)
   ===================================================================== */
.logo-box {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.logo-box__img {
    max-width: 180px;
    max-height: 80px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    object-fit: contain;
}

.logo-box__form { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 10px; }

.note-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.note-row__form { flex: 1; display: flex; align-items: flex-start; gap: 8px; }
.note-row:last-of-type { border-bottom: none; }
.note-row__text { flex: 1; min-height: 54px; }
.note-row__actions { display: flex; gap: 6px; }

/* =====================================================================
   Отчёты, уведомления и дашборд (раздел 10 ТЗ)
   ===================================================================== */
.alerts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
}

.alert-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 132px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #FBFBFC;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease;
}
.alert-chip:hover { border-color: var(--brand); text-decoration: none; }
.alert-chip__value { font-size: 19px; font-weight: 700; color: var(--text-strong); }
.alert-chip__label { font-size: 11.5px; color: var(--muted); }
.alert-chip--warn { background: #FFF8EC; border-color: #F3D9AE; }
.alert-chip--warn .alert-chip__value { color: #A86A00; }
.alert-chip--danger { background: #FFF6F5; border-color: var(--danger-soft); }
.alert-chip--danger .alert-chip__value { color: var(--danger); }

.report-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.report-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 14px rgba(232, 90, 42, .08);
    text-decoration: none;
}
.report-card__title { font-weight: 600; color: var(--text-strong); }
.report-card__hint { font-size: 12px; color: var(--muted); }

.stat__hint { font-size: 11.5px; color: var(--muted); }
.stat--brand .stat__value { color: var(--brand); }

.topbar__alerts {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 12.5px;
    text-decoration: none;
    white-space: nowrap;
}
.topbar__alerts:hover { text-decoration: none; border-color: var(--brand); }
.topbar__alerts-icon { color: #C9CCD1; font-size: 11px; }
.topbar__alerts--active { border-color: #F3D9AE; background: #FFF8EC; color: #A86A00; }
.topbar__alerts--active .topbar__alerts-icon { color: #E8A33A; }
.topbar__alerts-count { font-weight: 700; color: var(--text-strong); }
.topbar__alerts--active .topbar__alerts-count { color: #A86A00; }

@media (max-width: 900px) {
    .topbar__alerts-label { display: none; }
}

/* =====================================================================
   Резервное копирование (раздел 12 ТЗ)
   ===================================================================== */
.code-block {
    margin: 8px 0 0;
    padding: 10px 12px;
    background: #F7F8FA;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 11.5px;
    color: var(--text-strong);
    overflow-x: auto;
    white-space: pre;
}

.log-list { padding: 8px 18px 14px; max-height: 260px; overflow-y: auto; }
.log-list__item {
    padding: 4px 0;
    border-bottom: 1px dashed var(--line);
    font-family: "Consolas", "Courier New", monospace;
    font-size: 11.5px;
    color: var(--muted);
    word-break: break-word;
}
.log-list__item:last-child { border-bottom: none; }

@media (max-width: 1100px) {
    .product-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lines__table { min-width: 760px; }
    .lines { overflow-x: auto; }
    .sale-layout { grid-template-columns: minmax(0, 1fr); }
    .sale-side { position: static; }
}

@media (max-width: 760px) {
    .product-view { grid-template-columns: 1fr; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
