        /* Единая палитра сайта tos.stantoon.run (как у витрины и «Управления
           буферами»). Имена переменных сохранены от исходной версии инструмента,
           чтобы не трогать остальной CSS, — поменялись только значения. */
        :root {
            --brand-orange: #e87613;
            --brand-orange-dark: #c9640a;
            --brand-orange-active: #a85408;
            --brand-orange-pale: #fdf1e3;
            --brand-orange-pale-2: #f0d9b8;
            --brand-green: #2f8a3d;
            --brand-green-dark: #1e5429;
            --brand-green-pale: #eaf5ea;
            --brand-red: #cf3a50;
            --brand-red-dark: #a82e40;
            --brand-red-pale: #fbeaed;
            --brand-text: #1b2432;
            --brand-ink-2: #3d4a5e;
            --brand-gray: #66758c;
            --brand-gray-light: #8a95a3;
            --brand-border: #e5e9ee;
            --brand-border-light: #eef1f5;
            --brand-surface-2: #f7f8fa;
            --brand-bg: #f6f7f8;
            --brand-radius: 9px;
            --brand-radius-lg: 12px;
            --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
            --shadow: 0 1px 2px rgba(20,30,50,.05);
        }
        * { box-sizing: border-box; }
        body {
            font-family: var(--ui);
            margin: 0;
            background: var(--brand-bg);
            color: var(--brand-text);
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
        }
        ::selection { background: var(--brand-orange); color: #fff; }

        /* ===== Шапка в едином стиле сайта ===== */
        header.top {
            background: #fff;
            border-bottom: 1px solid var(--brand-border);
        }
        .top-in {
            max-width: 1400px;
            margin: 0 auto;
            padding: 13px 24px;
            display: flex;
            align-items: center;
            gap: 14px;
            flex-wrap: wrap;
        }
        .top-logo {
            flex: none;
            width: 46px;
            height: auto;
        }
        .top-name h1 {
            font-size: 17px;
            margin: 0;
            font-weight: 700;
            letter-spacing: -.01em;
            color: var(--brand-text);
        }
        .top-name p {
            margin: 2px 0 0;
            font-size: 12px;
            color: var(--brand-gray);
        }
        .head-right {
            margin-left: auto;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }
        .home-link {
            font-size: 12.5px;
            color: var(--brand-gray);
            text-decoration: none;
            border: 1px solid #d9dee5;
            padding: 6px 12px;
            border-radius: 8px;
            white-space: nowrap;
            transition: border-color .12s, color .12s, background .12s;
        }
        .home-link:hover {
            color: var(--brand-orange-dark);
            border-color: var(--brand-orange);
            background: #fdf6ee;
        }
        .ver {
            font-size: 11.5px;
            color: var(--brand-gray-light);
            font-family: var(--mono);
            border: 1px solid var(--brand-border);
            padding: 5px 9px;
            border-radius: 8px;
            white-space: nowrap;
        }

        /* ===== Плашка приватности и подвал ===== */
        .privacy {
            display: flex;
            gap: 8px;
            align-items: center;
            background: var(--brand-green-pale);
            border: 1px solid #c8e6c9;
            color: #2c6e38;
            border-radius: var(--brand-radius);
            padding: 9px 13px;
            font-size: 12.5px;
            margin: 0 0 4px;
        }
        footer {
            margin-top: 40px;
            color: var(--brand-gray);
            font-size: 12px;
            text-align: center;
        }

        .container {
            max-width: 1400px;
            margin: auto;
            padding: 22px 24px 56px;
        }
        .file-upload {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            margin-bottom: 20px;
            align-items: center;
        }
        .file-upload label {
            background: var(--brand-border-light);
            color: var(--brand-text);
            padding: 6px 12px;
            border-radius: 8px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }
        .file-upload input[type="file"] {
            display: none;
        }
        .btn {
            background: var(--brand-orange);
            color: #fff;
            border: none;
            padding: 8px 20px;
            border-radius: var(--brand-radius);
            cursor: pointer;
            font-weight: 600;
            font-size: 13.5px;
            font-family: inherit;
            transition: background-color .2s, border-color .12s, color .12s;
        }
        .btn:hover {
            background: var(--brand-orange-dark);
        }
        .btn:active {
            background: var(--brand-orange-active);
        }
        .btn-primary {
            background: var(--brand-orange);
        }
        .btn-primary:hover {
            background: var(--brand-orange-dark);
        }
        .btn-primary:active {
            background: var(--brand-orange-active);
        }
        .btn-success {
            background: var(--brand-green);
        }
        .btn-success:hover {
            background: var(--brand-green-dark);
        }
        .btn-secondary {
            background: #fff;
            color: var(--brand-text);
            border: 1px solid var(--brand-border);
        }
        .btn-secondary:hover {
            border-color: var(--brand-gray-light);
            background: #fff;
        }
        .btn-warning {
            background: var(--brand-orange-active);
            color: #fff;
        }
        .btn-warning:hover {
            background: var(--brand-red-dark);
        }
        .btn-danger {
            background: var(--brand-red);
            color: #fff;
        }
        .btn-danger:hover {
            background: var(--brand-red-dark);
        }
        .step {
            background: #fff;
            border: 1px solid var(--brand-border);
            padding: 20px;
            margin: 15px 0;
            border-radius: var(--brand-radius-lg);
            box-shadow: var(--shadow);
        }
        .step h3 {
            margin-top: 0;
            position: relative;
            padding-left: 14px;
        }
        .step h3:before {
            content: "";
            position: absolute;
            left: 0;
            top: 6px;
            width: 8px;
            height: 8px;
            background: var(--brand-orange);
            border-radius: 2px;
        }
        .flex-row {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: center;
        }
        .selection-block {
            border: 1px solid var(--brand-border);
            padding: 10px;
            margin: 10px 0;
            border-radius: 8px;
            font-size: 13px;
        }
        .fu-item {
            margin: 8px 0;
            padding: 8px;
            background: var(--brand-orange-pale);
            border-radius: 8px;
            font-size: 13px;
        }
        .message {
            margin: 10px 0;
            padding: 8px;
            border-radius: 8px;
        }
        .msg-info {
            background: var(--brand-border-light);
            color: var(--brand-text);
        }
        .msg-error {
            background: var(--brand-red-pale);
            color: var(--brand-red-dark);
        }
        .msg-success {
            background: var(--brand-green-pale);
            color: var(--brand-green-dark);
        }
        #toastContainer {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 3000;
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-width: 380px;
        }
        .toast {
            padding: 10px 14px;
            border-radius: var(--brand-radius);
            font-size: 13px;
            box-shadow: 0 4px 16px rgba(30,30,30,.16);
            opacity: 0;
            transform: translateY(10px);
            transition: opacity 0.25s ease, transform 0.25s ease;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }
        .toast.toast-visible {
            opacity: 1;
            transform: translateY(0);
        }
        .toast-text {
            flex: 1;
        }
        .toast-info {
            background: var(--brand-border-light);
            color: var(--brand-text);
        }
        .toast-error {
            background: var(--brand-red-pale);
            color: var(--brand-red-dark);
        }
        .toast-success {
            background: var(--brand-green-pale);
            color: var(--brand-green-dark);
        }
        .toast-warning {
            background: var(--brand-orange-pale);
            color: var(--brand-orange-active);
        }
        .toast-action {
            font-weight: 600;
            text-decoration: underline;
            cursor: pointer;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .toast-close {
            cursor: pointer;
            opacity: 0.6;
            flex-shrink: 0;
        }
        .toast-close:hover {
            opacity: 1;
        }
        .spinner {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(0, 0, 0, 0.1);
            border-radius: 50%;
            border-top-color: var(--brand-orange);
            animation: spin 0.8s ease-in-out infinite;
            vertical-align: middle;
            margin-right: 8px;
        }
        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }
        .badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 12px;
            margin: 0 3px;
        }
        .badge-ok {
            background: var(--brand-green-pale);
            color: var(--brand-green-dark);
        }
        .badge-fail {
            background: var(--brand-red-pale);
            color: var(--brand-red-dark);
        }
        .file-list {
            margin: 5px 0;
            font-size: 13px;
        }
        .file-item {
            display: inline-block;
            background: var(--brand-border-light);
            padding: 2px 10px;
            margin: 2px 5px;
            border-radius: 12px;
        }
        .file-item .del {
            cursor: pointer;
            font-weight: bold;
            margin-left: 5px;
            color: var(--brand-red);
        }
        .accordion {
            margin: 10px 0;
            border: 1px solid var(--brand-border);
            border-radius: 5px;
        }
        .accordion-header {
            background: var(--brand-surface-2);
            padding: 10px 15px;
            cursor: pointer;
            font-weight: bold;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .accordion-header:hover {
            background: var(--brand-border-light);
        }
        .accordion-header .arrow {
            transition: transform 0.2s;
            margin-left: 10px;
        }
        .accordion-header.active .arrow {
            transform: rotate(90deg);
        }
        .accordion-body {
            padding: 15px;
            background: #fff;
            display: none;
        }
        .accordion-body.open {
            display: block;
        }
        .sub-accordion {
            margin: 5px 0;
            border: 1px solid var(--brand-border-light);
            border-radius: 4px;
        }
        .sub-accordion .accordion-header {
            background: var(--brand-surface-2);
            padding: 8px 12px;
            font-weight: normal;
        }
        .sub-accordion .accordion-body {
            padding: 10px;
        }
        .detail-table {
            width: 100%;
            font-size: 13px;
            border-collapse: collapse;
        }
        .detail-table th,
        .detail-table td {
            border: 1px solid var(--brand-border);
            padding: 4px 8px;
            text-align: right;
        }
        .detail-table th {
            background: var(--brand-surface-2);
            font-weight: 600;
        }
        .full-cost-detail-table {
            border-collapse: collapse;
            font-size: 13px;
            table-layout: fixed;
        }
        .full-cost-detail-table th,
        .full-cost-detail-table td {
            border: 1px solid var(--brand-border);
            padding: 4px 8px;
            text-align: right;
        }
        .full-cost-detail-table th {
            background: var(--brand-surface-2);
            font-weight: 600;
            white-space: normal;
            word-break: break-word;
        }
        .full-cost-detail-table td {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .text-left {
            text-align: left !important;
        }
        .tabs {
            display: flex;
            gap: 10px;
            margin: 15px 0;
            flex-wrap: wrap;
        }
        .tab-btn {
            padding: 8px 20px;
            border: 1px solid var(--brand-border);
            border-radius: var(--brand-radius);
            background: var(--brand-border-light);
            cursor: pointer;
            font-family: inherit;
            font-weight: 500;
            color: var(--brand-text);
        }
        .tab-btn.active {
            background: var(--brand-orange);
            color: #fff;
            border-color: var(--brand-orange);
        }
        .tab-content {
            display: none;
        }
        .tab-content.active {
            display: block;
        }
        .gm-controls {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: center;
            margin-bottom: 20px;
        }
        .gm-controls label {
            font-weight: 500;
        }
        .gm-controls select {
            padding: 5px 10px;
            border-radius: 4px;
            border: 1px solid #d9dee5;
        }
        .btn-group {
            display: flex;
            gap: 10px;
            margin: 10px 0;
            flex-wrap: wrap;
        }
        .mode-switch {
            display: flex;
            gap: 10px;
            margin: 10px 0;
            align-items: center;
            flex-wrap: wrap;
        }
        .mode-switch label {
            font-weight: 500;
        }
        .mode-switch .btn {
            background: var(--brand-border-light);
            color: var(--brand-text);
            border: 1px solid var(--brand-border);
            padding: 5px 15px;
            cursor: pointer;
            border-radius: var(--brand-radius);
        }
        .mode-switch .btn:hover {
            border-color: var(--brand-gray-light);
        }
        .mode-switch .btn.active {
            background: var(--brand-orange);
            color: #fff;
            border-color: var(--brand-orange);
        }
        .export-btn {
            margin: 5px 0 15px 0;
        }
        .suggestions-container {
            position: relative;
            display: inline-block;
        }
        .suggestions-list {
            position: absolute;
            top: 100%;
            left: 0;
            z-index: 1000;
            background: #fff;
            border: 1px solid #d9dee5;
            border-radius: 4px;
            max-height: 200px;
            overflow-y: auto;
            width: 100%;
            min-width: 300px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            display: none;
        }
        .suggestions-list .suggestion-item {
            padding: 6px 12px;
            cursor: pointer;
            font-size: 13px;
        }
        .suggestions-list .suggestion-item:hover {
            background: var(--brand-border-light);
        }
        .no-suggestions {
            padding: 6px 12px;
            color: #999;
            font-style: italic;
        }
        #materialsInput {
            padding: 8px;
            width: 250px;
        }
        .material-tag {
            display: inline-flex;
            align-items: center;
            max-width: 320px;
            background: var(--brand-surface-2);
            border: 1px solid #dfe4ea;
            padding: 3px 6px 3px 10px;
            margin: 3px;
            border-radius: 12px;
            font-size: 12px;
            color: #333;
            cursor: default;
            vertical-align: middle;
        }
        .material-tag:hover {
            background: #e3f3e9;
            border-color: #c3e6cb;
        }
        .material-tag .tag-text {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .material-tag .del {
            cursor: pointer;
            font-weight: normal;
            margin-left: 6px;
            color: #adb5bd;
            font-size: 12px;
            line-height: 1;
            flex-shrink: 0;
        }
        .material-tag .del:hover {
            color: var(--brand-red);
        }
        .material-list-label {
            font-size: 12px;
            color: #888;
            margin: 8px 0 2px;
        }
        .material-list-tags {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
        }
        #loadingOverlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 9999;
            justify-content: center;
            align-items: center;
            flex-direction: column;
            color: #fff;
            font-size: 20px;
        }
        #loadingOverlay .big-spinner {
            width: 50px;
            height: 50px;
            border: 5px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 0.8s ease-in-out infinite;
            margin-bottom: 20px;
        }
        #loadingOverlay .loading-text {
            font-weight: bold;
        }
        .no-demand-block {
            padding: 15px;
            background: var(--brand-orange-pale);
            border: 1px solid var(--brand-orange-pale-2);
            border-radius: 4px;
            margin: 10px 0;
            color: var(--brand-orange-active);
        }
        .no-demand-block strong {
            font-size: 14px;
        }
        .full-cost-table {
            width: 100%;
            font-size: 13px;
            border-collapse: collapse;
        }
        .full-cost-table th,
        .full-cost-table td {
            border: 1px solid var(--brand-border);
            padding: 4px 8px;
            text-align: right;
        }
        .full-cost-table th {
            background: var(--brand-surface-2);
            font-weight: 600;
        }
        .full-cost-table .text-left {
            text-align: left !important;
        }
        .file-list-container {
            margin: 10px 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .file-row {
            display: flex;
            align-items: center;
            padding: 2px 0;
        }
        .file-row .file-label {
            font-size: 14px;
            display: inline-block;
            background: var(--brand-border-light);
            padding: 2px 10px;
            border-radius: 12px;
            transition: background 0.2s;
        }
        .file-row .file-label.loaded {
            background: var(--brand-green-pale);
            color: var(--brand-green-dark);
        }
        .file-row .file-label.load-error {
            background: var(--brand-red-pale);
            color: var(--brand-red-dark);
        }
        .file-row .file-status-icon {
            margin-left: 6px;
            font-size: 14px;
        }
        .settings-panel {
            background: var(--brand-surface-2);
            padding: 15px;
            border-radius: 8px;
            margin: 15px 0;
            border: 1px solid var(--brand-border);
            font-size: 13px;
        }
        .settings-panel .field {
            display: inline-block;
            margin-right: 20px;
            margin-bottom: 8px;
        }
        .settings-panel label {
            font-weight: 500;
            margin-right: 5px;
        }
        .settings-panel select,
        .settings-panel input {
            padding: 4px 8px;
            border-radius: 4px;
            border: 1px solid #d9dee5;
        }
        .settings-panel input[type="number"] {
            width: 80px;
        }
        .settings-panel .material-selector {
            width: 100%;
            margin-bottom: 15px;
            padding: 6px 10px;
            border-radius: 4px;
            border: 1px solid #d9dee5;
            font-size: 14px;
            background: #fff;
            cursor: pointer;
        }
        .extra-costs-block {
            margin: 12px 0;
            padding-top: 10px;
            border-top: 1px solid var(--brand-border);
        }
        .extra-costs-header {
            font-weight: 600;
            margin-bottom: 6px;
            color: #495057;
        }
        .extra-costs-empty {
            font-size: 12px;
            color: #999;
            font-style: italic;
            margin-bottom: 6px;
        }
        .extra-costs-block .extra-item {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 5px;
        }
        .extra-costs-block .extra-item .extra-name {
            width: 200px;
        }
        .extra-costs-block .extra-item .extra-pf,
        .extra-costs-block .extra-item .extra-pfps {
            width: 90px;
        }
        .extra-costs-block .extra-item .del-extra {
            color: var(--brand-red);
            cursor: pointer;
            font-weight: bold;
        }
        .extra-costs-block .extra-item .del-extra:hover {
            color: var(--brand-red-dark);
        }
        .extra-costs-block #fullCostAddExtraBtn {
            padding: 3px 12px;
            font-size: 14px;
            line-height: 1;
        }
        .sbyt-field {
            display: none;
        }
        .weight-field {
            display: none;
        }
        .extra-costs-row {
            margin: 10px 0;
            padding: 10px;
            background: var(--brand-orange-pale);
            border-radius: 6px;
            border: 1px solid var(--brand-orange-pale-2);
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
            align-items: center;
        }
        .extra-costs-row input {
            padding: 4px 8px;
            border-radius: 4px;
            border: 1px solid #d9dee5;
        }
        .extra-costs-row .field {
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }
        .supplier-field {
            width: 320px;
            position: relative;
        }
        .supplier-field .supplier-cost-row {
            display: flex;
            align-items: center;
            flex-wrap: nowrap;
        }
        .supplier-field .supplier-cost-row label {
            white-space: nowrap;
        }
        .supplier-field #fullCostSupplierCost {
            margin-left: auto;
            width: 110px;
            flex-shrink: 0;
        }
        .supplier-field .mini-toggle {
            font-weight: normal;
            font-size: 11px;
            margin-left: 6px;
            white-space: nowrap;
        }
        .supplier-field .mini-toggle label {
            font-weight: normal;
            margin-right: 8px;
            cursor: pointer;
        }
        .supplier-field .mini-toggle input {
            width: auto;
            padding: 0;
            margin-right: 2px;
            vertical-align: middle;
        }
        .supplier-field input[type="number"]:disabled {
            background: var(--brand-surface-2);
            color: #555;
            cursor: not-allowed;
        }
        .supplier-field .supplier-search {
            position: relative;
            display: inline-block;
            margin-top: 5px;
            width: 100%;
        }
        .supplier-field .supplier-defect {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 5px;
            width: 100%;
        }
        .supplier-field .supplier-defect label {
            display: flex;
            align-items: center;
            gap: 6px;
            font-weight: normal;
            font-size: 13px;
        }
        .supplier-field .supplier-defect input {
            width: 70px;
        }
        .supplier-field .supplier-search input {
            width: 100%;
            box-sizing: border-box;
        }
        .supplier-field .supplier-suggestions {
            position: absolute;
            top: 100%;
            left: 0;
            z-index: 1000;
            background: #fff;
            border: 1px solid #d9dee5;
            border-radius: 4px;
            max-height: 200px;
            overflow-y: auto;
            width: 100%;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            display: none;
        }
        .supplier-field .selected-supplier-display {
            font-size: 12px;
            color: #555;
            margin-top: 4px;
            min-height: 14px;
            width: 100%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            box-sizing: border-box;
            cursor: help;
        }
        .supplier-field .supplier-suggestions .suggestion-item {
            padding: 6px 12px;
            cursor: pointer;
            font-size: 13px;
        }
        .supplier-field .supplier-suggestions .suggestion-item:hover {
            background: var(--brand-border-light);
        }
        .supplier-field .supplier-suggestions .no-suggestions {
            padding: 6px 12px;
            color: #999;
            font-style: italic;
        }
        .section-header {
            background: var(--brand-border-light);
            padding: 6px 12px;
            font-weight: bold;
            margin-top: 15px;
            border-radius: 4px;
        }
        .gm-hidden {
            display: none;
        }
        .max-price-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 10px;
            font-size: 13px;
        }
        .max-price-table th,
        .max-price-table td {
            border: 1px solid var(--brand-border);
            padding: 6px 10px;
            text-align: right;
        }
        .max-price-table th {
            background: var(--brand-surface-2);
            font-weight: 600;
            text-align: center;
        }
        .max-price-table .text-left {
            text-align: left;
        }
        .max-price-table .text-right {
            text-align: right;
        }
        .max-price-table .max-price-col {
            width: 160px;
        }
        .zero-cost {
            background-color: var(--brand-red-pale) !important;
        }
        .full-cost-wrapper {
            overflow-x: auto;
            max-width: 100%;
            margin: 10px 0;
        }
        .library-status {
            font-size: 13px;
            color: #555;
            margin-left: 10px;
        }
        .library-badge {
            background: var(--brand-green);
            color: #fff;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 11px;
            margin-left: 5px;
        }
        .library-actions {
            margin: 10px 0;
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        .gm-list-modal {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.3);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .gm-list-modal-inner {
            background: #fff;
            border-radius: 6px;
            padding: 16px;
            width: 320px;
            max-height: 70vh;
            overflow-y: auto;
            box-shadow: 0 4px 20px rgba(0,0,0,0.25);
        }
        .custom-gm-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 4px 6px;
            border-bottom: 1px solid var(--brand-border-light);
            font-size: 13px;
        }
        .custom-gm-item .del-gm {
            color: var(--brand-red);
            cursor: pointer;
            font-weight: bold;
        }
        .library-wrapper {
            overflow-x: auto;
            max-width: 100%;
            position: relative;
            max-height: 338px;
            overflow-y: auto;
        }
        .library-wrapper::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        .library-wrapper::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }
        .library-wrapper::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 4px;
        }
        .library-wrapper::-webkit-scrollbar-thumb:hover {
            background: #a8a8a8;
        }
        .library-filter {
            margin-bottom: 10px;
            display: flex;
            gap: 10px;
            align-items: center;
        }
        .library-filter input {
            padding: 6px 10px;
            border: 1px solid #d9dee5;
            border-radius: 4px;
            width: 300px;
            font-size: 14px;
        }
        .library-filter .filter-clear {
            cursor: pointer;
            color: var(--brand-orange);
        }
        .library-filter .filter-clear:hover {
            text-decoration: underline;
        }
        .library-table {
            width: 100%;
            font-size: 13px;
            border-collapse: collapse;
            margin-top: 10px;
            table-layout: fixed;
        }
        .library-table th,
        .library-table td {
            border: 1px solid var(--brand-border);
            padding: 4px 8px;
            text-align: left;
            vertical-align: middle;
        }
        .library-table th {
            background: var(--brand-surface-2);
            font-weight: 600;
            position: sticky;
            top: 0;
            z-index: 10;
        }
        .library-table th:first-child,
        .library-table td:first-child {
            position: sticky;
            left: 0;
            z-index: 5;
            background: #fff;
            min-width: 30px;
            max-width: 30px;
            width: 30px;
        }
        .library-table th:first-child {
            z-index: 15;
            background: var(--brand-surface-2);
        }
        .library-table td:first-child {
            background: #fff;
        }
        .library-table th:nth-child(2),
        .library-table td:nth-child(2) {
            position: sticky;
            left: 30px;
            z-index: 5;
            background: #fff;
            min-width: 240px;
            max-width: 280px;
            width: 260px;
        }
        .library-table th:nth-child(2) {
            z-index: 15;
            background: var(--brand-surface-2);
        }
        .library-table td:nth-child(2) {
            background: #fff;
        }
        .library-table th:nth-child(3) {
            min-width: 252px;
            width: 252px;
        }
        .library-table th:nth-child(4) {
            min-width: 64px;
            width: 64px;
        }
        .library-table th:nth-child(5) {
            min-width: 67px;
            width: 67px;
        }
        .library-table th:nth-child(6) {
            min-width: 67px;
            width: 67px;
        }
        .library-table th:nth-child(7) {
            min-width: 67px;
            width: 67px;
        }
        .library-table th:nth-child(8) {
            min-width: 308px;
            width: 308px;
        }
        .library-table th:nth-child(9) {
            min-width: 67px;
            width: 67px;
        }
        .library-table th:nth-child(10) {
            min-width: 67px;
            width: 67px;
        }
        .library-table th:nth-child(11) {
            min-width: 67px;
            width: 67px;
        }
        .library-table th:nth-child(12) {
            min-width: 252px;
            width: 252px;
        }
        .library-table th:nth-child(13) {
            min-width: 250px;
            width: 250px;
        }
        .library-table th:nth-child(14) {
            min-width: 30px;
            width: 30px;
        }
        .library-table td:nth-child(3) {
            width: 252px;
        }
        .library-table td:nth-child(4) {
            width: 64px;
        }
        .library-table td:nth-child(5) {
            width: 67px;
        }
        .library-table td:nth-child(6) {
            width: 67px;
        }
        .library-table td:nth-child(7) {
            width: 67px;
        }
        .library-table td:nth-child(8) {
            width: 308px;
        }
        .library-table td:nth-child(9) {
            width: 67px;
        }
        .library-table td:nth-child(10) {
            width: 67px;
        }
        .library-table td:nth-child(11) {
            width: 67px;
        }
        .library-table td:nth-child(12) {
            width: 252px;
        }
        .library-table td:nth-child(13) {
            width: 250px;
        }
        .library-table td:nth-child(14) {
            width: 30px;
        }
        .library-table select,
        .library-table input[type="number"],
        .library-table input[type="text"] {
            padding: 2px 4px;
            border: 1px solid #d9dee5;
            border-radius: 3px;
            font-size: 12px;
            width: 100%;
            box-sizing: border-box;
        }
        .library-table select {
            width: auto;
            min-width: 60px;
        }
        .library-table input[type="text"] {
            width: 100%;
        }
        .library-table .extra-item {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-bottom: 2px;
            flex-wrap: nowrap;
        }
        .library-table .extra-item .extra-name {
            width: 70px;
            flex-shrink: 0;
        }
        .library-table .extra-item .extra-pf,
        .library-table .extra-item .extra-pfps {
            width: 60px;
            flex-shrink: 0;
        }
        .library-table .extra-item .del-extra {
            color: var(--brand-red);
            cursor: pointer;
            font-weight: bold;
            margin-left: 2px;
            flex-shrink: 0;
        }
        .library-table .extra-item .del-extra:hover {
            color: var(--brand-red-dark);
        }
        .library-table .del {
            color: var(--brand-red);
            cursor: pointer;
            font-weight: bold;
            margin-left: 5px;
        }
        .library-table .del:hover {
            color: var(--brand-red-dark);
        }
        .library-table .checkbox-col input[type="checkbox"] {
            cursor: pointer;
        }
        .library-table .fu-components-cell {
            font-size: 12px;
            line-height: 1.4;
        }
        .library-table .fu-components-cell .fu-item {
            display: block;
            margin: 1px 0;
            padding: 0;
            background: none;
            border-radius: 0;
        }
        .library-table .lib-supplier-cost:disabled {
            background: #f0f0f0;
            color: #333;
            cursor: default;
        }
        .library-table .lib-nds:disabled {
            background: #f0f0f0;
            color: #999;
            cursor: default;
        }
        .library-description {
            display: none;
        }

        /* ===== Кнопка "Помощь" и модальное окно с инструкцией ===== */
        .step-header-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            flex-wrap: wrap;
        }
        .step-header-row h3 {
            margin: 0;
        }
        .btn-help {
            white-space: nowrap;
        }
        .help-modal {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.35);
            z-index: 2000;
            display: flex;
            align-items: flex-start;
            justify-content: center;
            padding: 40px 20px;
            overflow-y: auto;
        }
        .help-modal-inner {
            background: #fff;
            border-radius: 8px;
            padding: 20px 25px;
            width: 100%;
            max-width: 640px;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
        }
        .help-modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid var(--brand-border-light);
            padding-bottom: 10px;
            margin-bottom: 12px;
        }
        .help-modal-header h3 {
            margin: 0;
        }
        .help-modal-close {
            cursor: pointer;
            font-size: 18px;
            opacity: 0.6;
            padding: 0 4px;
        }
        .help-modal-close:hover {
            opacity: 1;
        }
        .help-modal-body ol {
            padding-left: 20px;
            margin: 0;
        }
        .help-modal-body li {
            margin-bottom: 12px;
            line-height: 1.45;
        }
        .help-modal-note {
            margin-top: 14px;
            padding: 10px 12px;
            background: var(--brand-orange-pale);
            border-radius: 6px;
            font-size: 13px;
        }
        /* Сокращения имеют title-подсказку при наведении, без визуального выделения */
        .abbr-hint {
        }
        .help-glossary {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
            margin-top: 6px;
        }
        .help-glossary td {
            padding: 5px 8px;
            border-bottom: 1px solid var(--brand-border-light);
            vertical-align: top;
        }
        .help-glossary td:first-child {
            font-weight: bold;
            white-space: nowrap;
            width: 90px;
        }

        /* ===== Единый фокус-стиль полей ввода (как у остальных инструментов сайта) ===== */
        input[type="text"]:focus,
        input[type="number"]:focus,
        select:focus {
            outline: none;
            border-color: var(--brand-orange);
            box-shadow: 0 0 0 3px rgba(232, 118, 19, .16);
        }

        /* ===== Надстройка удобства (v1.3): шаги, перетаскивание, счётчик ===== */

        /* Полоска шагов */
        .stepper {
            display: flex;
            gap: 7px;
            flex-wrap: wrap;
            margin: 14px 0 0;
        }
        .stepper-item {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            border: 1px solid var(--brand-border);
            background: #fff;
            color: var(--brand-gray-light);
            font-family: var(--ui);
            font-size: 12.5px;
            font-weight: 600;
            border-radius: 20px;
            padding: 5px 14px 5px 6px;
            cursor: default;
            transition: border-color .12s, color .12s, background .12s;
        }
        .stepper-item .n {
            width: 21px;
            height: 21px;
            border-radius: 50%;
            background: var(--brand-border-light);
            color: var(--brand-gray);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 11.5px;
            flex: none;
        }
        .stepper-item.on {
            color: var(--brand-ink-2);
            cursor: pointer;
        }
        .stepper-item.on:hover {
            border-color: var(--brand-orange);
            color: var(--brand-orange-dark);
        }
        .stepper-item.on .n {
            background: var(--brand-orange-pale);
            color: var(--brand-orange-dark);
        }
        .stepper-item.done .n {
            background: var(--brand-green-pale);
            color: var(--brand-green-dark);
        }
        .stepper-item.cur {
            border-color: var(--brand-orange);
            background: var(--brand-orange-pale);
            color: var(--brand-orange-dark);
        }
        .stepper-item.cur .n {
            background: var(--brand-orange);
            color: #fff;
        }

        /* Зона перетаскивания файлов */
        .dropzone {
            margin: 4px 0 14px;
            background: var(--brand-surface-2);
            border: 1.5px dashed #c8d1dc;
            border-radius: var(--brand-radius-lg);
            padding: 16px 18px;
            display: flex;
            align-items: center;
            gap: 14px;
            cursor: pointer;
            transition: border-color .15s, background .15s;
        }
        .dropzone:hover,
        .dropzone.over {
            border-color: var(--brand-orange);
            background: var(--brand-orange-pale);
        }
        .dropzone .ico {
            font-size: 26px;
            flex: none;
        }
        .dropzone b {
            display: block;
            font-size: 13.5px;
        }
        .dropzone small {
            color: var(--brand-gray);
            font-size: 12px;
        }

        /* Счётчик «выбрано X из 7» */
        .file-counter {
            font-size: 12.5px;
            color: var(--brand-gray);
        }
        .file-counter b {
            color: var(--brand-text);
        }
        .file-counter.warn {
            color: var(--brand-orange-active);
        }

        /* Файл выбран, но ещё не загружен (класс ставит app.js, стиля не имел) */
        .file-row .file-label.selected {
            background: var(--brand-orange-pale);
            color: var(--brand-orange-active);
        }

        /* Сокращения с подсказкой: пунктир показывает, что можно навести мышь */
        .abbr-hint {
            border-bottom: 1px dotted var(--brand-gray-light);
            cursor: help;
        }
