<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://www.pandoraburo.ru/" xml:lang="ru">
  <id>https://www.pandoraburo.ru/zavodskoy-kalkulyator-rascheta-tcen-s-reklamoy</id>
  <link href="https://www.pandoraburo.ru/zavodskoy-kalkulyator-rascheta-tcen-s-reklamoy.xml" rel="self"/>
  <title>Заводской калькулятор расчета цен с рекламой</title>
  <subtitle type="html">
&lt;html lang="ru"&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;title&gt;Арсенал-Деталь — Калькулятор ценообразования&lt;/title&gt;
    &lt;style&gt;
        :root {
            --neon-green: #00ff9d;
            --neon-cyan: #00e5ff;
            --neon-purple: #b537f2;
            --neon-gold: #d4af37;
            --neon-gold-light: #f0d060;
            --neon-pink: #ff2d95;
            --bg-dark: #0a0a0c;
            --bg-panel: #121218;
            --bg-input: #1a1a24;
            --border-dim: #2a2a3a;
            --text-main: #e0e0e8;
            --text-dim: #8888a0;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg-dark);
            background-image:
                radial-gradient(circle at 15% 15%, rgba(0, 255, 157, 0.06) 0%, transparent 40%),
                radial-gradient(circle at 85% 85%, rgba(181, 55, 242, 0.06) 0%, transparent 40%),
                radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.03) 0%, transparent 60%);
            background-attachment: fixed;
            animation: bgPulse 14s ease-in-out infinite alternate;
            min-height: 100vh;
            padding: 20px;
            color: var(--text-main);
        }

        @keyframes bgPulse {
            0% { background-position: 0% 0%, 100% 100%, 50% 50%; }
            100% { background-position: 25% 25%, 75% 75%, 50% 50%; }
        }

        .container {
            max-width: 1500px;
            margin: 0 auto;
            background: var(--bg-panel);
            border-radius: 22px;
            border: 1px solid var(--border-dim);
            box-shadow: 0 0 80px rgba(212, 175, 55, 0.1), 0 0 50px rgba(0, 255, 157, 0.05);
            overflow: hidden;
        }

        /* ===== ШАПКА ===== */
        .header {
            background: linear-gradient(135deg, #0a0a0c 0%, #1a1a24 100%);
            border-bottom: 3px solid var(--neon-gold);
            color: white;
            padding: 28px 40px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: relative;
            overflow: hidden;
        }

        .header::after {
            content: '';
            position: absolute;
            bottom: 0; left: 0; right: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent, var(--neon-gold), transparent);
            opacity: 0.7;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 14px;
            text-decoration: none;
            transition: transform 0.25s;
        }

        .logo:hover { transform: translateY(-2px); }

        .logo-icon {
            width: 54px;
            height: 54px;
            background: linear-gradient(135deg, var(--neon-gold), #8a6d1f);
            border-radius: 13px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 26px;
            color: #0a0a0c;
            font-weight: 900;
            box-shadow: 0 0 24px rgba(212, 175, 55, 0.55);
            transition: box-shadow 0.25s;
        }

        .logo:hover .logo-icon { box-shadow: 0 0 40px rgba(212, 175, 55, 0.95); }

        .logo-text h1 {
            font-size: 26px;
            font-weight: 800;
            margin-bottom: 4px;
            background: linear-gradient(90deg, var(--neon-gold), var(--neon-gold-light));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            letter-spacing: 1.5px;
            text-shadow: 0 0 25px rgba(212, 175, 55, 0.4);
        }

        .logo-text p { font-size: 13px; color: var(--text-dim); transition: color 0.25s; }
        .logo:hover .logo-text p { color: var(--neon-gold); }

        .header-actions { display: flex; gap: 12px; }

        .btn-icon {
            width: 44px;
            height: 44px;
            border-radius: 11px;
            background: var(--bg-input);
            border: 1px solid var(--border-dim);
            color: var(--neon-gold);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            transition: all 0.2s;
        }

        .btn-icon:hover {
            background: var(--neon-gold);
            color: #0a0a0c;
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
            transform: translateY(-2px);
        }

        /* ===== ОБЩИЙ ПОТОК БЛОКОВ ===== */
        .stack {
            display: flex;
            flex-direction: column;
            gap: 22px;
            padding: 28px 36px 36px;
        }

        .section-title {
            font-size: 18px;
            font-weight: 700;
            color: var(--neon-cyan);
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            gap: 10px;
            text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
        }

        .section-title::before {
            content: '';
            width: 4px; height: 20px;
            background: var(--neon-cyan);
            border-radius: 2px;
            box-shadow: 0 0 10px var(--neon-cyan);
        }

        .preset-buttons {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .preset-btn {
            padding: 10px 18px;
            background: var(--bg-input);
            border: 2px solid var(--border-dim);
            border-radius: 10px;
            font-size: 13px;
            font-weight: 600;
            color: var(--text-main);
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
        }

        .preset-btn:hover {
            border-color: var(--neon-cyan);
            background: rgba(0, 229, 255, 0.08);
            transform: translateY(-2px);
            box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
        }

        .preset-btn.active {
            background: var(--neon-cyan);
            color: #0a0a0c;
            border-color: var(--neon-cyan);
            box-shadow: 0 0 18px rgba(0, 229, 255, 0.5);
        }

        /* ===== ЗОЛОТОЙ БЛОК ===== */
        .gold-block {
            position: relative;
            background: var(--bg-input);
            border-radius: 16px;
            padding: 24px 26px;
            border: 1.5px solid rgba(212, 175, 55, 0.45);
            box-shadow:
                0 0 0 1px rgba(212, 175, 55, 0.1),
                0 0 25px rgba(212, 175, 55, 0.08),
                inset 0 0 30px rgba(212, 175, 55, 0.03);
            transition: border-color 0.3s, box-shadow 0.3s;
        }

        .gold-block::before {
            content: '';
            position: absolute;
            top: 0; left: 20px; right: 20px;
            height: 2px;
            background: linear-gradient(90deg, transparent, var(--neon-gold), transparent);
            opacity: 0.6;
            border-radius: 2px;
        }

        .gold-block:hover {
            border-color: rgba(212, 175, 55, 0.75);
            box-shadow:
                0 0 0 1px rgba(212, 175, 55, 0.2),
                0 0 35px rgba(212, 175, 55, 0.18),
                inset 0 0 40px rgba(212, 175, 55, 0.05);
        }

        .gold-block .panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 18px;
            padding-bottom: 14px;
            border-bottom: 1px dashed rgba(212, 175, 55, 0.3);
        }

        .panel-title {
            font-size: 16px;
            font-weight: 700;
            color: var(--neon-gold-light);
            display: flex;
            align-items: center;
            gap: 8px;
            letter-spacing: 0.3px;
        }

        .panel-badge {
            font-size: 11px;
            padding: 4px 12px;
            background: rgba(0, 255, 157, 0.12);
            color: var(--neon-green);
            border-radius: 12px;
            font-weight: 700;
            border: 1px solid rgba(0, 255, 157, 0.3);
            box-shadow: 0 0 10px rgba(0, 255, 157, 0.15);
            letter-spacing: 0.5px;
        }

        /* ===== ПОЛЯ: распределены по ширине ===== */
        .fields {
            display: grid;
            gap: 16px;
        }

        .fields.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .fields.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        .fields.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
        .fields.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

        .field-span-2 { grid-column: span 2; }
        .field-span-3 { grid-column: span 3; }
        .field-span-4 { grid-column: span 4; }
        .field-full { grid-column: 1 / -1; }

        @media (max-width: 1100px) {
            .fields.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
            .fields.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        }

        @media (max-width: 800px) {
            .fields.cols-2,
            .fields.cols-3,
            .fields.cols-4,
            .fields.cols-5 { grid-template-columns: 1fr; }
            .field-span-2, .field-span-3, .field-span-4 { grid-column: span 1; }
        }

        .field {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .field label {
            font-size: 11px;
            font-weight: 700;
            color: var(--neon-gold);
            margin-bottom: 7px;
            text-transform: uppercase;
            letter-spacing: 0.8px;
            opacity: 0.9;
        }

        .field input,
        .field select {
            padding: 12px 14px;
            border: 1.5px solid var(--border-dim);
            border-radius: 10px;
            font-size: 14px;
            transition: all 0.2s;
            background: var(--bg-panel);
            color: var(--text-main);
            font-family: inherit;
            width: 100%;
            min-width: 0;
        }

        .field input:focus,
        .field select:focus {
            outline: none;
            border-color: var(--neon-gold);
            box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15), 0 0 20px rgba(212, 175, 55, 0.25);
        }

        .field select option { background: var(--bg-panel); color: var(--text-main); }

        .field-hint {
            font-size: 11px;
            color: var(--text-dim);
            margin-top: 5px;
            opacity: 0.75;
        }

        /* ===== ВИМ ===== */
        .vim-bar {
            margin-top: 16px;
            background: var(--bg-panel);
            height: 10px;
            border-radius: 5px;
            overflow: hidden;
            border: 1px solid rgba(212, 175, 55, 0.3);
        }

        .vim-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
            transition: width 0.4s;
            border-radius: 5px;
            box-shadow: 0 0 14px rgba(0, 255, 157, 0.7);
        }

        .vim-label {
            display: flex;
            justify-content: space-between;
            font-size: 12px;
            color: var(--text-dim);
            margin-top: 8px;
            gap: 12px;
            flex-wrap: wrap;
        }

        /* ===== ДИНАМИЧЕСКИЕ СТРОКИ ===== */
        .dynamic-rows { display: flex; flex-direction: column; gap: 10px; }

        .dynamic-row {
            display: grid;
            grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr) minmax(0, 1fr) 44px;
            gap: 12px;
            align-items: center;
            padding: 12px 14px;
            background: var(--bg-panel);
            border-radius: 10px;
            border: 1px solid var(--border-dim);
            transition: border-color 0.2s;
        }

        .dynamic-row:hover { border-color: rgba(212, 175, 55, 0.4); }

        .dynamic-row input,
        .dynamic-row select {
            padding: 9px 12px;
            border: 1px solid var(--border-dim);
            border-radius: 8px;
            font-size: 13px;
            background: var(--bg-input);
            color: var(--text-main);
            font-family: inherit;
            min-width: 0;
            width: 100%;
        }

        .dynamic-row input:focus,
        .dynamic-row select:focus {
            outline: none;
            border-color: var(--neon-gold);
            box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
        }

        .btn-remove {
            width: 36px; height: 36px;
            border-radius: 8px;
            background: rgba(255, 45, 149, 0.15);
            border: 1px solid rgba(255, 45, 149, 0.3);
            color: var(--neon-pink);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            transition: all 0.2s;
            justify-self: center;
        }

        .btn-remove:hover {
            background: var(--neon-pink);
            color: #0a0a0c;
            box-shadow: 0 0 15px rgba(255, 45, 149, 0.6);
        }

        .btn-add {
            width: 100%;
            padding: 13px;
            background: transparent;
            border: 2px dashed rgba(212, 175, 55, 0.4);
            border-radius: 10px;
            color: var(--neon-gold);
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            margin-top: 12px;
            font-family: inherit;
            font-size: 13px;
            letter-spacing: 0.5px;
        }

        .btn-add:hover {
            border-color: var(--neon-gold);
            background: rgba(212, 175, 55, 0.08);
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.25);
            color: var(--neon-gold-light);
        }

        /* ===== ЦЕНА — ГЛАВНЫЙ ЗОЛОТОЙ БЛОК ===== */
        .price-block {
            background: linear-gradient(135deg, #121218 0%, #1a1408 100%);
            border: 2px solid var(--neon-gold);
            box-shadow:
                0 0 0 1px rgba(212, 175, 55, 0.25),
                0 0 50px rgba(212, 175, 55, 0.3),
                inset 0 0 60px rgba(212, 175, 55, 0.06);
            text-align: center;
        }

        .price-block .panel-header {
            border-bottom: none;
            margin-bottom: 8px;
            padding-bottom: 0;
            justify-content: center;
        }

        .price-label {
            font-size: 13px;
            color: var(--neon-gold);
            text-transform: uppercase;
            letter-spacing: 2px;
            font-weight: 800;
        }

        .price-value {
            font-size: 64px;
            font-weight: 900;
            background: linear-gradient(135deg, var(--neon-gold-light), var(--neon-gold), #b8941f);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin: 10px 0 6px;
            filter: drop-shadow(0 0 25px rgba(212, 175, 55, 0.6));
            line-height: 1.05;
            word-break: break-word;
        }

        .price-currency {
            font-size: 15px;
            color: var(--text-dim);
            font-weight: 600;
            letter-spacing: 0.5px;
        }

        .margin-badge {
            display: inline-block;
            padding: 9px 24px;
            border-radius: 20px;
            font-weight: 700;
            font-size: 14px;
            margin-top: 16px;
        }

        .margin-badge.high { background: rgba(0, 255, 157, 0.15); color: var(--neon-green); border: 1px solid rgba(0, 255, 157, 0.4); box-shadow: 0 0 15px rgba(0, 255, 157, 0.25); }
        .margin-badge.good { background: rgba(0, 229, 255, 0.15); color: var(--neon-cyan); border: 1px solid rgba(0, 229, 255, 0.4); box-shadow: 0 0 15px rgba(0, 229, 255, 0.25); }
        .margin-badge.low { background: rgba(212, 175, 55, 0.15); color: var(--neon-gold); border: 1px solid rgba(212, 175, 55, 0.4); box-shadow: 0 0 15px rgba(212, 175, 55, 0.25); }
        .margin-badge.danger { background: rgba(255, 45, 149, 0.15); color: var(--neon-pink); border: 1px solid rgba(255, 45, 149, 0.4); box-shadow: 0 0 15px rgba(255, 45, 149, 0.25); }

        /* ===== СТРУКТУРА (2 колонки) ===== */
        .breakdown-list {
            display: flex;
            flex-direction: column;
            gap: 0;
        }

        .breakdown-item {
            display: flex;
            justify-content: space-between;
            padding: 11px 0;
            border-bottom: 1px solid rgba(212, 175, 55, 0.12);
            font-size: 14px;
            gap: 12px;
        }

        .breakdown-item:last-child { border-bottom: none; }
        .breakdown-item .name { color: var(--text-dim); }
        .breakdown-item .cost { font-weight: 700; color: var(--text-main); white-space: nowrap; }

        .total-row {
            display: flex;
            justify-content: space-between;
            padding: 16px 0 4px 0;
            border-top: 2px solid var(--neon-gold);
            margin-top: 8px;
            font-weight: 800;
            font-size: 18px;
            gap: 12px;
            color: var(--neon-gold-light);
        }

        /* ===== 3-КОЛОНОЧНЫЙ ИТОГ: gauge + партия ===== */
        .summary-grid {
            display: grid;
            grid-template-columns: 1fr 2fr;
            gap: 20px;
            align-items: center;
        }

        @media (max-width: 800px) {
            .summary-grid { grid-template-columns: 1fr; }
        }

        .gauge-container { text-align: center; }
        .gauge-svg { width: 190px; height: 105px; }

        .gauge-value {
            font-size: 34px;
            font-weight: 800;
            color: var(--neon-cyan);
            margin-top: 6px;
            text-shadow: 0 0 22px rgba(0, 229, 255, 0.6);
        }

        .gauge-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; letter-spacing: 0.5px; }

        .batch-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
        }

        .stat-box {
            background: var(--bg-panel);
            padding: 18px 12px;
            border-radius: 12px;
            text-align: center;
            border: 1px solid rgba(212, 175, 55, 0.3);
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .stat-box:hover {
            border-color: rgba(212, 175, 55, 0.6);
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
        }

        .stat-label {
            font-size: 10px;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: 0.8px;
            margin-bottom: 8px;
            font-weight: 700;
        }

        .stat-value { font-size: 17px; font-weight: 800; color: var(--text-main); }
        .stat-value.profit { color: var(--neon-green); text-shadow: 0 0 12px rgba(0, 255, 157, 0.5); }

        /* ===== КНОПКИ ===== */
        .actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 14px;
        }

        @media (max-width: 600px) { .actions { grid-template-columns: 1fr; } }

        .btn-action {
            padding: 16px;
            border-radius: 12px;
            font-weight: 800;
            font-size: 15px;
            cursor: pointer;
            border: none;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            font-family: inherit;
            letter-spacing: 0.5px;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--neon-gold), #b8941f);
            color: #0a0a0c;
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.35);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 30px rgba(212, 175, 55, 0.6);
        }

        .btn-secondary {
            background: transparent;
            color: var(--neon-gold);
            border: 2px solid rgba(212, 175, 55, 0.5);
        }

        .btn-secondary:hover {
            border-color: var(--neon-gold);
            background: rgba(212, 175, 55, 0.08);
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
        }

        /* ===== ТОГГЛ ===== */
        .toggle-row {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 16px;
            background: var(--bg-panel);
            border-radius: 10px;
            border: 1px solid rgba(212, 175, 55, 0.3);
            margin-top: 16px;
            flex-wrap: wrap;
        }

        .toggle-switch { position: relative; width: 52px; height: 28px; flex-shrink: 0; }
        .toggle-switch input { opacity: 0; width: 0; height: 0; }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0; left: 0; right: 0; bottom: 0;
            background-color: var(--border-dim);
            transition: .4s;
            border-radius: 26px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 22px; width: 22px;
            left: 3px; bottom: 3px;
            background-color: var(--text-dim);
            transition: .4s;
            border-radius: 50%;
        }

        .toggle-switch input:checked + .toggle-slider {
            background-color: var(--neon-green);
            box-shadow: 0 0 18px rgba(0, 255, 157, 0.6);
        }

        .toggle-switch input:checked + .toggle-slider:before {
            transform: translateX(24px);
            background-color: #0a0a0c;
        }

        .toggle-label { font-size: 14px; font-weight: 700; color: var(--text-main); }

        .toggle-input {
            width: 90px;
            padding: 10px 12px;
            background: var(--bg-input);
            border: 1.5px solid var(--border-dim);
            border-radius: 8px;
            color: var(--neon-green);
            font-size: 15px;
            font-weight: 800;
            font-family: inherit;
            text-align: center;
        }

        .toggle-input:focus {
            outline: none;
            border-color: var(--neon-green);
            box-shadow: 0 0 0 3px rgba(0, 255, 157, 0.15);
        }

        .toggle-hint { font-size: 12px; color: var(--text-dim); margin-left: auto; }

        /* ===== МОДАЛКА ===== */
        .history-modal {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(5px);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }

        .history-modal.active { display: flex; }

        .history-content {
            background: var(--bg-panel);
            border: 1.5px solid var(--neon-gold);
            border-radius: 20px;
            max-width: 800px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            padding: 30px;
            box-shadow: 0 0 60px rgba(212, 175, 55, 0.3);
        }

        .history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

        .history-item {
            padding: 16px;
            background: var(--bg-input);
            border: 1px solid var(--border-dim);
            border-radius: 12px;
            margin-bottom: 12px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .history-item:hover {
            background: rgba(212, 175, 55, 0.06);
            border-color: var(--neon-gold);
            transform: translateX(4px);
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
        }

        .history-date { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
        .history-info { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
        .history-name { font-weight: 700; color: var(--text-main); }
        .history-price { font-size: 18px; font-weight: 800; color: var(--neon-gold); text-shadow: 0 0 12px rgba(212, 175, 55, 0.4); white-space: nowrap; }

        /* ===== БАННЕР И КОНТАКТЫ ===== */
        .ds-banner {
            max-width: 640px;
            margin: 24px auto 14px;
            background: radial-gradient(120% 120% at 20% 0%, rgba(212,175,55,.18), transparent 55%),
                        linear-gradient(135deg, #111, #0a0a0a);
            border: 1px solid #d4af37;
            border-radius: 14px;
            padding: 24px;
            text-align: center;
            box-shadow: 0 6px 22px rgba(0,0,0,.6);
        }

        .ds-banner-tag {
            display: inline-block;
            background: #d4af37;
            color: #0a0a0a;
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 2px;
            padding: 3px 12px;
            border-radius: 999px;
            margin-bottom: 12px;
        }

        .ds-banner-title { font-weight: 800; font-size: 22px; line-height: 1.15; color: #fff; margin-bottom: 10px; }
        .ds-banner-phone { font-size: 18px; font-weight: 800; color: #d4af37; margin-bottom: 4px; }
        .ds-banner-note { font-size: 12px; color: #9a8040; }

        .ds-cta {
            text-align: center;
            background: #0a0a0a;
            border: 1px solid #d4af37;
            border-radius: 12px;
            padding: 28px 20px;
            margin-top: 14px;
            max-width: 1500px;
            margin-left: auto;
            margin-right: auto;
        }

        .ds-cta-text { font-size: 16px; font-weight: 600; color: #d4af37; margin: 0 0 16px; }

        .ds-cta-btn {
            display: inline-block;
            background: #d4af37;
            color: #0a0a0a;
            text-decoration: none;
            padding: 16px 40px;
            font-size: 20px;
            font-weight: 800;
            letter-spacing: 1px;
            border-radius: 999px;
            transition: .25s;
            margin: 0 6px;
        }

        .ds-cta-btn:hover {
            background: #f0d060;
            transform: scale(1.03);
            box-shadow: 0 0 25px rgba(212, 175, 55, 0.6);
        }

        .ds-cta-mail {
            display: inline-block;
            color: #d4af37;
            text-decoration: none;
            padding: 16px 30px;
            font-size: 16px;
            font-weight: 700;
            border: 1px solid #d4af37;
            border-radius: 999px;
            transition: .25s;
            margin: 0 6px;
        }

        .ds-cta-mail:hover {
            background: #d4af37;
            color: #0a0a0a;
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
        }

        .ds-manager { margin: 16px 0 0; font-size: 13px; color: #d4af37; opacity: .8; }

        /* ===== ЗОЛОТЫЕ ПОЛЗУНКИ ===== */
        ::-webkit-scrollbar { width: 18px; height: 18px; }
        ::-webkit-scrollbar-track {
            background: #050505;
            border: 1px solid #2a2210;
            border-radius: 9px;
            box-shadow: inset 0 0 12px rgba(212, 175, 55, 0.2);
        }
        ::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, #ffffcc 0%, #ffd700 15%, #ff8c00 35%, #d4af37 50%, #ff8c00 65%, #ffd700 85%, #ffffcc 100%);
            border: 1px solid #ffd700;
            border-radius: 9px;
            box-shadow: 0 0 10px rgba(255, 215, 0, 0.9), 0 0 20px rgba(255, 140, 0, 0.7), 0 0 30px rgba(255, 80, 0, 0.4), inset 0 0 8px rgba(255, 255, 255, 0.5);
            background-size: 100% 200%;
            animation: fireFlow 2.5s linear infinite;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, #ffffff 0%, #ffffcc 20%, #ffd700 40%, #ff8c00 60%, #ffd700 80%, #ffffff 100%);
            box-shadow: 0 0 18px rgba(255, 215, 0, 1), 0 0 36px rgba(255, 140, 0, 0.9), 0 0 54px rgba(255, 80, 0, 0.6), inset 0 0 12px rgba(255, 255, 255, 0.8);
        }
        @keyframes fireFlow { 0% { background-position: 0% 0%; } 100% { background-position: 0% 200%; } }

        /* ===== ПЕЧАТЬ ===== */
        @media print {
            body { background: white; padding: 0; }
            .header, .actions, .preset-buttons, .ds-banner, .ds-cta, .btn-icon, .btn-add, .btn-remove, .toggle-row { display: none !important; }
            .container { box-shadow: none; border-radius: 0; border: none; }
            .stack { padding: 0; gap: 14px; }
            .gold-block, .price-block { background: white; border: 1.5px solid #b8941f; box-shadow: none; }
            .panel-title, .field label { color: #8a6d1f; }
            .price-value { -webkit-text-fill-color: #b8941f; color: #b8941f; filter: none; }
            .stat-box { border-color: #b8941f; }
        }

        @media (max-width: 768px) {
            .header { padding: 20px; flex-direction: column; gap: 16px; text-align: center; }
            .stack { padding: 20px; gap: 16px; }
            .gold-block { padding: 18px; }
            .price-value { font-size: 42px; }
            .logo-text h1 { font-size: 22px; }
            .summary-grid { grid-template-columns: 1fr; }
            .dynamic-row { grid-template-columns: 1fr; }
            .dynamic-row .btn-remove { justify-self: end; }
            .ds-cta-btn, .ds-cta-mail { width: 100%; padding: 14px 10px; font-size: 16px; margin: 4px 0; }
            .batch-stats { grid-template-columns: 1fr; }
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div class="container"&gt;
        &lt;div class="header"&gt;
            &lt;a href="https://brony-rf.ru/" target="_blank" rel="noopener" class="logo"&gt;
                &lt;div class="logo-icon"&gt;А&lt;/div&gt;
                &lt;div class="logo-text"&gt;
                    &lt;h1&gt;Арсенал-Деталь&lt;/h1&gt;
                    &lt;p&gt;Калькулятор ценообразования машиностроительного завода&lt;/p&gt;
                &lt;/div&gt;
            &lt;/a&gt;
            &lt;div class="header-actions"&gt;
                &lt;button class="btn-icon" onclick="showHistory()" title="История расчётов"&gt;?&lt;/button&gt;
                &lt;button class="btn-icon" onclick="window.print()" title="Печать/PDF"&gt;?️&lt;/button&gt;
                &lt;button class="btn-icon" onclick="resetCalculator()" title="Сброс"&gt;↺&lt;/button&gt;
            &lt;/div&gt;
        &lt;/div&gt;

        &lt;div class="stack"&gt;
            
            &lt;div&gt;
                &lt;h2 class="section-title"&gt;Быстрый старт&lt;/h2&gt;
                &lt;div class="preset-buttons"&gt;
                    &lt;button class="preset-btn" data-preset="gear"&gt;Шестерня цилиндрическая&lt;/button&gt;
                    &lt;button class="preset-btn" data-preset="shaft"&gt;Вал-шестерня&lt;/button&gt;
                    &lt;button class="preset-btn" data-preset="housing"&gt;Корпус редуктора&lt;/button&gt;
                    &lt;button class="preset-btn" data-preset="flange"&gt;Фланец Ду100&lt;/button&gt;
                    &lt;button class="preset-btn" data-preset="bracket"&gt;Кронштейн&lt;/button&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block price-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="price-label"&gt;? Итоговая цена за единицу&lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="price-value" id="rPrice"&gt;0&lt;/div&gt;
                &lt;div class="price-currency"&gt;рублей с НДС 20%&lt;/div&gt;
                &lt;div class="margin-badge" id="marginBadge"&gt;Оптимально&lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;? Параметры изделия&lt;/div&gt;
                    &lt;span class="panel-badge"&gt;Обязательно&lt;/span&gt;
                &lt;/div&gt;
                &lt;div class="fields cols-4"&gt;
                    &lt;div class="field field-span-2"&gt;
                        &lt;label&gt;Наименование&lt;/label&gt;
                        &lt;input type="text" id="pName" value="Шестерня цилиндрическая m=4 z=24" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;№ чертежа / ТУ&lt;/label&gt;
                        &lt;input type="text" id="pDraw" value="ПРГ.753111.042" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Объём партии (шт)&lt;/label&gt;
                        &lt;input type="number" id="qtyNum" min="1" value="60" step="10" /&gt;
                        &lt;div class="field-hint"&gt;Скидки: 50+ = -2%, 200+ = -4%, 500+ = -7%&lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;? Материал&lt;/div&gt;
                    &lt;span class="panel-badge"&gt;ВИМ: &lt;span id="vimPct"&gt;0&lt;/span&gt;%&lt;/span&gt;
                &lt;/div&gt;
                &lt;div class="fields cols-5"&gt;
                    &lt;div class="field field-span-2"&gt;
                        &lt;label&gt;Марка материала&lt;/label&gt;
                        &lt;select id="matSel"&gt;&lt;/select&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Цена (₽/кг)&lt;/label&gt;
                        &lt;input type="number" id="matPrice" min="0" step="1" value="105" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Масса заготовки (кг)&lt;/label&gt;
                        &lt;input type="number" id="matGross" min="0" step="0.1" value="8.4" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Масса чистая (кг)&lt;/label&gt;
                        &lt;input type="number" id="matNet" min="0" step="0.1" value="5.6" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;ТЗР (%)&lt;/label&gt;
                        &lt;input type="number" id="tzr" min="0" step="0.5" value="4" /&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="vim-bar"&gt;
                    &lt;div class="vim-fill" id="vimBar" style="width: 0%"&gt;&lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="vim-label"&gt;
                    &lt;span&gt;Отходы: &lt;strong id="scrapKg"&gt;0&lt;/strong&gt; кг&lt;/span&gt;
                    &lt;span id="vimGrade"&gt;&lt;/span&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;? Покупные комплектующие&lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="dynamic-rows" id="compRows"&gt;&lt;/div&gt;
                &lt;button class="btn-add" onclick="addComponent()"&gt;+ Добавить комплектующее&lt;/button&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;⚙️ Трудозатраты по операциям&lt;/div&gt;
                    &lt;span class="panel-badge"&gt;Σ: &lt;span id="sumHours"&gt;0&lt;/span&gt; н-ч&lt;/span&gt;
                &lt;/div&gt;
                &lt;div class="dynamic-rows" id="opRows"&gt;&lt;/div&gt;
                &lt;button class="btn-add" onclick="addOperation()"&gt;+ Добавить операцию&lt;/button&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;⚡ Производственные расходы&lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="fields cols-5"&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Электроэнергия (кВт·ч/шт)&lt;/label&gt;
                        &lt;input type="number" id="kwh" min="0" step="0.1" value="3.6" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Тариф (₽/кВт·ч)&lt;/label&gt;
                        &lt;input type="number" id="kwhRate" min="0" step="0.1" value="8.9" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Амортизация (₽/шт)&lt;/label&gt;
                        &lt;input type="number" id="depr" min="0" step="1" value="85" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Инструмент (₽/шт)&lt;/label&gt;
                        &lt;input type="number" id="tool" min="0" step="1" value="40" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Логистика (₽/шт)&lt;/label&gt;
                        &lt;input type="number" id="logist" min="0" step="1" value="26" /&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;? Ценообразование&lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="fields cols-4"&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Страховые взносы (%)&lt;/label&gt;
                        &lt;input type="number" id="socRate" min="0" max="60" step="0.1" value="30.2" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Накладные (% к ЗП)&lt;/label&gt;
                        &lt;input type="number" id="overhead" min="0" step="5" value="110" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Рентабельность (%)&lt;/label&gt;
                        &lt;input type="number" id="margin" min="0" max="60" step="1" value="18" /&gt;
                    &lt;/div&gt;
                    &lt;div class="field"&gt;
                        &lt;label&gt;Срочность (%)&lt;/label&gt;
                        &lt;input type="number" id="urgent" min="0" max="50" step="1" value="0" /&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="toggle-row"&gt;
                    &lt;label class="toggle-switch"&gt;
                        &lt;input type="checkbox" id="realityFactor" checked="checked" /&gt;
                        &lt;span class="toggle-slider"&gt;&lt;/span&gt;
                    &lt;/label&gt;
                    &lt;span class="toggle-label"&gt;Коэффициент реальности цен&lt;/span&gt;
                    &lt;input type="number" id="realityValue" min="1" max="10" step="0.1" value="3.5" class="toggle-input" /&gt;
                    &lt;span class="toggle-hint"&gt;× к цене без НДС&lt;/span&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;? Структура себестоимости&lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="breakdown-list" id="breakdownContainer"&gt;&lt;/div&gt;
                &lt;div class="total-row"&gt;
                    &lt;span&gt;Полная себестоимость&lt;/span&gt;
                    &lt;span id="rFull"&gt;0 ₽&lt;/span&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="gold-block"&gt;
                &lt;div class="panel-header"&gt;
                    &lt;div class="panel-title"&gt;? Рентабельность и показатели партии&lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="summary-grid"&gt;
                    &lt;div class="gauge-container"&gt;
                        &lt;svg class="gauge-svg" viewbox="0 0 180 100"&gt;
                            &lt;path d="M20 90 A70 70 0 0 1 160 90" fill="none" stroke="#2a2a3a" stroke-width="12"&gt;&lt;/path&gt;
                            &lt;path id="gaugeArc" d="M20 90 A70 70 0 0 1 160 90" fill="none" stroke="url(#gaugeGradient)" stroke-width="12" stroke-dasharray="219.9" stroke-dashoffset="219.9" style="transition:stroke-dashoffset 0.6s"&gt;&lt;/path&gt;
                            &lt;defs&gt;
                                &lt;lineargradient id="gaugeGradient"&gt;
                                    &lt;stop offset="0%" style="stop-color:#00ff9d"&gt;&lt;/stop&gt;
                                    &lt;stop offset="100%" style="stop-color:#00e5ff"&gt;&lt;/stop&gt;
                                &lt;/lineargradient&gt;
                            &lt;/defs&gt;
                        &lt;/svg&gt;
                        &lt;div class="gauge-value" id="gaugeVal"&gt;0%&lt;/div&gt;
                        &lt;div class="gauge-label"&gt;Рентабельность изделия&lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="batch-stats"&gt;
                        &lt;div class="stat-box"&gt;
                            &lt;div class="stat-label"&gt;Себестоимость партии&lt;/div&gt;
                            &lt;div class="stat-value" id="bCost"&gt;0 ₽&lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class="stat-box"&gt;
                            &lt;div class="stat-label"&gt;Выручка партии&lt;/div&gt;
                            &lt;div class="stat-value" id="bRev"&gt;0 ₽&lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class="stat-box"&gt;
                            &lt;div class="stat-label"&gt;Прибыль партии&lt;/div&gt;
                            &lt;div class="stat-value profit" id="bProfit"&gt;0 ₽&lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            
            &lt;div class="actions"&gt;
                &lt;button class="btn-action btn-primary" onclick="saveCalculation()"&gt;? Сохранить расчёт&lt;/button&gt;
                &lt;button class="btn-action btn-secondary" onclick="window.print()"&gt;?️ Печать / PDF&lt;/button&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class="ds-banner"&gt;
        &lt;div class="ds-banner-tag"&gt;РЕКЛАМНЫЕ ПЛОЩАДИ&lt;/div&gt;
        &lt;div class="ds-banner-title"&gt;ЗДЕСЬ МОЖЕТ БЫТЬ&lt;br /&gt;ВАША РЕКЛАМА&lt;/div&gt;
        &lt;div class="ds-banner-phone"&gt;8 902 873-36-90 · МАКС&lt;/div&gt;
        &lt;div class="ds-banner-note"&gt;Позвоните, а лучше пишите в МАКС&lt;/div&gt;
    &lt;/div&gt;

    &lt;div class="ds-cta"&gt;
        &lt;p class="ds-cta-text"&gt;Уточнить наличие и оформить заказ&lt;/p&gt;
        &lt;a href="tel:+79028733690" class="ds-cta-btn"&gt;8 (902) 873-36-90&lt;/a&gt;
        &lt;a href="mailto:arsenal-detal@list.ru?subject=Запрос%20прайса" class="ds-cta-mail"&gt;✉ arsenal-detal@list.ru&lt;/a&gt;
        &lt;p class="ds-manager"&gt;Менеджер: Ольга · ООО «Арсенал Деталь»&lt;/p&gt;
    &lt;/div&gt;

    &lt;div class="history-modal" id="historyModal"&gt;
        &lt;div class="history-content"&gt;
            &lt;div class="history-header"&gt;
                &lt;h2 style="color: var(--neon-gold);"&gt;История расчётов&lt;/h2&gt;
                &lt;button class="btn-icon" onclick="closeHistory()"&gt;✕&lt;/button&gt;
            &lt;/div&gt;
            &lt;div id="historyList"&gt;&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;script&gt;
        const MATERIALS = {
            "Сталь Ст45 (круг)": 92,
            "Сталь 40Х": 105,
            "Сталь 09Г2С": 88,
            "Сталь 12Х18Н10Т (нерж.)": 385,
            "Чугун СЧ20": 74,
            "Латунь ЛС59-1": 520,
            "Алюминий Д16Т": 340,
            "Титан ВТ6": 2400
        };

        const OPS = {
            "Токарная": 950,
            "Токарная с ЧПУ": 1150,
            "Фрезерная": 1050,
            "Расточная": 1100,
            "Сверлильная": 800,
            "Шлифовальная": 1100,
            "Зубонарезная": 1250,
            "Сварочная": 1150,
            "Слесарно-сборочная": 850,
            "Термическая": 950
        };

        const PRESETS = {
            gear: {
                name: "Шестерня цилиндрическая m=4 z=24",
                draw: "ПРГ.753111.042", qty: 60, mat: "Сталь 40Х", price: 105, gross: 8.4, net: 5.6,
                comps: [["Шпонка 10×8×45", 1, 35]],
                ops: [["Токарная с ЧПУ", 0.60], ["Зубонарезная", 0.85], ["Шлифовальная", 0.30]]
            },
            shaft: {
                name: "Вал-шестерня привода",
                draw: "ПРГ.753112.043", qty: 40, mat: "Сталь 40Х", price: 105, gross: 12.5, net: 8.2,
                comps: [["Шпонка 12×8×50", 2, 45]],
                ops: [["Токарная с ЧПУ", 1.2], ["Зубонарезная", 1.5], ["Шлифовальная", 0.6]]
            },
            housing: {
                name: "Корпус редуктора Ц2-100",
                draw: "ПРГ.321456.008", qty: 25, mat: "Чугун СЧ20", price: 74, gross: 46, net: 31.5,
                comps: [["Подшипник 206", 2, 210]],
                ops: [["Фрезерная", 2.4], ["Расточная", 1.8], ["Сверлильная", 1.1]]
            },
            flange: {
                name: "Фланец стальной Ду100",
                draw: "ПРГ.301124.017", qty: 250, mat: "Сталь Ст45 (круг)", price: 92, gross: 3.1, net: 2.2,
                comps: [["Шпилька М16", 8, 24]],
                ops: [["Токарная с ЧПУ", 0.35], ["Сверлильная", 0.20]]
            },
            bracket: {
                name: "Кронштейн сварной",
                draw: "ПРГ.782213.114", qty: 400, mat: "Сталь 09Г2С", price: 88, gross: 6.8, net: 5.9,
                comps: [],
                ops: [["Сварочная", 1.2], ["Слесарно-сборочная", 0.4]]
            }
        };

        const DEFAULT = {
            name: "Шестерня цилиндрическая m=4 z=24",
            draw: "ПРГ.753111.042", qty: 60, mat: "Сталь 40Х", price: 105, gross: 8.4, net: 5.6,
            comps: [["Шпонка 10×8×45", 1, 35]],
            ops: [["Токарная с ЧПУ", 0.60], ["Зубонарезная", 0.85], ["Шлифовальная", 0.30]]
        };

        const $ = id =&gt; document.getElementById(id);
        const nf = new Intl.NumberFormat('ru-RU', {minimumFractionDigits: 0, maximumFractionDigits: 0});
        const nf2 = new Intl.NumberFormat('ru-RU', {minimumFractionDigits: 2, maximumFractionDigits: 2});

        Object.keys(MATERIALS).forEach(k =&gt; {
            const opt = document.createElement('option');
            opt.value = k;
            opt.textContent = k;
            $('matSel').appendChild(opt);
        });
        $('matSel').value = DEFAULT.mat;

        function tierDiscount(q) { return q &gt;= 500 ? 7 : q &gt;= 200 ? 4 : q &gt;= 50 ? 2 : 0; }

        function createOperationRow(name, hours) {
            const div = document.createElement('div');
            div.className = 'dynamic-row';
            div.innerHTML = `
                &lt;select class="opSel"&gt;
                    ${Object.keys(OPS).map(k =&gt; `&lt;option value="${k}" ${k === name ? 'selected' : ''}&gt;${k}&lt;/option&gt;`).join('')}
                &lt;/select&gt;
                &lt;input type="number" class="opH" placeholder="Н-ч" min="0" step="0.01" value="${hours}"&gt;
                &lt;input type="number" class="opR" placeholder="Ставка" min="0" step="10" value="${OPS[name] || 950}"&gt;
                &lt;button class="btn-remove" onclick="this.parentElement.remove(); recalc();"&gt;✕&lt;/button&gt;
            `;
            div.querySelector('.opSel').addEventListener('change', e =&gt; {
                div.querySelector('.opR').value = OPS[e.target.value];
                recalc();
            });
            return div;
        }

        function createComponentRow(name, qty, price) {
            const div = document.createElement('div');
            div.className = 'dynamic-row';
            div.innerHTML = `
                &lt;input type="text" class="cpN" placeholder="Наименование" value="${name}"&gt;
                &lt;input type="number" class="cpQ" placeholder="Кол-во" min="0" step="1" value="${qty}"&gt;
                &lt;input type="number" class="cpP" placeholder="Цена ₽" min="0" step="1" value="${price}"&gt;
                &lt;button class="btn-remove" onclick="this.parentElement.remove(); recalc();"&gt;✕&lt;/button&gt;
            `;
            return div;
        }

        function addOperation() { $('opRows').appendChild(createOperationRow('Токарная', 0.20)); recalc(); }
        function addComponent() { $('compRows').appendChild(createComponentRow('Позиция', 1, 100)); recalc(); }

        function recalc() {
            const qty = Math.max(1, Math.round(parseFloat($('qtyNum').value) || 1));
            const gross = parseFloat($('matGross').value) || 0;
            const net = parseFloat($('matNet').value) || 0;
            const mprice = parseFloat($('matPrice').value) || 0;
            const tzr = parseFloat($('tzr').value) || 0;
            const kwh = parseFloat($('kwh').value) || 0;
            const kwhRate = parseFloat($('kwhRate').value) || 0;
            const depr = parseFloat($('depr').value) || 0;
            const tool = parseFloat($('tool').value) || 0;
            const logist = parseFloat($('logist').value) || 0;
            const socRate = parseFloat($('socRate').value) || 0;
            const overhead = parseFloat($('overhead').value) || 0;
            const margin = parseFloat($('margin').value) || 0;
            const urgent = parseFloat($('urgent').value) || 0;
            const useReality = $('realityFactor').checked;
            const realityVal = parseFloat($('realityValue').value) || 1;

            const matCost = gross * mprice * (1 + tzr / 100);
            const vim = gross &gt; 0 ? (net / gross) * 100 : 0;

            let compCost = 0;
            document.querySelectorAll('#compRows .dynamic-row').forEach(row =&gt; {
                const q = parseFloat(row.querySelector('.cpQ').value) || 0;
                const p = parseFloat(row.querySelector('.cpP').value) || 0;
                compCost += q * p;
            });

            let wage = 0, hours = 0;
            document.querySelectorAll('#opRows .dynamic-row').forEach(row =&gt; {
                const h = parseFloat(row.querySelector('.opH').value) || 0;
                const r = parseFloat(row.querySelector('.opR').value) || 0;
                wage += h * r;
                hours += h;
            });

            const soc = wage * socRate / 100;
            const energy = kwh * kwhRate;
            const deprTotal = depr + tool;
            const overheadCost = wage * overhead / 100;
            const fullCost = matCost + compCost + wage + soc + energy + deprTotal + logist + overheadCost;
            const profit = fullCost * margin / 100;
            const urgSum = (fullCost + profit) * urgent / 100;
            const disc = tierDiscount(qty);
            const discSum = (fullCost + profit + urgSum) * disc / 100;

            let priceExcl = fullCost + profit + urgSum - discSum;
            if (useReality) priceExcl = priceExcl * realityVal;

            const vat = priceExcl * 0.2;
            const price = priceExcl + vat;
            const rent = fullCost &gt; 0 ? (profit / fullCost) * 100 : 0;
            const margPct = priceExcl &gt; 0 ? ((priceExcl - fullCost) / priceExcl) * 100 : 0;

            $('rPrice').textContent = nf.format(price);
            $('rFull').textContent = nf.format(fullCost) + ' ₽';
            $('gaugeVal').textContent = nf2.format(rent).replace('.', ',') + '%';

            const badge = $('marginBadge');
            if (margPct &gt; 40) { badge.textContent = '? Высокая маржа'; badge.className = 'margin-badge high'; }
            else if (margPct &gt; 20) { badge.textContent = '✅ Оптимально'; badge.className = 'margin-badge good'; }
            else if (margPct &gt; 5) { badge.textContent = '⚠️ Низкая маржа'; badge.className = 'margin-badge low'; }
            else { badge.textContent = '? Убыточно'; badge.className = 'margin-badge danger'; }

            $('vimPct').textContent = nf.format(vim);
            $('vimBar').style.width = Math.min(100, vim) + '%';
            $('scrapKg').textContent = nf2.format(Math.max(0, gross - net)).replace('.', ',');
            $('sumHours').textContent = nf2.format(hours).replace('.', ',');

            const rc = Math.min(rent, 50) / 50;
            $('gaugeArc').style.strokeDashoffset = 219.9 * (1 - rc);

            const breakdownItems = [
                { name: '? Материалы', cost: matCost },
                { name: '? Комплектующие', cost: compCost },
                { name: '⚙️ Зарплата', cost: wage },
                { name: '? Страховые взносы', cost: soc },
                { name: '⚡ Электроэнергия', cost: energy },
                { name: '? Амортизация и инструмент', cost: deprTotal },
                { name: '? Логистика', cost: logist },
                { name: '? Накладные расходы', cost: overheadCost }
            ];

            let html = '';
            breakdownItems.forEach(item =&gt; {
                html += `&lt;div class="breakdown-item"&gt;&lt;span class="name"&gt;${item.name}&lt;/span&gt;&lt;span class="cost"&gt;${nf.format(item.cost)} ₽&lt;/span&gt;&lt;/div&gt;`;
            });
            $('breakdownContainer').innerHTML = html;

            $('bCost').textContent = nf.format(fullCost * qty) + ' ₽';
            $('bRev').textContent = nf.format(price * qty) + ' ₽';
            $('bProfit').textContent = nf.format((priceExcl - fullCost) * qty) + ' ₽';

            saveToLocalStorage();
        }

        function saveToLocalStorage() {
            const data = {
                pName: $('pName').value, pDraw: $('pDraw').value, qtyNum: $('qtyNum').value,
                matSel: $('matSel').value, matPrice: $('matPrice').value,
                matGross: $('matGross').value, matNet: $('matNet').value, tzr: $('tzr').value,
                kwh: $('kwh').value, kwhRate: $('kwhRate').value, depr: $('depr').value,
                tool: $('tool').value, logist: $('logist').value, socRate: $('socRate').value,
                overhead: $('overhead').value, margin: $('margin').value, urgent: $('urgent').value,
                useReality: $('realityFactor').checked, realityVal: $('realityValue').value,
                price: $('rPrice').textContent, timestamp: new Date().toISOString()
            };
            localStorage.setItem('currentCalc', JSON.stringify(data));
        }

        function loadFromLocalStorage() {
            const data = JSON.parse(localStorage.getItem('currentCalc'));
            if (data) {
                $('pName').value = data.pName || DEFAULT.name;
                $('pDraw').value = data.pDraw || DEFAULT.draw;
                $('qtyNum').value = data.qtyNum || DEFAULT.qty;
                $('matSel').value = data.matSel || DEFAULT.mat;
                $('matPrice').value = data.matPrice || DEFAULT.price;
                $('matGross').value = data.matGross || DEFAULT.gross;
                $('matNet').value = data.matNet || DEFAULT.net;
                $('tzr').value = data.tzr || 4;
                $('kwh').value = data.kwh || 3.6;
                $('kwhRate').value = data.kwhRate || 8.9;
                $('depr').value = data.depr || 85;
                $('tool').value = data.tool || 40;
                $('logist').value = data.logist || 26;
                $('socRate').value = data.socRate || 30.2;
                $('overhead').value = data.overhead || 110;
                $('margin').value = data.margin || 18;
                $('urgent').value = data.urgent || 0;
                $('realityFactor').checked = data.useReality !== false;
                $('realityValue').value = data.realityVal || 3.5;
            }
        }

        function applyPreset(presetKey) {
            const p = PRESETS[presetKey];
            $('pName').value = p.name;
            $('pDraw').value = p.draw;
            $('qtyNum').value = p.qty;
            $('matSel').value = p.mat;
            $('matPrice').value = p.price;
            $('matGross').value = p.gross;
            $('matNet').value = p.net;

            $('opRows').innerHTML = '';
            p.ops.forEach(op =&gt; $('opRows').appendChild(createOperationRow(op[0], op[1])));

            $('compRows').innerHTML = '';
            p.comps.forEach(c =&gt; $('compRows').appendChild(createComponentRow(c[0], c[1], c[2])));

            document.querySelectorAll('.preset-btn').forEach(btn =&gt; btn.classList.remove('active'));
            document.querySelector(`[data-preset="${presetKey}"]`).classList.add('active');

            recalc();
        }

        function resetCalculator() {
            if (confirm('Сбросить все данные?')) {
                applyPreset('gear');
                document.querySelectorAll('.preset-btn').forEach(btn =&gt; btn.classList.remove('active'));
            }
        }

        function saveCalculation() {
            let history = JSON.parse(localStorage.getItem('calcHistory') || '[]');
            const entry = {
                id: Date.now(),
                name: $('pName').value,
                price: $('rPrice').textContent,
                timestamp: new Date().toISOString(),
                data: JSON.parse(localStorage.getItem('currentCalc'))
            };
            history.unshift(entry);
            if (history.length &gt; 20) history = history.slice(0, 20);
            localStorage.setItem('calcHistory', JSON.stringify(history));
            alert('Расчёт сохранён в историю!');
        }

        function showHistory() {
            const history = JSON.parse(localStorage.getItem('calcHistory') || '[]');
            const list = $('historyList');
            if (history.length === 0) {
                list.innerHTML = '&lt;p style="text-align:center; color:var(--text-dim); padding:40px;"&gt;История пуста&lt;/p&gt;';
            } else {
                list.innerHTML = history.map(entry =&gt; `
                    &lt;div class="history-item" onclick="loadFromHistory(${entry.id})"&gt;
                        &lt;div class="history-date"&gt;${new Date(entry.timestamp).toLocaleString('ru-RU')}&lt;/div&gt;
                        &lt;div class="history-info"&gt;
                            &lt;span class="history-name"&gt;${entry.name}&lt;/span&gt;
                            &lt;span class="history-price"&gt;${entry.price} ₽&lt;/span&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                `).join('');
            }
            $('historyModal').classList.add('active');
        }

        function loadFromHistory(id) {
            const history = JSON.parse(localStorage.getItem('calcHistory') || '[]');
            const entry = history.find(h =&gt; h.id === id);
            if (entry) {
                localStorage.setItem('currentCalc', JSON.stringify(entry.data));
                loadFromLocalStorage();
                recalc();
                closeHistory();
            }
        }

        function closeHistory() { $('historyModal').classList.remove('active'); }

        document.addEventListener('DOMContentLoaded', function() {
            loadFromLocalStorage();
            DEFAULT.ops.forEach(op =&gt; $('opRows').appendChild(createOperationRow(op[0], op[1])));
            DEFAULT.comps.forEach(c =&gt; $('compRows').appendChild(createComponentRow(c[0], c[1], c[2])));

            document.querySelectorAll('.preset-btn').forEach(btn =&gt; {
                btn.addEventListener('click', () =&gt; applyPreset(btn.dataset.preset));
            });

            $('matSel').addEventListener('change', e =&gt; {
                $('matPrice').value = MATERIALS[e.target.value];
                recalc();
            });

            document.querySelectorAll('input, select').forEach(el =&gt; {
                el.addEventListener('input', recalc);
                el.addEventListener('change', recalc);
            });

            $('historyModal').addEventListener('click', e =&gt; {
                if (e.target === $('historyModal')) closeHistory();
            });

            recalc();
        });
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</subtitle>
  <updated>2026-10-10T12:59:07Z</updated>
  <logo>https://pandoraburo.ru/ssl/u/pic/07/26436cc3c611f19d9efcd8c4a10874/-/0c723f71762611f1b3964aaba1665535.jpg</logo>
  <author>
    <name>1592962</name>
    <uri>https://www.pandoraburo.ru/</uri>
  </author>
</feed>
