/* SBA-LPM — базовое оформление */
:root {
    /* Фирменные цвета SBA-LPM — из логотипа: красный крест и серый крест */
    --brand-red: #e31e24;
    --brand-gray: #c5c6c6;

    --bg: #f4f4f4;
    --surface: #ffffff;
    --text: #2a2a2a;
    --muted: #6f7070;
    --border: #dcdddd;
    --primary: #e31e24;
    --primary-hover: #c1161c;
    --primary-text: #c1161c;       /* красный для текста/ссылок — чуть темнее, чтобы читался */
    --primary-soft: #fdecec;
    --primary-ring: rgba(227, 30, 36, .22);
    --danger: #c0352b;
    --danger-bg: #fdecea;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--primary-text); }

/* --- Кнопки и поля --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-block { width: 100%; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    color: inherit;
    background: #fff;
}
.input:focus { outline: 2px solid var(--primary-ring); border-color: var(--primary); }
.input.is-invalid { border-color: var(--danger); }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }

.alert {
    padding: 10px 12px;
    margin-bottom: 16px;
    border-radius: var(--radius);
    font-size: 14px;
}
.alert-danger { background: var(--danger-bg); color: var(--danger); }

/* --- Страница входа --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 32px 28px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
/* Логотип + название: «SBA-» серым, «LPM» красным — как кресты на логотипе */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    color: var(--text);
    text-decoration: none;
}
.brand img { display: block; width: 34px; height: 34px; }
.brand-sba { color: #8a8b8b; }
.brand-lpm { color: var(--brand-red); }
.auth-card .brand { display: flex; flex-direction: column; gap: 14px; font-size: 28px; text-align: center; }
.auth-card .brand img { width: 88px; height: 88px; }
.auth-card .subtitle { margin: 4px 0 24px; text-align: center; color: var(--muted); font-size: 14px; }

.alert-success { background: #e8f5ec; color: #1e7a3c; }

/* --- Рабочая область (временный каркас до общего макета) --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar .brand { font-size: 20px; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar .user-name { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; font-weight: 600; }
.topbar .user .role { color: var(--muted); font-size: 12px; font-weight: 400; }
.content { max-width: 1200px; margin: 0 auto; padding: 24px; }
.card {
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.topbar-left { display: flex; align-items: center; gap: 28px; }
.topbar .brand { text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); }

/* --- Заголовок страницы --- */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.page-head h1 { margin: 0; font-size: 24px; }
.section-title { margin: 32px 0 12px; font-size: 18px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.hint { margin-top: 4px; font-size: 13px; color: var(--muted); }

/* --- Таблицы --- */
.card-flush { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: 13px; font-weight: 600; color: var(--muted); background: #f8f9fb; }
.table th.text-center, .table td.text-center { text-align: center; }
.table th.text-right, .table td.text-right { text-align: right; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.muted-row td { color: var(--muted); }
code { font-family: Consolas, "Courier New", monospace; font-size: 13px; background: #f1f3f6; padding: 1px 6px; border-radius: 4px; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    margin: 1px 2px 1px 0;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #eceff3;
    color: var(--muted);
}
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-success { background: #e8f5ec; color: #1e7a3c; }

.level { font-size: 16px; }
.level-edit { color: #1e7a3c; }
.level-view { color: #b7791f; }
.level-none { color: #c3c8d1; }
.legend { margin-top: 10px; }

/* --- Формы --- */
.form-card { padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 24px; }
fieldset.field { border: 0; padding: 0; margin: 8px 0 16px; }
fieldset.field legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.checkbox-strong { color: var(--text); font-weight: 600; margin-top: 30px; }
.role-list { display: grid; gap: 8px; }
.role-option {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}
.role-option:hover { background: #fafbfc; }
.role-option input { margin-top: 4px; }
.perm-table { border: 1px solid var(--border); border-radius: var(--radius); }
.perm-table input[type=radio] { width: 18px; height: 18px; cursor: pointer; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.danger-zone { margin-top: 16px; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #f0c4c0; }
.btn-danger-ghost:hover { background: var(--danger-bg); }

/* --- Главная: карточки разделов --- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.module-card { display: flex; flex-direction: column; gap: 6px; }
.module-name { font-size: 17px; font-weight: 700; }
.module-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; }
.link-card { color: inherit; text-decoration: none; }
.link-card:hover { border-color: var(--primary); }

@media (max-width: 720px) {
    .topbar { flex-wrap: wrap; padding: 12px 16px; }
    .topbar-left { gap: 12px; flex-wrap: wrap; }
    .content { padding: 16px; }
}

/* --- Шестерёнка настроек --- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, background .15s, transform .3s;
}
.icon-btn:hover { color: var(--primary-text); background: var(--primary-soft); }
.icon-btn.active, .dropdown[open] > .icon-btn { color: var(--primary-text); background: var(--primary-soft); border-color: var(--primary-ring); }
.dropdown[open] > .icon-btn svg { transform: rotate(45deg); transition: transform .3s; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
    min-width: 250px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.dropdown-title { padding: 6px 10px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dropdown-menu a {
    display: flex; flex-direction: column;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}
.dropdown-menu a:hover { background: var(--bg); }
.dropdown-menu a.active { background: var(--primary-soft); color: var(--primary-text); }
.dropdown-menu a .small { font-weight: 400; }
.dropdown-user { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.dropdown-sep { height: 1px; margin: 6px 0; background: var(--border); }
.dropdown-item-btn {
    display: block; width: 100%;
    padding: 8px 10px;
    border: 0; border-radius: 6px;
    background: none;
    font: inherit; font-weight: 600; text-align: left;
    color: var(--primary-text);
    cursor: pointer;
}
.dropdown-item-btn:hover { background: var(--primary-soft); }
@media (max-width: 720px) {
    .topbar .user-name { display: none; }
}
/* --- Аватар (инициалы) --- */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    flex: none;
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-text);
    font-weight: 700; font-size: 22px; letter-spacing: .02em;
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; margin-right: 10px; vertical-align: middle; }
.avatar-off { background: #eceded; color: var(--muted); }

/* --- Список: строка целиком кликабельна --- */
.table-clickable tbody tr { cursor: pointer; }
.row-link { display: inline-flex; align-items: center; color: var(--text); font-weight: 600; text-decoration: none; }
.table-clickable tbody tr:hover .row-link { color: var(--primary-text); }

/* --- Карточка пользователя --- */
.card-title { margin: 0 0 14px; font-size: 16px; }
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.profile-main h1 { margin: 0; font-size: 24px; }
.profile-sub { margin: 2px 0 8px; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.props { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; margin: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; word-break: break-word; }
.props-subtitle { margin: 16px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.notes { margin: 0; white-space: pre-line; }
.access-list { list-style: none; margin: 0; padding: 0; }
.access-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.access-list li:last-child { border-bottom: 0; }
.access-list .level { font-size: 14px; }

/* --- Форма из нескольких блоков --- */
.form-stack { display: grid; gap: 16px; }
.form-stack .form-card { margin: 0; }
.form-grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
textarea.input { resize: vertical; min-height: 70px; }

@media (max-width: 720px) {
    .profile-grid { grid-template-columns: 1fr; }
    .props { grid-template-columns: 120px 1fr; }
    .profile-head { align-items: flex-start; }
}
/* --- Навигатор в шапке --- */
.nav { align-items: center; }
.nav-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link:hover { background: var(--bg); }
.nav-link.active, .dropdown[open] > .nav-link { background: var(--primary-soft); color: var(--primary-text); }
.dropdown[open] > .nav-link svg { transform: rotate(180deg); }
.dropdown-menu-left { left: 0; right: auto; min-width: 280px; }
.dropdown-menu .dropdown-title + a { margin-top: 2px; }
.dropdown-menu a + .dropdown-title { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 10px; }

/* --- Хлебные крошки, поиск, пустой список --- */
.breadcrumbs { margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; max-width: 560px; }
.search-bar .input { flex: 1; }
.empty-state { color: var(--muted); text-align: center; padding: 32px; }
.avatar-org { border-radius: 14px; }
/* --- Навигатор: плитки разделов и пунктов --- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tile {
    display: flex; align-items: center; gap: 16px;
    color: inherit; text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--brand-gray); box-shadow: var(--shadow); }
.tile-icon {
    display: inline-flex; align-items: center; justify-content: center;
    flex: none;
    width: 56px; height: 56px;
    border-radius: 14px;
    background: #f1f1f1;
    color: #8a8b8b;                  /* серая иконка — как серый крест логотипа */
}
.tile:hover .tile-icon { color: var(--primary-text); background: var(--primary-soft); }
.tile-icon-sm { width: 38px; height: 38px; border-radius: 10px; }
.tile-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-title { font-size: 17px; font-weight: 700; }
.tile-count {
    margin-left: auto;
    min-width: 26px; padding: 2px 8px;
    border-radius: 999px; background: #f1f1f1; text-align: center;
}
.title-with-icon { display: flex; align-items: center; gap: 12px; }
/* --- Вкладки-фильтры над списком --- */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.list-toolbar .search-bar { margin-bottom: 0; flex: 1; justify-content: flex-end; }
.tabs { display: inline-flex; padding: 3px; gap: 2px; background: #ececec; border-radius: 10px; }
.tabs a {
    padding: 6px 14px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px; font-weight: 600;
    text-decoration: none;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.checks-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
/* --- Поле ИНН с кнопкой «Заполнить по ИНН» --- */
.inn-field { max-width: 640px; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .input { flex: 1; font-size: 16px; letter-spacing: .04em; }
.input-with-btn .btn { white-space: nowrap; border-color: var(--primary-ring); color: var(--primary-text); }
.input-with-btn .btn:hover { background: var(--primary-soft); }
.input-with-btn .btn:disabled { opacity: .6; cursor: wait; }
.inn-msg { margin-top: 6px; font-size: 13px; color: var(--muted); min-height: 1em; }
.inn-msg.ok { color: #1e7a3c; }
.inn-msg.warn { color: #b7791f; font-weight: 600; }
.inn-msg.error { color: var(--danger); }
.input.just-filled { background: #fff8e1; transition: background 1.5s; }
/* --- Качество: номенклатура --- */
.nom-product { margin-bottom: 16px; }
.nom-product.is-off, .nom-variant.is-off { opacity: .6; }
.nom-product-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.nom-product-head h2 { margin: 0; font-size: 20px; }
.nom-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nom-variants { display: grid; gap: 10px; }
.nom-variant {
    display: grid; grid-template-columns: 200px 1fr; gap: 12px; align-items: start;
    padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: #fcfcfc;
}
.nom-variant-name {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-weight: 700; color: var(--text); text-decoration: none;
}
.nom-variant-name:hover { color: var(--primary-text); }
.nom-sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.size-chip {
    padding: 3px 10px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface);
    font-size: 13px; font-weight: 600;
    color: var(--text); text-decoration: none;
}
.size-chip:hover { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.size-chip.is-off { color: var(--muted); text-decoration: line-through; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span {
    display: flex; align-items: center;
    padding: 0 10px;
    border: 1px solid var(--border); border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    background: #f4f4f4; color: var(--muted); font-weight: 600;
}
.input-prefix .input { border-radius: 0 var(--radius) var(--radius) 0; }
.card-pad { padding: 16px 20px; }
.nom-variant-grid { grid-template-columns: 2fr 1fr; align-items: start; }
.placeholder-card { border-style: dashed; background: #fafafa; }
@media (max-width: 720px) {
    .nom-variant { grid-template-columns: 1fr; }
    .nom-variant-grid { grid-template-columns: 1fr; }
}
/* --- Склад --- */
.tile-soon { opacity: .55; cursor: default; }
.tile-soon:hover { box-shadow: none; border-color: var(--border); }
.tile-soon:hover .tile-icon { color: #8a8b8b; background: #f1f1f1; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.stat:hover { border-color: var(--brand-gray); }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 14px; }
.badge-type-finished { background: #e8f5ec; color: #1e7a3c; }
.badge-type-raw { background: #eef1f6; color: #4a5568; }
.badge-type-semi { background: #fff4e0; color: #9a5b00; }
.settings-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.settings-list li { display: flex; align-items: center; gap: 8px; }
.inline-edit { display: flex; gap: 6px; flex: 1; }
.inline-edit .input { flex: 1; }
.input-sm { padding: 6px 10px; font-size: 14px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.unit-row { display: grid; grid-template-columns: 120px 1fr 90px auto; gap: 6px; align-items: center; }
@media (max-width: 720px) { .unit-row { grid-template-columns: 1fr 1fr; } }
/* --- Склад: партии, документы, остатки --- */
.badge-status-quarantine { background: #fff4e0; color: #9a5b00; }
.badge-status-approved { background: #e8f5ec; color: #1e7a3c; }
.badge-status-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-draft { background: #eef1f6; color: #4a5568; }
.badge-warn { background: #fff4e0; color: #9a5b00; }
.badge-lg { padding: 5px 12px; font-size: 13px; }
.expiry-soon { color: #b7791f; font-weight: 600; }
.expiry-expired { color: var(--danger); font-weight: 700; }
.qty-plus { color: #1e7a3c; font-weight: 600; }
.qty-minus { color: var(--danger); font-weight: 600; }
.alert-info { background: #eef4fb; color: #2c5282; }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-bottom: 18px; }
.alert-tile { display: block; padding: 12px 14px; border-radius: var(--radius); text-decoration: none; font-size: 14px; border: 1px solid transparent; }
.alert-tile strong { font-size: 18px; margin-right: 4px; }
.alert-tile-danger { background: var(--danger-bg); color: var(--danger); border-color: #f3c6c2; }
.alert-tile-warn { background: #fff8eb; color: #8a5300; border-color: #f6dfb0; }
.alert-tile-info { background: #f2f5f9; color: #3d4a5c; border-color: #dfe5ee; }
.alert-tile:hover { filter: brightness(.98); }
.doc-head .props { grid-template-columns: 200px 1fr; }
.lines-table td { padding: 6px 8px; vertical-align: top; }
.lines-table .input-sm { min-width: 0; }
.qty-cell { display: flex; align-items: center; gap: 6px; }
.qty-cell .input { text-align: right; }
.stock-item-row td { background: #fafafa; border-top: 1px solid var(--border); }
.stock-batch-row td { padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
.stock-batch-row td:first-child { padding-left: 34px; }
.stock-table tbody tr:hover { background: transparent; }
/* Постраничная навигация */
.pagination { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.pagination a, .pagination .disabled { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--text); font-size: 14px; background: var(--surface); }
.pagination a:hover { border-color: var(--primary); color: var(--primary-text); }
.pagination .disabled { color: var(--muted); opacity: .6; }
/* --- Инвентаризация --- */
.inv-summary { margin-top: 4px; font-size: 14px; }
.inv-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.inv-toolbar .card-title { flex: 1; }
.inv-table tr[hidden] { display: none; }
/* --- Входной контроль --- */
.check-table td, .check-table th { padding: 8px 10px; }
.check-table input[type=radio] { width: 18px; height: 18px; cursor: pointer; }
.decision-approved:has(input:checked) { border-color: #1e7a3c; background: #e8f5ec; }
.decision-rejected:has(input:checked) { border-color: var(--danger); background: var(--danger-bg); }
@media print {
    .topbar, .breadcrumbs, .page-head .nom-actions, .alert { display: none !important; }
    body { background: #fff; }
    .card { border: 1px solid #999; box-shadow: none; }
}
/* --- Закупки --- */
.progress { height: 6px; background: #ececec; border-radius: 999px; overflow: hidden; margin-bottom: 2px; }
.progress span { display: block; height: 100%; background: #1e7a3c; }
.lines-table tfoot td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
/* --- Цены поставщиков --- */
.price-block { margin-bottom: 12px; }
.price-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; }
.price-block .table td { padding: 8px 14px; }
.best-price td { background: #f3faf5; }
.is-filtered td { opacity: .45; }
/* --- Прикреплённые документы --- */
.att-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.att-list { list-style: none; margin: 10px 0 0; padding: 0; }
.att-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.att-list li:last-child { border-bottom: 0; }
.att-ext {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    min-width: 42px; height: 42px; padding: 0 4px;
    border-radius: 8px; background: #f1f1f1; color: #8a8b8b;
    font-size: 11px; font-weight: 800; letter-spacing: .03em;
}
.att-ext-sm { min-width: 34px; height: 20px; border-radius: 4px; font-size: 10px; vertical-align: middle; }
.att-main { flex: 1; min-width: 0; }
.att-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-actions { display: flex; gap: 6px; }
.att-upload { margin-top: 12px; }
.att-upload > summary { list-style: none; display: inline-flex; }
.att-upload > summary::-webkit-details-marker { display: none; }
.att-upload[open] > summary { margin-bottom: 12px; }
/* --- Качество: ввод размеров ширина × длина --- */
.size-rows-head, .size-row { display: grid; grid-template-columns: 90px 16px 90px 1fr auto; gap: 8px; align-items: center; }
.size-rows-head { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.size-row { margin-bottom: 6px; }
.size-row .input { text-align: center; }
.size-row-edit { grid-template-columns: 110px 16px 110px; }
.size-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Полное наименование по ТУ/РУ */
.official-name { margin: 2px 0 4px; font-size: 15px; color: var(--text); font-style: italic; line-height: 1.35; }
/* Стерильность партии */
.badge-sterile { background: #e6f2fb; color: #1b5e8f; }
.badge-nonsterile { background: #f3eefb; color: #6b46a3; }
.ster-split { display: inline-block; margin-left: 6px; }
.ster-split-s { color: #1b5e8f; }
.ster-split-n { color: #6b46a3; }
/* --- Окно просмотра документов --- */
.file-viewer {
    width: min(1100px, 96vw); height: 92vh; max-height: 92vh;
    padding: 0; border: 0; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    display: flex; flex-direction: column; overflow: hidden;
}
.file-viewer:not([open]) { display: none; }
.file-viewer::backdrop { background: rgba(20, 20, 20, .55); }
.fv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.fv-titles { display: flex; flex-direction: column; min-width: 0; }
.fv-titles strong, .fv-titles span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-actions { display: flex; gap: 6px; flex: none; }
.fv-body { position: relative; flex: 1; background: #525659; display: flex; align-items: center; justify-content: center; overflow: auto; }
.fv-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.fv-body img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.fv-loading { color: #fff; text-align: center; font-size: 15px; }
.fv-loading .muted { color: #ddd; margin-top: 6px; }
.no-preview { max-width: 520px; margin: 12vh auto; text-align: center; padding: 0 16px; }
.no-preview .att-ext { margin: 0 auto 12px; }
@media (max-width: 720px) { .fv-actions #fv-newtab { display: none; } }
.file-viewer [hidden] { display: none !important; }
/* Подписи печатной формы в карточке документа склада */
.signers-title { margin: 0 0 12px; font-size: 16px; }
.signers-card .field { margin-bottom: 10px; }
/* Места (пакеты) */
.pkg-select { margin-top: 4px; }
.lines-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.scan-box { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 4px; }
.scan-box .input { border-style: dashed; }
.pkg-state-full { color: var(--success, #1f7a3a); }
.pkg-state-opened { color: #9a5b00; }
.pkg-state-empty { color: #999; }
.print-menu { position: relative; display: inline-block; }
.print-menu > summary { list-style: none; cursor: pointer; }
.print-menu > summary::-webkit-details-marker { display: none; }
.print-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 300px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); padding: 6px; }
.print-menu-list a { display: block; padding: 8px 12px; border-radius: 6px; color: inherit; text-decoration: none; white-space: nowrap; }
.print-menu-list a:hover { background: #f4f4f4; }
.signers-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
/* Word/Excel, нарисованные прямо в окне (без PDF) */
.fv-doc { position: absolute; inset: 0; overflow: auto; }
.fv-doc-word .docx-wrapper { background: #525659; padding: 24px 12px; }
.fv-doc-word .docx-wrapper > section.docx { box-shadow: 0 2px 12px rgba(0, 0, 0, .45); margin-bottom: 24px; }
.fv-doc-sheet { background: #fff; }
.fv-doc-sheet table { border-collapse: collapse; font-size: 13px; }
.fv-doc-sheet td { border: 1px solid #d9d9d9; padding: 3px 8px; white-space: nowrap; vertical-align: top; min-width: 40px; }
.fv-doc-sheet tr:first-child td { background: #f3f3f3; font-weight: 600; position: sticky; top: 0; }
.fv-doc-msg { background: #fff; }
.fv-empty { padding: 24px; }
.fv-sheets { display: flex; gap: 2px; padding: 6px 10px 0; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; flex: none; }
.fv-sheets button { border: 1px solid var(--border); border-bottom: 0; background: #f1f1f1; padding: 5px 14px; border-radius: 6px 6px 0 0; cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.fv-sheets button.active { background: #fff; color: var(--primary, #c8102e); font-weight: 600; }