.mc {
  max-width: 900px;
  margin: 20px auto;
  padding: 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: #1a1a2e;
  box-sizing: border-box;
  line-height: 1.45;
}
.mc * { box-sizing: border-box; }
.mc h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  text-align: center;
  color: #16213e;
}
.mc .sub {
  text-align: center;
  font-size: .82rem;
  color: #888;
  margin-bottom: 18px;
}
.mc .section {
  margin-bottom: 20px;
  padding: 16px;
  background: #fafbff;
  border-radius: 10px;
  border: 1px solid #e6eaf2;
}
.mc .section-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #4361ee;
  margin-bottom: 12px;
}
.mc .field { margin-bottom: 14px; }
.mc .field:last-child { margin-bottom: 0; }
.mc label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: #16213e;
  margin-bottom: 5px;
}
.mc label .auto-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  background: #e8f5e9;
  color: #1e9e4a;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.mc label .req {
  color: #d9342b;
  margin-left: 3px;
}
.mc select,
.mc input[type=number],
.mc input[type=text],
.mc input[type=email],
.mc textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .95rem;
  background: #fff;
  transition: .2s;
  font-family: inherit;
  outline: none;
  color: #1a1a2e;
}
.mc textarea {
  resize: vertical;
  min-height: 60px;
}
.mc select:focus,
.mc input:focus,
.mc textarea:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}
.mc input[readonly] {
  background: #f4f6fb;
  color: #555;
  cursor: default;
}
.mc .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mc .row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.mc .input-with-unit { position: relative; }
.mc .input-with-unit input { padding-right: 90px; }
.mc .input-with-unit .unit-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  background: #f4f6fb;
  border-radius: 6px;
  padding: 2px;
}
.mc .input-with-unit .unit-toggle button {
  border: none;
  background: transparent;
  padding: 3px 8px;
  font-size: .72rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  transition: .15s;
}
.mc .input-with-unit .unit-toggle button.active {
  background: #fff;
  color: #4361ee;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ============ Drop-zone ============ */
.mc .drop-zone {
  border: 2px dashed #cfd6e6;
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: .2s;
  background: #fff;
}
.mc .drop-zone:hover,
.mc .drop-zone.dragover {
  border-color: #4361ee;
  background: #f4f7ff;
}
.mc .drop-zone .dz-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 8px;
}
.mc .drop-zone .dz-text {
  font-size: .88rem;
  font-weight: 600;
  color: #16213e;
}
.mc .drop-zone .dz-hint {
  font-size: .74rem;
  color: #888;
  margin-top: 4px;
}

.mc .upload-progress {
  height: 6px;
  background: #e6eaf2;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}
.mc .upload-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4361ee, #6c8bff);
  transition: width .2s;
}

/* ============ Превью файла ============ */
.mc .file-preview {
  margin-top: 12px;
  padding: 10px;
  background: #f4f7ff;
  border-radius: 8px;
  border: 1px solid #d0d9ff;
  display: none;
}
.mc .file-preview.show { display: block; }
.mc .file-preview .fp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.mc .file-preview .fp-name {
  font-size: .85rem;
  font-weight: 600;
  color: #1a1a2e;
  word-break: break-all;
  flex: 1;
}
.mc .file-preview .fp-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mc .file-preview .fp-remove,
.mc .file-preview .fp-expand,
.mc .file-preview .fp-download {
  background: #fff;
  border: 1px solid #cfd6e6;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .file-preview .fp-remove { color: #d9342b; }
.mc .file-preview .fp-expand { color: #4361ee; }
.mc .file-preview .fp-download { color: #1e9e4a; }
.mc .file-preview .fp-remove:hover { background: #ffebeb; border-color: #d9342b; }
.mc .file-preview .fp-expand:hover { background: #4361ee; color: #fff; border-color: #4361ee; }
.mc .file-preview .fp-download:hover { background: #1e9e4a; color: #fff; border-color: #1e9e4a; }

.mc .file-preview .fp-image { text-align: center; }
.mc .file-preview .fp-image img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  border: 1px solid #e6eaf2;
  background: #fff;
}

/* ============ PDF-превью ============ */
.mc .file-preview .fp-pdf {
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e6eaf2;
  overflow: hidden;
}
.mc .file-preview .fp-pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f4f7ff;
  border-bottom: 1px solid #e6eaf2;
  font-size: .8rem;
  flex-wrap: wrap;
}
.mc .file-preview .fp-pdf-label { font-weight: 600; color: #16213e; }
.mc .file-preview .fp-pdf-link {
  color: #4361ee;
  font-weight: 600;
  text-decoration: none;
  font-size: .8rem;
}
.mc .file-preview .fp-pdf-link:hover { text-decoration: underline; }

.mc .file-preview .fp-pdf-frame-wrap {
  position: relative;
  width: 100%;
  height: 500px;
  background: #f8f9fc;
  overflow: hidden;
}
.mc .file-preview .fp-pdf-frame-wrap object,
.mc .file-preview .fp-pdf-frame-wrap embed,
.mc .file-preview .fp-pdf-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.mc .file-preview .fp-pdf-fallback {
  padding: 40px 20px;
  text-align: center;
  background: #fafbff;
  color: #555;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.mc .file-preview .fp-pdf-fallback .fp-pdf-icon { font-size: 2.5rem; line-height: 1; }
.mc .file-preview .fp-pdf-fallback .fp-pdf-msg { font-size: .95rem; font-weight: 600; color: #333; }
.mc .file-preview .fp-pdf-fallback .fp-pdf-sub { font-size: .82rem; color: #777; }
.mc .file-preview .fp-pdf-fallback .fp-pdf-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.mc .file-preview .fp-pdf-fallback .fp-pdf-actions a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  text-decoration: none;
  transition: .15s;
}
.mc .file-preview .fp-pdf-fallback .fp-pdf-actions a:last-child {
  background: #fff;
  color: #4361ee;
}
.mc .file-preview .fp-pdf-fallback .fp-pdf-actions a:hover {
  background: #3450c9;
  border-color: #3450c9;
  color: #fff;
}
.mc .file-preview .fp-pdf-fallback .fp-pdf-actions a:last-child:hover {
  background: #4361ee;
  color: #fff;
}

/* PDF.js */
.fp-pdf-js-wrap { background: #fff; border-top: 1px solid #e6eaf2; }
.fp-pdf-js-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 12px;
  background: #f4f7ff;
  border-bottom: 1px solid #e6eaf2;
  font-size: .82rem;
}
.fp-pdf-js-toolbar button {
  background: #fff;
  border: 1px solid #cfd6e6;
  color: #333;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.fp-pdf-js-toolbar button:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.fp-pdf-js-toolbar #pdfjsPageInfo {
  margin: 0 auto;
  font-weight: 600;
  color: #16213e;
}
.fp-pdf-js-canvas-wrap {
  overflow: auto;
  max-height: 500px;
  text-align: center;
  background: #f0f2f7;
  padding: 12px;
}
.fp-pdf-js-canvas-wrap canvas {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  border-radius: 4px;
  max-width: 100%;
  height: auto;
}

/* ============ Модальное окно PDF ============ */
.mc-pdf-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 50, .92);
  z-index: 99999;
  display: none;
  flex-direction: column;
}
.mc-pdf-modal.open { display: flex; }
.mc-pdf-modal .mc-pdf-modal-header {
  padding: 12px 20px;
  background: #1a1a2e;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mc-pdf-modal .mc-pdf-modal-title {
  font-weight: 600;
  font-size: .95rem;
  word-break: break-all;
}
.mc-pdf-modal .mc-pdf-modal-actions {
  display: flex;
  gap: 8px;
}
.mc-pdf-modal .mc-pdf-modal-actions a,
.mc-pdf-modal .mc-pdf-modal-actions button {
  padding: 7px 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mc-pdf-modal .mc-pdf-modal-actions a { background: #4361ee; color: #fff; }
.mc-pdf-modal .mc-pdf-modal-actions button { background: #fff; color: #333; }
.mc-pdf-modal .mc-pdf-modal-actions a:hover { background: #3450c9; }
.mc-pdf-modal .mc-pdf-modal-actions button:hover { background: #f4f7ff; color: #4361ee; }
.mc-pdf-modal .mc-pdf-modal-frame-wrap {
  flex: 1;
  position: relative;
  background: #222;
}
.mc-pdf-modal .mc-pdf-modal-frame-wrap iframe,
.mc-pdf-modal .mc-pdf-modal-frame-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ============ Прайс-бар ============ */
.mc .price-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px;
  background: #f8f9fc;
  border-radius: 8px;
  border: 1px dashed #cfd6e6;
  font-size: .78rem;
  color: #666;
  align-items: center;
}
.mc .price-status .status { flex: 1; min-width: 140px; font-weight: 600; }
.mc .price-status .ok { color: #1e9e4a; }
.mc .price-status .err { color: #d9342b; }
.mc .price-status button {
  padding: 7px 12px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid #cfd6e6;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .price-status button.primary {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .price-status button:hover:not(:disabled) { border-color: #4361ee; color: #4361ee; }
.mc .price-status button.primary:hover:not(:disabled) {
  background: #3450c9;
  border-color: #3450c9;
  color: #fff;
}
.mc .price-status button:disabled { opacity: .5; cursor: not-allowed; }

/* ============ Отчёт ============ */
.mc .report {
  margin-top: 22px;
  padding: 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e3e8f4;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(20,30,80,.06);
}
.mc .report-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2c3e7a 100%);
  color: #fff;
}
.mc .report-title { font-size: 1.15rem; font-weight: 700; letter-spacing: .2px; }
.mc .report-sub { font-size: .8rem; opacity: .75; margin-top: 2px; }
.mc .report-meta {
  padding: 12px 20px;
  background: #f4f7ff;
  border-bottom: 1px solid #e3e8f4;
  font-size: .85rem;
  color: #333;
}
.mc .report-meta .meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}
.mc .report-meta .meta-label { color: #666; }
.mc .report-meta .meta-value { font-weight: 600; color: #1a1a2e; text-align: right; }
.mc .report-meta .meta-value.empty { color: #aaa; font-weight: 400; font-style: italic; }
.mc .report-section {
  padding: 14px 20px 6px;
  border-bottom: 1px solid #eef1f8;
}
.mc .report-section-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #4361ee;
  margin-bottom: 8px;
}
.mc .report-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: .92rem;
}
.mc .report-label { color: #555; }
.mc .report-value {
  font-weight: 600;
  color: #1a1a2e;
  text-align: right;
  white-space: nowrap;
}
.mc .report-row.highlight {
  margin-top: 4px;
  padding: 8px 10px;
  background: #f4f7ff;
  border-radius: 8px;
}
.mc .report-row.highlight .report-label { color: #1a1a2e; font-weight: 600; }
.mc .report-row.highlight .report-value { color: #1a1a2e; }
.mc .report-section.total-section {
  background: #fafbff;
  padding-bottom: 18px;
}
.mc .report-row.discount .report-value { color: #1e9e4a; }
.mc .report-row.grand-total {
  margin-top: 8px;
  padding: 14px 12px;
  background: linear-gradient(135deg, #eaf0ff 0%, #dde7ff 100%);
  border: 1.5px solid #4361ee;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
}
.mc .report-row.grand-total .report-value {
  color: #1a3bbf;
  font-size: 1.35rem;
}
.mc .report-drawing {
  padding: 16px 20px;
  border-bottom: 1px solid #eef1f8;
  text-align: center;
  background: #fff;
}
.mc .report-drawing .rd-label {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #4361ee;
  margin-bottom: 10px;
  text-align: left;
}
.mc .report-drawing img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 8px;
  border: 1px solid #e6eaf2;
  background: #fff;
}
.mc .report-drawing .rd-pdf {
  padding: 20px;
  font-size: .9rem;
  color: #555;
  background: #f8f9fc;
  border-radius: 8px;
  border: 1px dashed #cfd6e6;
}
.mc .report-drawing .rd-pdf a { color: #4361ee; font-weight: 600; }
.mc .report-footnote {
  padding: 12px 20px 18px;
  font-size: .74rem;
  color: #888;
  line-height: 1.45;
  background: #fafbff;
}
.mc .report .warning { margin: 0 20px 12px; }
.mc .report .btn-row {
  padding: 0 20px 18px;
  background: #fafbff;
  margin-top: 0;
}
.mc .warning {
  padding: 10px 12px;
  background: #fff4e5;
  border: 1px solid #ffd8a8;
  border-radius: 8px;
  font-size: .82rem;
  color: #8a5300;
  line-height: 1.4;
}
.mc .warning strong { color: #b45309; }
.mc .btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.mc .btn-row button {
  flex: 1 1 auto;
  padding: 11px 16px;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cfd6e6;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .btn-row button.primary {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .btn-row button:hover:not(:disabled) { border-color: #4361ee; color: #4361ee; }
.mc .btn-row button.primary:hover:not(:disabled) {
  background: #3450c9;
  border-color: #3450c9;
  color: #fff;
}
.mc .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #f8f9fc;
  border-radius: 8px;
  border: 1px solid #e6eaf2;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 500;
  color: #333;
  user-select: none;
}
.mc .check-row input[type=checkbox] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #4361ee;
  cursor: pointer;
}
.mc .check-row .label-text { flex: 1; }
.mc .check-row .label-note {
  font-size: .75rem;
  color: #888;
  font-weight: 400;
}

/* ============================================================
   Формула расчёта в виде красивой таблицы
   ============================================================ */
.mc .report-formula {
  padding: 16px 20px 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #e6ecff 100%);
  border-bottom: 1px solid #dbe3f7;
}
.mc .report-formula .rf-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #4361ee;
  margin-bottom: 10px;
}
.mc .report-formula .rf-label::before {
  content: "🧮";
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
}
.mc .report-formula .rf-body {
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(20,30,80,.08);
  background: #fff;
}
.mc .report-formula .rf-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .85rem;
  min-width: 640px;
  background: #fff;
  table-layout: fixed;
}
.mc .report-formula .rf-table th,
.mc .report-formula .rf-table td {
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid #eef1f8;
}
.mc .report-formula .rf-table th {
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  font-weight: 700;
  color: #1a3bbf;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.2;
  border-bottom: 2px solid #4361ee;
}
.mc .report-formula .rf-table th .unit {
  display: block;
  font-weight: 500;
  color: #7a89b3;
  font-size: .66rem;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 3px;
}
.mc .report-formula .rf-table td {
  font-family: 'SF Mono', Consolas, Monaco, 'Courier New', monospace;
  font-size: .95rem;
  color: #1a1a2e;
  font-weight: 600;
  background: #fff;
}
.mc .report-formula .rf-table td.rf-op {
  background: #f8f9fc;
  color: #a0a8be;
  font-weight: 700;
  padding: 10px 2px;
  font-size: 1rem;
  width: 22px;
  border-bottom: 1px solid #eef1f8;
}
.mc .report-formula .rf-table td.rf-highlight {
  background: linear-gradient(135deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: inset 3px 0 0 #4361ee, inset -1px 0 0 #b8c9ff;
}
.mc .report-formula .rf-table th.rf-highlight-head {
  background: linear-gradient(180deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  box-shadow: inset 3px 0 0 #4361ee;
}
.mc .report-formula .rf-table tbody tr td:not(.rf-op):not(.rf-highlight):nth-child(4n+1) {
  background: #fafbff;
}
.mc .report-formula .rf-hint {
  margin-top: 10px;
  font-size: .72rem;
  color: #6a7792;
  line-height: 1.4;
  padding: 8px 12px;
  background: rgba(255,255,255,.6);
  border-left: 3px solid #a9baff;
  border-radius: 4px;
}

/* ============================================================
   Список окружностей (форма «несколько окружностей»)
   ============================================================ */
.mc-info {
  padding: 10px 12px;
  background: #eef2ff;
  border-left: 4px solid #4361ee;
  border-radius: 6px;
  font-size: .82rem;
  color: #1a3bbf;
  margin-bottom: 12px;
  line-height: 1.4;
}
.mc-circle-list {
  border-radius: 10px;
  overflow-x: auto;
  border: 1px solid #e3e8f4;
  background: #fff;
}
.mc-circle-empty {
  padding: 18px;
  text-align: center;
  color: #888;
  font-size: .88rem;
}
.mc-circle-row {
  display: grid;
  grid-template-columns: 32px 1.1fr 1.1fr 0.9fr 1.1fr 1.1fr 1.1fr 34px;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f8;
  min-width: 720px;
  font-size: .85rem;
}
.mc-circle-row:last-child { border-bottom: none; }
.mc-circle-row-head {
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  font-weight: 700;
  color: #1a3bbf;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 8px 10px;
}
.mc-circle-row-head .mccr-field,
.mc-circle-row-head .mccr-num { color: #1a3bbf; }
.mc-circle-row .mccr-num {
  text-align: center;
  font-weight: 700;
  color: #888;
  font-size: .8rem;
}
.mc-circle-row .mccr-field input {
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  font-size: .85rem;
  background: #fff;
  font-family: inherit;
  outline: none;
  color: #1a1a2e;
}
.mc-circle-row .mccr-field input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 2px rgba(67,97,238,.1);
}
.mc-circle-row .mccr-value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  font-size: .8rem;
  text-align: right;
  color: #1a3bbf;
  padding: 0 4px;
  white-space: nowrap;
}
.mc-circle-row .mccr-action { text-align: center; }
.mc-circle-row .mccr-del {
  background: #fff;
  border: 1px solid #e0e0e0;
  color: #d9342b;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}
.mc-circle-row .mccr-del:hover {
  background: #ffebeb;
  border-color: #d9342b;
}
.mc-btn-add-row {
  width: 100%;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px dashed #4361ee;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc-btn-add-row:hover {
  background: #4361ee;
  color: #fff;
  border-style: solid;
}
.mc-circle-totals {
  margin-top: 14px;
  padding: 12px 16px;
  background: #f8f9fc;
  border-radius: 10px;
  border: 1px solid #e6eaf2;
}
.mc-circle-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: .88rem;
  color: #555;
}
.mc-circle-total-row span:last-child {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 700;
  color: #1a3bbf;
  white-space: nowrap;
}
.mc-circle-total-row.highlight {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #e6eaf2;
  font-weight: 700;
}
.mc-circle-total-row.highlight span:first-child { color: #1a1a2e; }
.mc-circle-total-row.highlight span:last-child { font-size: 1.05rem; color: #1a3bbf; }

/* ============================================================
   Список окружностей в отчёте
   ============================================================ */
.mc .report-circles {
  padding: 14px 20px;
  background: #f8f9fc;
  border-bottom: 1px solid #e3e8f4;
}
.mc .report-circles .rc-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #4361ee;
  margin-bottom: 8px;
}
.mc .report-circles .rc-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(20,30,80,.06);
  font-size: .82rem;
}
.mc .report-circles .rc-table th,
.mc .report-circles .rc-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid #eef1f8;
  white-space: nowrap;
}
.mc .report-circles .rc-table th {
  background: #f4f7ff;
  color: #1a3bbf;
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .report-circles .rc-table th span {
  display: block;
  font-weight: 500;
  color: #7a89b3;
  font-size: .66rem;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}
.mc .report-circles .rc-table td:first-child,
.mc .report-circles .rc-table th:first-child { text-align: center; }
.mc .report-circles .rc-table td {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  color: #1a1a2e;
}
.mc .report-circles .rc-table tfoot td {
  background: #eaf0ff;
  font-weight: 800;
  color: #1a3bbf;
  border-top: 2px solid #4361ee;
  border-bottom: 2px solid #4361ee;
}
.mc .report-circles .rc-table tfoot td:first-child {
  text-align: left;
  font-family: inherit;
}

/* ============ Мобильная адаптация ============ */
@media (max-width: 640px) {
  .mc { padding: 16px; margin: 10px; }
  .mc .row, .mc .row-3 { grid-template-columns: 1fr; }
  .mc .report-row { font-size: .88rem; }
  .mc .report-row.grand-total .report-value { font-size: 1.15rem; }
  .mc .file-preview .fp-pdf-frame-wrap { height: 320px; }
  .mc .report-formula { padding: 12px; }
  .mc .report-formula .rf-body { overflow-x: auto; }
  .mc .report-formula .rf-table { font-size: .78rem; min-width: 560px; }
  .mc .report-formula .rf-table th,
  .mc .report-formula .rf-table td { padding: 8px 6px; }
  .mc .report-formula .rf-table th { font-size: .66rem; }
  .mc .report-formula .rf-table th .unit { font-size: .6rem; }
  .mc .report-formula .rf-table td.rf-highlight { font-size: .95rem; }
  .mc-circle-row { grid-template-columns: 26px 1fr 1fr 0.8fr 1fr 1fr 1fr 30px; min-width: 640px; padding: 6px 8px; gap: 4px; }
  .mc-circle-row .mccr-value { font-size: .74rem; }
  .mc .report-circles .rc-table { font-size: .74rem; }
  .mc .report-circles .rc-table th,
  .mc .report-circles .rc-table td { padding: 6px 5px; }
}

/* ============================================================
   Универсальный список элементов (круг / прямоугольник / овал)
   ============================================================ */
.mc-shape-list {
  border-radius: 10px;
  overflow-x: auto;
  border: 1px solid #e3e8f4;
  background: #fff;
}
.mc-shape-row {
  display: grid;
  grid-template-columns:
    32px
    1.1fr
    1.6fr
    0.9fr
    0.8fr
    0.8fr
    0.9fr
    0.9fr
    0.9fr
    34px;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f8;
  min-width: 940px;
  font-size: .82rem;
}
.mc-shape-row:last-child { border-bottom: none; }

.mc-shape-row-head {
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  font-weight: 700;
  color: #1a3bbf;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 8px 10px;
  white-space: normal;
  line-height: 1.15;
}
.mc-shape-row-head > div {
  text-align: center;
  word-break: break-word;
}

.mc-shape-row .mcs-num {
  text-align: center;
  font-weight: 700;
  color: #888;
  font-size: .8rem;
}
.mc-shape-row .mcs-type {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  color: #1a1a2e;
  font-weight: 600;
}
.mc-shape-row .mcs-type span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-shape-row .mcs-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.mc-shape-row.mc-shape-circle .mcs-fields {
  grid-template-columns: 1fr;
}

.mc-shape-row .mcs-field input,
.mc-shape-row .mcs-fields input {
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  font-size: .82rem;
  background: #fff;
  font-family: inherit;
  outline: none;
  color: #1a1a2e;
}
.mc-shape-row .mcs-field input:focus,
.mc-shape-row .mcs-fields input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 2px rgba(67,97,238,.1);
}

.mc-shape-row .mcs-val {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  font-size: .78rem;
  text-align: right;
  color: #1a3bbf;
  padding: 0 4px;
  white-space: nowrap;
}
.mc-shape-row .mcs-action { text-align: center; }
.mc-shape-row .mcs-del {
  background: #fff;
  border: 1px solid #e0e0e0;
  color: #d9342b;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  padding: 0;
  font-family: inherit;
  line-height: 1;
}
.mc-shape-row .mcs-del:hover {
  background: #ffebeb;
  border-color: #d9342b;
}

/* Кнопка «Добавить элемент» */
.mc-add-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: stretch;
}
.mc-add-select {
  flex: 0 0 auto;
  min-width: 200px;
  padding: 10px 12px;
  border: 1.5px solid #cfd6e6;
  border-radius: 8px;
  font-size: .85rem;
  font-family: inherit;
  background: #fff;
  color: #1a1a2e;
  outline: none;
}
.mc-add-select:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 2px rgba(67,97,238,.1);
}
.mc-btn-add-row {
  flex: 1 1 auto;
  padding: 10px 14px;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px dashed #4361ee;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc-btn-add-row:hover {
  background: #4361ee;
  color: #fff;
  border-style: solid;
}

@media (max-width: 640px) {
  .mc-shape-row {
    grid-template-columns: 26px 0.9fr 1.5fr 0.8fr 0.8fr 0.8fr 0.9fr 0.9fr 0.9fr 30px;
    min-width: 880px;
    padding: 6px 8px;
    gap: 4px;
    font-size: .76rem;
  }
  .mc-shape-row .mcs-val { font-size: .72rem; }
  .mc-shape-row .mcs-type { font-size: .72rem; }
  .mc-add-row { flex-direction: column; }
  .mc-add-select { min-width: 100%; }
}

/* ============================================================
   Строка копирования цепочки
   ============================================================ */
.mc .report-formula .rf-copy {
  margin-top: 12px;
}
.mc .report-formula .rf-copy-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.mc .report-formula .rf-copy-text {
  flex: 1;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .88rem;
  line-height: 1.4;
  color: #1a1a2e;
  background: #f8f9fc;
  padding: 10px 12px;
  border: 1px solid #e3e8f4;
  border-radius: 8px;
  word-break: break-word;
  display: flex;
  align-items: center;
}
.mc .report-formula .rf-copy-btn {
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  font-size: 1.1rem;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc .report-formula .rf-copy-btn:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.mc .report-formula .rf-copy-btn.copied {
  background: #1e9e4a;
  border-color: #1e9e4a;
}

/* Компактный вид для цепочки */
.mc .report-formula .rf-table-chain {
  font-size: .84rem;
  min-width: 760px;
}
.mc .report-formula .rf-table-chain th {
  font-size: .68rem;
  line-height: 1.15;
  padding: 8px 6px;
}
.mc .report-formula .rf-table-chain th .unit {
  font-size: .62rem;
  margin-top: 2px;
}
.mc .report-formula .rf-table-chain td {
  padding: 10px 6px;
  font-size: .9rem;
}
.mc .report-formula .rf-table-chain td.rf-op {
  width: 20px;
  padding: 10px 2px;
  font-size: .9rem;
}
.mc .report-formula .rf-table-chain td.rf-highlight {
  font-size: 1rem;
}

@media (max-width: 640px) {
  .mc .report-formula .rf-table-chain {
    font-size: .78rem;
    min-width: 680px;
  }
  .mc .report-formula .rf-table-chain th { font-size: .62rem; }
  .mc .report-formula .rf-table-chain th .unit { font-size: .56rem; }
  .mc .report-formula .rf-table-chain td { font-size: .82rem; padding: 8px 4px; }
  .mc .report-formula .rf-copy-text { font-size: .78rem; padding: 8px 10px; }
  .mc .report-formula .rf-copy-btn { width: 40px; min-width: 40px; font-size: 1rem; }
}

/* ============================================================
   Информация о типе проката
   ============================================================ */
.mc-prokat {
  margin: 10px 0 4px;
  padding: 10px 14px;
  background: #eef2ff;
  border-left: 4px solid #4361ee;
  border-radius: 8px;
}
.mc-prokat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-size: .9rem;
}
.mc-prokat-label {
  color: #555;
  font-weight: 500;
}
.mc-prokat-value {
  color: #1a3bbf;
  font-weight: 700;
}
.mc-prokat-note {
  margin-top: 4px;
  font-size: .74rem;
  color: #6a7792;
  line-height: 1.35;
}

/* ============================================================
   Краткая цепочка расчёта
   ============================================================ */
.mc .report-formula .rf-short {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f4f7ff;
  border-radius: 8px;
  border: 1px dashed #cfd6e6;
}
.mc .report-formula .rf-short-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #7a89b3;
  margin-bottom: 6px;
}
.mc .report-formula .rf-short-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.mc .report-formula .rf-short-text {
  flex: 1;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .88rem;
  line-height: 1.4;
  color: #1a1a2e;
  background: #fff;
  padding: 10px 12px;
  border: 1px solid #e3e8f4;
  border-radius: 8px;
  word-break: break-word;
  display: flex;
  align-items: center;
}
.mc .report-formula .rf-short-btn {
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  font-size: 1.1rem;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc .report-formula .rf-short-btn:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.mc .report-formula .rf-short-btn.copied {
  background: #1e9e4a;
  border-color: #1e9e4a;
}

@media (max-width: 640px) {
  .mc .report-formula .rf-short-text { font-size: .78rem; padding: 8px 10px; }
  .mc .report-formula .rf-short-btn { width: 40px; min-width: 40px; font-size: 1rem; }
}

/* ============================================================
   Подсказка под «Масса 1 детали»
   ============================================================ */
.mc .mc-mass-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 10px;
  background: #eef2ff;
  border-left: 3px solid #4361ee;
  border-radius: 6px;
  font-size: .74rem;
  line-height: 1.4;
  color: #1a3bbf;
}
.mc .mc-mass-hint .mc-mass-hint-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4361ee;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  margin-top: 1px;
}
.mc .mc-mass-hint .mc-mass-hint-text {
  flex: 1;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .72rem;
  word-break: break-word;
}

@media (max-width: 640px) {
  .mc .mc-mass-hint {
    font-size: .68rem;
    padding: 6px 8px;
  }
  .mc .mc-mass-hint .mc-mass-hint-text { font-size: .66rem; }
}

/* ============================================================
   Подсветка ключевых полей ввода
   ============================================================ */
.mc input.mc-input-highlight,
.mc .mc-shape-row .mcs-field input.mc-input-highlight,
.mc .mc-shape-row .mcs-fields input.mc-input-highlight {
  background: linear-gradient(135deg, #eef4ff 0%, #e6edff 100%);
  border: 1.5px solid #7a97ff;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
  transition: background .2s, border-color .2s, box-shadow .2s;
  font-weight: 600;
  color: #1a1a2e;
}

.mc input.mc-input-highlight:hover,
.mc .mc-shape-row .mcs-field input.mc-input-highlight:hover,
.mc .mc-shape-row .mcs-fields input.mc-input-highlight:hover {
  border-color: #4361ee;
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.14);
}

.mc input.mc-input-highlight:focus,
.mc .mc-shape-row .mcs-field input.mc-input-highlight:focus,
.mc .mc-shape-row .mcs-fields input.mc-input-highlight:focus {
  background: #fff;
  border-color: #4361ee;
  box-shadow: 0 0 0 5px rgba(67, 97, 238, 0.18);
}

@keyframes mcHighlightPulse {
  0%   { box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08); }
  50%  { box-shadow: 0 0 0 6px rgba(67, 97, 238, 0.18); }
  100% { box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08); }
}

.mc input.mc-input-highlight.mc-empty,
.mc .mc-shape-row .mcs-field input.mc-input-highlight.mc-empty,
.mc .mc-shape-row .mcs-fields input.mc-input-highlight.mc-empty {
  animation: mcHighlightPulse 2.4s ease-in-out infinite;
}

.mc input.mc-input-highlight.mc-filled,
.mc .mc-shape-row .mcs-field input.mc-input-highlight.mc-filled,
.mc .mc-shape-row .mcs-fields input.mc-input-highlight.mc-filled {
  animation: none;
}

@media (max-width: 640px) {
  .mc input.mc-input-highlight,
  .mc .mc-shape-row .mcs-field input.mc-input-highlight,
  .mc .mc-shape-row .mcs-fields input.mc-input-highlight {
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.1);
  }
}

/* ============================================================
   ТПЗ — подготовительно-заключительное время
   ============================================================ */
.mc .tpz-block {
  margin: 0 20px 14px;
  padding: 12px 16px;
  background: #fff5f5;
  border: 1.5px solid #f0b4b4;
  border-left: 5px solid #d9342b;
  border-radius: 8px;
}
.mc .tpz-block .tpz-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 1rem;
}
.mc .tpz-block .tpz-label {
  color: #7a1f1a;
  font-weight: 700;
}
.mc .tpz-block .tpz-value {
  color: #d9342b;
  font-weight: 800;
  font-size: 1.25rem;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  white-space: nowrap;
}
.mc .tpz-block .tpz-note {
  margin-top: 6px;
  font-size: .74rem;
  color: #a94b42;
  line-height: 1.4;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  word-break: break-word;
}

@media (max-width: 640px) {
  .mc .tpz-block {
    margin: 0 12px 12px;
    padding: 10px 12px;
  }
  .mc .tpz-block .tpz-row { font-size: .9rem; }
  .mc .tpz-block .tpz-value { font-size: 1.05rem; }
  .mc .tpz-block .tpz-note { font-size: .68rem; }
}

/* ============================================================
   XLSX — предпросмотр
   ============================================================ */
.mc-xlsx-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 50, .92);
  z-index: 99999;
  display: none;
  flex-direction: column;
}
.mc-xlsx-modal.open { display: flex; }
.mc-xlsx-modal .mc-xlsx-modal-header {
  padding: 12px 20px;
  background: #1a1a2e;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mc-xlsx-modal .mc-xlsx-modal-title {
  font-weight: 600;
  font-size: .95rem;
  word-break: break-all;
}
.mc-xlsx-modal .mc-xlsx-modal-actions {
  display: flex;
  gap: 8px;
}
.mc-xlsx-modal .mc-xlsx-modal-actions button {
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc-xlsx-modal .mc-xlsx-modal-actions button:first-child {
  background: #4361ee;
  color: #fff;
}
.mc-xlsx-modal .mc-xlsx-modal-actions button:last-child {
  background: #fff;
  color: #333;
}
.mc-xlsx-modal .mc-xlsx-modal-actions button:hover {
  opacity: .9;
}
.mc-xlsx-modal .mc-xlsx-modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px;
  background: #f4f7ff;
}

.mc-xlsx-preview {
  background: #fff;
  border-radius: 8px;
  overflow: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.mc-xlsx-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 900px;
}
.mc-xlsx-preview-table th,
.mc-xlsx-preview-table td {
  padding: 8px 10px;
  border: 1px solid #e3e8f4;
  text-align: left;
  white-space: nowrap;
}
.mc-xlsx-preview-table th {
  background: #f4f7ff;
  font-weight: 700;
  color: #1a3bbf;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.mc-xlsx-preview-table td {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  color: #1a1a2e;
}
.mc-xlsx-preview-table .mc-xlsx-customer-row td {
  background: linear-gradient(180deg, #dde7ff 0%, #c7d8ff 100%);
  font-weight: 700;
  color: #1a3bbf;
  font-family: inherit;
  font-size: .88rem;
}
.mc-xlsx-preview-table tbody tr:hover td {
  background: #fafbff;
}

@media (max-width: 640px) {
  .mc-xlsx-modal .mc-xlsx-modal-body { padding: 10px; }
  .mc-xlsx-preview-table { font-size: .74rem; }
  .mc-xlsx-preview-table th,
  .mc-xlsx-preview-table td { padding: 6px 7px; }
}

/* ============================================================
   Редактор таблицы XLSX
   ============================================================ */
.mc .xlsx-editor {
  margin-top: 14px;
  padding: 0;
  background: #fff;
  border: 1px solid #e3e8f4;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(20,30,80,.06);
}
.mc .xlsx-editor-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, #f4f7ff 0%, #e8efff 100%);
  border-bottom: 1px solid #d0d9ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mc .xlsx-editor-title {
  font-size: .95rem;
  font-weight: 700;
  color: #1a3bbf;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc .xlsx-editor-title .xlsx-info-mini {
  font-size: .78rem;
  font-weight: 600;
  background: #dde7ff;
  color: #1a3bbf;
  padding: 2px 8px;
  border-radius: 10px;
}
.mc .xlsx-editor-header-actions {
  display: flex;
  gap: 8px;
}
.mc .xlsx-editor-header-actions button {
  padding: 6px 12px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #d0d9ff;
  background: #fff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .xlsx-editor-header-actions button:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .xlsx-editor-body {
  padding: 12px;
  background: #fafbff;
  max-height: 600px;
  overflow-y: auto;
}
.mc .xlsx-editor-empty {
  padding: 24px;
  text-align: center;
  color: #888;
  font-size: .88rem;
}

.mc .xlsx-row-card {
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid #e3e8f4;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow .15s;
}
.mc .xlsx-row-card:hover {
  box-shadow: 0 2px 8px rgba(67,97,238,.1);
}
.mc .xlsx-row-card.open {
  border-color: #4361ee;
  box-shadow: 0 4px 14px rgba(67,97,238,.12);
}
.mc .xlsx-row-head {
  display: grid;
  grid-template-columns: 40px 1fr 1fr auto 30px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.mc .xlsx-row-head:hover {
  background: #f4f7ff;
}
.mc .xlsx-row-card.open .xlsx-row-head {
  background: #f4f7ff;
  border-bottom: 1px solid #d0d9ff;
}
.mc .xlsx-row-num {
  font-size: .78rem;
  font-weight: 700;
  color: #888;
}
.mc .xlsx-row-name {
  font-size: .9rem;
  font-weight: 600;
  color: #1a1a2e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mc .xlsx-row-customer {
  font-size: .8rem;
  color: #6a7792;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mc .xlsx-row-sum {
  font-size: .9rem;
  font-weight: 700;
  color: #1a3bbf;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  white-space: nowrap;
}
.mc .xlsx-row-chevron {
  font-size: .72rem;
  color: #888;
  transition: transform .2s;
  text-align: center;
}
.mc .xlsx-row-card.open .xlsx-row-chevron {
  transform: rotate(180deg);
}

.mc .xlsx-row-body {
  padding: 14px;
  background: #fff;
}

.mc .xlsx-row-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.mc .xlsx-row-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mc .xlsx-row-field label {
  font-size: .7rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .xlsx-row-field input {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  font-size: .85rem;
  background: #fff;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  outline: none;
  color: #1a1a2e;
  transition: .15s;
}
.mc .xlsx-row-field input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}

.mc .xlsx-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mc .xlsx-row-actions button {
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.mc .xlsx-row-recalc {
  background: #f4f7ff;
  color: #4361ee;
  border-color: #d0d9ff;
}
.mc .xlsx-row-recalc:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .xlsx-row-delete {
  background: #fff;
  color: #d9342b;
  border-color: #f0c0c0;
}
.mc .xlsx-row-delete:hover {
  background: #ffebeb;
  border-color: #d9342b;
}

@media (max-width: 640px) {
  .mc .xlsx-row-fields {
    grid-template-columns: 1fr 1fr;
  }
  .mc .xlsx-row-head {
    grid-template-columns: 30px 1fr auto 24px;
  }
  .mc .xlsx-row-customer {
    display: none;
  }
}

/* ============================================================
   КОМПАНИЯ (блокировка после первого ввода)
   ============================================================ */
.mc .mc-company-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.mc .mc-company-row input {
  flex: 1;
}
.mc .mc-company-row input:disabled {
  background: #f4f6fb;
  color: #333;
  font-weight: 600;
  cursor: not-allowed;
  border-color: #d0d9ff;
}
.mc .mc-company-edit,
.mc .mc-company-lock {
  flex: 0 0 auto;
  width: 42px;
  border: 1.5px solid #cfd6e6;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  color: #4361ee;
}
.mc .mc-company-edit:hover,
.mc .mc-company-lock:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-company-lock {
  color: #1e9e4a;
}
.mc .mc-company-lock:hover {
  background: #1e9e4a;
  border-color: #1e9e4a;
}
.mc .mc-company-hint {
  margin-top: 6px;
  padding: 7px 10px;
  background: #e8f5e9;
  border-left: 3px solid #1e9e4a;
  border-radius: 6px;
  font-size: .74rem;
  color: #1e6e35;
  line-height: 1.35;
}

/* ============================================================
   СПИСОК ДОБАВЛЕННЫХ ДЕТАЛЕЙ
   ============================================================ */
.mc .mc-save-part-btn {
  width: 100%;
  padding: 11px 16px;
  margin-top: 4px;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .mc-save-part-btn:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.mc .mc-save-part-btn:active {
  transform: translateY(1px);
}

.mc .mc-parts-list-wrap {
  margin-top: 14px;
  border: 1px solid #e3e8f4;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.mc .mc-parts-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  border-bottom: 2px solid #4361ee;
}
.mc .mc-parts-list-title {
  font-size: .82rem;
  font-weight: 700;
  color: #1a3bbf;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .mc-parts-list-count {
  font-size: .78rem;
  font-weight: 700;
  background: #4361ee;
  color: #fff;
  padding: 2px 10px;
  border-radius: 10px;
}
.mc .mc-parts-list {
  max-height: 420px;
  overflow-y: auto;
}
.mc .mc-parts-empty {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: .85rem;
}

/* Карточка детали */
.mc .mc-part-card {
  border-bottom: 1px solid #eef1f8;
  background: #fff;
  transition: background .15s;
}
.mc .mc-part-card:last-child { border-bottom: none; }
.mc .mc-part-card.open { background: #fafbff; }

.mc .mc-part-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.mc .mc-part-head:hover { background: #f4f7ff; }
.mc .mc-part-card.open .mc-part-head {
  background: #f4f7ff;
  border-bottom: 1px solid #d0d9ff;
}

.mc .mc-part-info { min-width: 0; }
.mc .mc-part-name {
  font-size: .9rem;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc .mc-part-sub {
  font-size: .74rem;
  color: #6a7792;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc .mc-part-price {
  font-size: .95rem;
  font-weight: 800;
  color: #1a3bbf;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  white-space: nowrap;
}
.mc .mc-part-chevron {
  font-size: .72rem;
  color: #888;
  transition: transform .2s;
}
.mc .mc-part-card.open .mc-part-chevron { transform: rotate(180deg); }

.mc .mc-part-body {
  padding: 14px;
  background: #fff;
  border-top: 1px solid #eef1f8;
}
.mc .mc-part-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.mc .mc-part-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mc .mc-part-field label {
  font-size: .68rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .mc-part-field input,
.mc .mc-part-field select {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  font-size: .85rem;
  background: #fff;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  outline: none;
  color: #1a1a2e;
  transition: .15s;
}
.mc .mc-part-field input:focus,
.mc .mc-part-field select:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}
.mc .mc-part-field input[readonly] {
  background: #f4f6fb;
  color: #555;
}

.mc .mc-part-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px dashed #e3e8f4;
}
.mc .mc-part-actions button {
  padding: 8px 14px;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.mc .mc-part-apply {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-part-apply:hover { background: #3450c9; border-color: #3450c9; }
.mc .mc-part-load {
  background: #f4f7ff;
  color: #4361ee;
  border-color: #d0d9ff;
}
.mc .mc-part-load:hover { background: #4361ee; color: #fff; }
.mc .mc-part-print {
  background: #fff;
  color: #1e9e4a;
  border-color: #b8e2c4;
}
.mc .mc-part-print:hover { background: #1e9e4a; color: #fff; border-color: #1e9e4a; }
.mc .mc-part-delete {
  background: #fff;
  color: #d9342b;
  border-color: #f0c0c0;
}
.mc .mc-part-delete:hover { background: #ffebeb; border-color: #d9342b; }

@media (max-width: 640px) {
  .mc .mc-part-grid { grid-template-columns: 1fr 1fr; }
  .mc .mc-part-head { grid-template-columns: 1fr auto; }
  .mc .mc-part-price { font-size: .82rem; }
}

/* ============================================================
   ЦЕПОЧКИ РАСЧЁТА ВНУТРИ КАРТОЧКИ ДЕТАЛИ
   ============================================================ */
.mc .mc-part-chain {
  margin-bottom: 14px;
  padding: 12px;
  background: linear-gradient(135deg, #eef2ff 0%, #e6ecff 100%);
  border-radius: 10px;
  border: 1px solid #dbe3f7;
}
.mc .mc-part-chain-label,
.mc .mc-part-short-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  margin-bottom: 8px;
}
.mc .mc-part-short-label {
  margin-top: 12px;
  color: #7a89b3;
}
.mc .mc-part-chain-table {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(20,30,80,.06);
}
.mc .mc-part-chain-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .78rem;
  min-width: 820px;
  table-layout: fixed;
}
.mc .mc-part-chain-tbl th,
.mc .mc-part-chain-tbl td {
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid #eef1f8;
}
.mc .mc-part-chain-tbl th {
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  font-weight: 700;
  color: #1a3bbf;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .2px;
  line-height: 1.15;
  border-bottom: 2px solid #4361ee;
}
.mc .mc-part-chain-tbl th .unit {
  display: block;
  font-weight: 500;
  color: #7a89b3;
  font-size: .58rem;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}
.mc .mc-part-chain-tbl td {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  color: #1a1a2e;
  font-size: .82rem;
}
.mc .mc-part-chain-tbl td.op {
  background: #f8f9fc;
  color: #a0a8be;
  font-weight: 700;
  padding: 8px 2px;
  width: 20px;
}
.mc .mc-part-chain-tbl td.hl {
  background: linear-gradient(135deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: inset 3px 0 0 #4361ee;
}
.mc .mc-part-chain-tbl th.hl-head {
  background: linear-gradient(180deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  box-shadow: inset 3px 0 0 #4361ee;
}

.mc .mc-part-chain-copy,
.mc .mc-part-short-copy {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}
.mc .mc-part-chain-text,
.mc .mc-part-short-text {
  flex: 1;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
  line-height: 1.4;
  color: #1a1a2e;
  background: #fff;
  padding: 8px 10px;
  border: 1px solid #e3e8f4;
  border-radius: 8px;
  word-break: break-word;
  display: flex;
  align-items: center;
}
.mc .mc-part-chain-btn,
.mc .mc-part-short-btn {
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  font-size: 1rem;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc .mc-part-chain-btn:hover,
.mc .mc-part-short-btn:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.mc .mc-part-chain-btn.copied,
.mc .mc-part-short-btn.copied {
  background: #1e9e4a;
  border-color: #1e9e4a;
}

.mc .mc-part-grid-readonly {
  margin-top: 4px;
  padding: 10px;
  background: #f8f9fc;
  border-radius: 8px;
  border: 1px dashed #cfd6e6;
}

@media (max-width: 640px) {
  .mc .mc-part-chain-tbl { font-size: .7rem; min-width: 760px; }
  .mc .mc-part-chain-tbl th { font-size: .58rem; }
  .mc .mc-part-chain-tbl th .unit { font-size: .52rem; }
  .mc .mc-part-chain-tbl td { font-size: .74rem; }
  .mc .mc-part-chain-tbl td.hl { font-size: .85rem; }
  .mc .mc-part-chain-text,
  .mc .mc-part-short-text { font-size: .72rem; padding: 7px 9px; }
  .mc .mc-part-chain-btn,
  .mc .mc-part-short-btn { width: 36px; min-width: 36px; font-size: .95rem; }
}

/* ============================================================
   ИНДИКАТОР АВТОЗАГРУЗКИ ДЕТАЛЕЙ С СЕРВЕРА
   ============================================================ */
.mc-autoload-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1a1a2e;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.mc-autoload-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mcSpin .7s linear infinite;
}
@keyframes mcSpin { to { transform: rotate(360deg); } }

/* ============================================================
   КОМПАНИЯ (блокировка после первого ввода)
   ============================================================ */
.mc .mc-company-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.mc .mc-company-row input {
  flex: 1;
}
.mc .mc-company-row input:disabled {
  background: #f4f6fb;
  color: #333;
  font-weight: 600;
  cursor: not-allowed;
  border-color: #d0d9ff;
}
.mc .mc-company-edit,
.mc .mc-company-lock {
  flex: 0 0 auto;
  width: 42px;
  border: 1.5px solid #cfd6e6;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  color: #4361ee;
}
.mc .mc-company-edit:hover,
.mc .mc-company-lock:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-company-lock { color: #1e9e4a; }
.mc .mc-company-lock:hover { background: #1e9e4a; border-color: #1e9e4a; }
.mc .mc-company-hint {
  margin-top: 6px;
  padding: 7px 10px;
  background: #e8f5e9;
  border-left: 3px solid #1e9e4a;
  border-radius: 6px;
  font-size: .74rem;
  color: #1e6e35;
  line-height: 1.35;
}

/* ============================================================
   СПИСОК ДЕТАЛЕЙ КОМПАНИИ
   ============================================================ */
.mc .mc-parts-list-wrap {
  margin-top: 14px;
  border: 1px solid #e3e8f4;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.mc .mc-parts-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  border-bottom: 2px solid #4361ee;
}
.mc .mc-parts-list-title {
  font-size: .82rem;
  font-weight: 700;
  color: #1a3bbf;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .mc-parts-list-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mc .mc-parts-list-count {
  font-size: .78rem;
  font-weight: 700;
  background: #4361ee;
  color: #fff;
  padding: 2px 10px;
  border-radius: 10px;
}
.mc .mc-parts-toggle-btn {
  padding: 6px 12px;
  font-size: .76rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #d0d9ff;
  background: #fff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  white-space: nowrap;
}
.mc .mc-parts-toggle-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-parts-list {
  max-height: 600px;
  overflow-y: auto;
  transition: max-height .25s ease, opacity .2s ease;
}
.mc .mc-parts-list.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}
.mc .mc-parts-empty {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: .85rem;
}

/* Кнопка «Добавить деталь» снизу списка */
.mc .mc-parts-add-btn {
  width: 100%;
  padding: 11px 16px;
  font-size: .88rem;
  font-weight: 700;
  border: none;
  border-top: 1px solid #d0d9ff;
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  color: #1a3bbf;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  letter-spacing: .2px;
}
.mc .mc-parts-add-btn:hover {
  background: #4361ee;
  color: #fff;
}
.mc .mc-parts-add-btn:active {
  transform: translateY(1px);
}

/* ============================================================
   КАРТОЧКА ДЕТАЛИ (компактный вид)
   ============================================================ */
.mc .mc-part-card {
  border-bottom: 1px solid #eef1f8;
  background: #fff;
  transition: background .15s;
}
.mc .mc-part-card:last-child { border-bottom: none; }
.mc .mc-part-card.open { background: #fafbff; }

.mc .mc-part-head {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.mc .mc-part-head:hover { background: #f4f7ff; }
.mc .mc-part-card.open .mc-part-head {
  background: #f4f7ff;
  border-bottom: 1px solid #d0d9ff;
}

.mc .mc-part-num {
  font-size: .8rem;
  font-weight: 700;
  color: #888;
  text-align: center;
}
.mc .mc-part-line {
  min-width: 0;
  font-size: .84rem;
  color: #1a1a2e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.mc .mc-part-line .mc-part-line-name {
  font-weight: 700;
  color: #1a1a2e;
}
.mc .mc-part-line .mc-part-line-meta {
  color: #6a7792;
  font-weight: 500;
}
.mc .mc-part-line .mc-part-line-price {
  color: #1a3bbf;
  font-weight: 800;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
}
.mc .mc-part-line .mc-part-line-formula {
  color: #555;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
}
.mc .mc-part-chevron {
  font-size: .8rem;
  font-weight: 700;
  color: #4361ee;
  padding: 3px 10px;
  border: 1px solid #d0d9ff;
  border-radius: 6px;
  background: #fff;
  transition: .15s;
  white-space: nowrap;
}
.mc .mc-part-card.open .mc-part-chevron {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

/* Раскрытое тело */
.mc .mc-part-body {
  padding: 14px;
  background: #fff;
  border-top: 1px solid #eef1f8;
}
.mc .mc-part-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.mc .mc-part-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mc .mc-part-field label {
  font-size: .68rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .mc-part-field input,
.mc .mc-part-field select {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  font-size: .85rem;
  background: #fff;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  outline: none;
  color: #1a1a2e;
  transition: .15s;
}
.mc .mc-part-field input:focus,
.mc .mc-part-field select:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}
.mc .mc-part-field input[readonly] {
  background: #f4f6fb;
  color: #555;
}

.mc .mc-part-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px dashed #e3e8f4;
}
.mc .mc-part-actions button {
  padding: 8px 14px;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.mc .mc-part-apply {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-part-apply:hover { background: #3450c9; border-color: #3450c9; }
.mc .mc-part-print {
  background: #fff;
  color: #1e9e4a;
  border-color: #b8e2c4;
}
.mc .mc-part-print:hover { background: #1e9e4a; color: #fff; border-color: #1e9e4a; }
.mc .mc-part-delete {
  background: #fff;
  color: #d9342b;
  border-color: #f0c0c0;
}
.mc .mc-part-delete:hover { background: #ffebeb; border-color: #d9342b; }

@media (max-width: 640px) {
  .mc .mc-part-grid { grid-template-columns: 1fr 1fr; }
  .mc .mc-part-head { grid-template-columns: 22px 1fr auto; }
  .mc .mc-part-line { font-size: .78rem; }
  .mc .mc-part-line .mc-part-line-formula { font-size: .7rem; }
}

/* ============================================================
   ЦЕПОЧКИ РАСЧЁТА ВНУТРИ КАРТОЧКИ
   ============================================================ */
.mc .mc-part-chain {
  margin-bottom: 14px;
  padding: 12px;
  background: linear-gradient(135deg, #eef2ff 0%, #e6ecff 100%);
  border-radius: 10px;
  border: 1px solid #dbe3f7;
}
.mc .mc-part-chain-label,
.mc .mc-part-short-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  margin-bottom: 8px;
}
.mc .mc-part-short-label { margin-top: 14px; color: #7a89b3; }
.mc .mc-part-chain-table {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(20,30,80,.06);
}
.mc .mc-part-chain-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .78rem;
  min-width: 820px;
  table-layout: fixed;
}
.mc .mc-part-chain-tbl th,
.mc .mc-part-chain-tbl td {
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid #eef1f8;
}
.mc .mc-part-chain-tbl th {
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  font-weight: 700;
  color: #1a3bbf;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .2px;
  line-height: 1.15;
  border-bottom: 2px solid #4361ee;
}
.mc .mc-part-chain-tbl th .unit {
  display: block;
  font-weight: 500;
  color: #7a89b3;
  font-size: .58rem;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}
.mc .mc-part-chain-tbl td {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  color: #1a1a2e;
  font-size: .82rem;
}
.mc .mc-part-chain-tbl td.op {
  background: #f8f9fc;
  color: #a0a8be;
  font-weight: 700;
  padding: 8px 2px;
  width: 20px;
}
.mc .mc-part-chain-tbl td.hl {
  background: linear-gradient(135deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: inset 3px 0 0 #4361ee;
}
.mc .mc-part-chain-tbl th.hl-head {
  background: linear-gradient(180deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  box-shadow: inset 3px 0 0 #4361ee;
}

.mc .mc-part-chain-copy,
.mc .mc-part-short-copy {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}
.mc .mc-part-chain-text,
.mc .mc-part-short-text {
  flex: 1;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
  line-height: 1.4;
  color: #1a1a2e;
  background: #fff;
  padding: 8px 10px;
  border: 1px solid #e3e8f4;
  border-radius: 8px;
  word-break: break-word;
  display: flex;
  align-items: center;
}
.mc .mc-part-chain-btn,
.mc .mc-part-short-btn {
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  font-size: 1rem;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc .mc-part-chain-btn:hover,
.mc .mc-part-short-btn:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.mc .mc-part-chain-btn.copied,
.mc .mc-part-short-btn.copied {
  background: #1e9e4a;
  border-color: #1e9e4a;
}

.mc .mc-part-grid-readonly {
  margin-top: 4px;
  padding: 10px;
  background: #f8f9fc;
  border-radius: 8px;
  border: 1px dashed #cfd6e6;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО ФОРМЫ ДЕТАЛИ
   ============================================================ */
.mc-part-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 50, .7);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mc-part-modal.open { display: flex; }

.mc-part-modal-dialog {
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mc-part-modal-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2c3e7a 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.mc-part-modal-title {
  font-size: 1rem;
  font-weight: 700;
}
.mc-part-modal-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  transition: .15s;
}
.mc-part-modal-close:hover { background: rgba(255,255,255,.3); }

.mc-part-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.mc-part-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mc-part-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mc-part-modal-field-wide {
  grid-column: span 3;
}
.mc-part-modal-field label {
  font-size: .7rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc-part-modal-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .9rem;
  background: #fff;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  outline: none;
  color: #1a1a2e;
  transition: .15s;
}
.mc-part-modal-field input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

.mc-part-modal-preview {
  margin-top: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #e6ecff 100%);
  border-radius: 10px;
  border: 1px solid #dbe3f7;
}
.mc-part-modal-preview-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  margin-bottom: 6px;
}
.mc-part-modal-preview-text {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .82rem;
  color: #1a1a2e;
  line-height: 1.4;
  word-break: break-word;
}

.mc-part-modal-footer {
  padding: 14px 20px;
  background: #fafbff;
  border-top: 1px solid #e3e8f4;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mc-part-modal-footer button {
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.mc-part-modal-cancel {
  background: #fff;
  color: #555;
  border-color: #cfd6e6;
}
.mc-part-modal-cancel:hover {
  background: #f4f6fb;
  border-color: #4361ee;
  color: #4361ee;
}
.mc-part-modal-save {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc-part-modal-save:hover {
  background: #3450c9;
  border-color: #3450c9;
}

@media (max-width: 640px) {
  .mc-part-modal-grid { grid-template-columns: 1fr 1fr; }
  .mc-part-modal-field-wide { grid-column: span 2; }
  .mc-part-modal-dialog { max-height: 96vh; }
}

/* ============================================================
   ИНДИКАТОР АВТОЗАГРУЗКИ
   ============================================================ */
.mc-autoload-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1a1a2e;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.mc-autoload-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mcSpin .7s linear infinite;
}
@keyframes mcSpin { to { transform: rotate(360deg); } }

/* ============================================================
   КОМПАНИЯ (блокировка после первого ввода)
   ============================================================ */
.mc .mc-company-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.mc .mc-company-row input {
  flex: 1;
}
.mc .mc-company-row input:disabled {
  background: #f4f6fb;
  color: #333;
  font-weight: 600;
  cursor: not-allowed;
  border-color: #d0d9ff;
}
.mc .mc-company-edit,
.mc .mc-company-lock {
  flex: 0 0 auto;
  width: 42px;
  border: 1.5px solid #cfd6e6;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  color: #4361ee;
}
.mc .mc-company-edit:hover,
.mc .mc-company-lock:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-company-lock { color: #1e9e4a; }
.mc .mc-company-lock:hover { background: #1e9e4a; border-color: #1e9e4a; }
.mc .mc-company-hint {
  margin-top: 6px;
  padding: 7px 10px;
  background: #e8f5e9;
  border-left: 3px solid #1e9e4a;
  border-radius: 6px;
  font-size: .74rem;
  color: #1e6e35;
  line-height: 1.35;
}

/* ============================================================
   СПИСОК ДЕТАЛЕЙ КОМПАНИИ
   ============================================================ */
.mc .mc-parts-list-wrap {
  margin-top: 14px;
  border: 1px solid #e3e8f4;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.mc .mc-parts-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  border-bottom: 2px solid #4361ee;
}
.mc .mc-parts-list-title {
  font-size: .82rem;
  font-weight: 700;
  color: #1a3bbf;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .mc-parts-list-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mc .mc-parts-list-count {
  font-size: .78rem;
  font-weight: 700;
  background: #4361ee;
  color: #fff;
  padding: 2px 10px;
  border-radius: 10px;
}
.mc .mc-parts-toggle-btn {
  padding: 6px 12px;
  font-size: .76rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #d0d9ff;
  background: #fff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  white-space: nowrap;
}
.mc .mc-parts-toggle-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-parts-list {
  max-height: 600px;
  overflow-y: auto;
  transition: max-height .25s ease, opacity .2s ease;
}
.mc .mc-parts-list.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}
.mc .mc-parts-empty {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: .85rem;
}

/* Кнопка «Добавить деталь» снизу списка */
.mc .mc-parts-add-btn {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-size: .88rem;
  font-weight: 700;
  border: none;
  border-top: 1px solid #d0d9ff;
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  color: #1a3bbf;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  letter-spacing: .2px;
}
.mc .mc-parts-add-btn:hover {
  background: #4361ee;
  color: #fff;
}
.mc .mc-parts-add-btn:active {
  transform: translateY(1px);
}

/* ============================================================
   КАРТОЧКА ДЕТАЛИ (компактный вид — ОДНА строка)
   ============================================================ */
.mc .mc-part-card {
  border-bottom: 1px solid #eef1f8;
  background: #fff;
  transition: background .15s;
}
.mc .mc-part-card:last-child { border-bottom: none; }
.mc .mc-part-card.open { background: #fafbff; }

.mc .mc-part-head {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.mc .mc-part-head:hover { background: #f4f7ff; }
.mc .mc-part-card.open .mc-part-head {
  background: #f4f7ff;
  border-bottom: 1px solid #d0d9ff;
}

.mc .mc-part-num {
  font-size: .8rem;
  font-weight: 700;
  color: #888;
  text-align: center;
}
.mc .mc-part-line {
  min-width: 0;
  font-size: .84rem;
  color: #1a1a2e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.mc .mc-part-line .mc-part-line-name {
  font-weight: 700;
  color: #1a1a2e;
}
.mc .mc-part-line .mc-part-line-meta {
  color: #6a7792;
  font-weight: 500;
}
.mc .mc-part-line .mc-part-line-price {
  color: #1a3bbf;
  font-weight: 800;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
}
.mc .mc-part-line .mc-part-line-formula {
  color: #555;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
}
.mc .mc-part-chevron {
  font-size: .8rem;
  font-weight: 700;
  color: #4361ee;
  padding: 3px 10px;
  border: 1px solid #d0d9ff;
  border-radius: 6px;
  background: #fff;
  transition: .15s;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.mc .mc-part-card.open .mc-part-chevron {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

/* Раскрытое тело */
.mc .mc-part-body {
  padding: 14px;
  background: #fff;
  border-top: 1px solid #eef1f8;
}
.mc .mc-part-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.mc .mc-part-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mc .mc-part-field label {
  font-size: .68rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc .mc-part-field input,
.mc .mc-part-field select {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid #e0e0e0;
  border-radius: 6px;
  font-size: .85rem;
  background: #fff;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  outline: none;
  color: #1a1a2e;
  transition: .15s;
}
.mc .mc-part-field input:focus,
.mc .mc-part-field select:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}
.mc .mc-part-field input[readonly] {
  background: #f4f6fb;
  color: #555;
}

.mc .mc-part-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px dashed #e3e8f4;
}
.mc .mc-part-actions button {
  padding: 8px 14px;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.mc .mc-part-apply {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-part-apply:hover { background: #3450c9; border-color: #3450c9; }
.mc .mc-part-print {
  background: #fff;
  color: #1e9e4a;
  border-color: #b8e2c4;
}
.mc .mc-part-print:hover { background: #1e9e4a; color: #fff; border-color: #1e9e4a; }
.mc .mc-part-delete {
  background: #fff;
  color: #d9342b;
  border-color: #f0c0c0;
}
.mc .mc-part-delete:hover { background: #ffebeb; border-color: #d9342b; }

@media (max-width: 640px) {
  .mc .mc-part-grid { grid-template-columns: 1fr 1fr; }
  .mc .mc-part-head { grid-template-columns: 22px 1fr auto; }
  .mc .mc-part-line { font-size: .78rem; }
  .mc .mc-part-line .mc-part-line-formula { font-size: .7rem; }
}

/* ============================================================
   ЦЕПОЧКИ РАСЧЁТА ВНУТРИ КАРТОЧКИ
   ============================================================ */
.mc .mc-part-chain {
  margin-bottom: 14px;
  padding: 12px;
  background: linear-gradient(135deg, #eef2ff 0%, #e6ecff 100%);
  border-radius: 10px;
  border: 1px solid #dbe3f7;
}
.mc .mc-part-chain-label,
.mc .mc-part-short-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  margin-bottom: 8px;
}
.mc .mc-part-short-label { margin-top: 14px; color: #7a89b3; }
.mc .mc-part-chain-table {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(20,30,80,.06);
}
.mc .mc-part-chain-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .78rem;
  min-width: 820px;
  table-layout: fixed;
}
.mc .mc-part-chain-tbl th,
.mc .mc-part-chain-tbl td {
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid #eef1f8;
}
.mc .mc-part-chain-tbl th {
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  font-weight: 700;
  color: #1a3bbf;
  font-size: .64rem;
  text-transform: uppercase;
  letter-spacing: .2px;
  line-height: 1.15;
  border-bottom: 2px solid #4361ee;
}
.mc .mc-part-chain-tbl th .unit {
  display: block;
  font-weight: 500;
  color: #7a89b3;
  font-size: .58rem;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}
.mc .mc-part-chain-tbl td {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  color: #1a1a2e;
  font-size: .82rem;
}
.mc .mc-part-chain-tbl td.op {
  background: #f8f9fc;
  color: #a0a8be;
  font-weight: 700;
  padding: 8px 2px;
  width: 20px;
}
.mc .mc-part-chain-tbl td.hl {
  background: linear-gradient(135deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: inset 3px 0 0 #4361ee;
}
.mc .mc-part-chain-tbl th.hl-head {
  background: linear-gradient(180deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  box-shadow: inset 3px 0 0 #4361ee;
}

.mc .mc-part-chain-copy,
.mc .mc-part-short-copy {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}
.mc .mc-part-chain-text,
.mc .mc-part-short-text {
  flex: 1;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
  line-height: 1.4;
  color: #1a1a2e;
  background: #fff;
  padding: 8px 10px;
  border: 1px solid #e3e8f4;
  border-radius: 8px;
  word-break: break-word;
  display: flex;
  align-items: center;
}
.mc .mc-part-chain-btn,
.mc .mc-part-short-btn {
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  font-size: 1rem;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc .mc-part-chain-btn:hover,
.mc .mc-part-short-btn:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.mc .mc-part-chain-btn.copied,
.mc .mc-part-short-btn.copied {
  background: #1e9e4a;
  border-color: #1e9e4a;
}

.mc .mc-part-grid-readonly {
  margin-top: 4px;
  padding: 10px;
  background: #f8f9fc;
  border-radius: 8px;
  border: 1px dashed #cfd6e6;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО ФОРМЫ ДЕТАЛИ
   ============================================================ */
.mc-part-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 50, .7);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mc-part-modal.open { display: flex; }

.mc-part-modal-dialog {
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mc-part-modal-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2c3e7a 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.mc-part-modal-title {
  font-size: 1rem;
  font-weight: 700;
}
.mc-part-modal-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  transition: .15s;
}
.mc-part-modal-close:hover { background: rgba(255,255,255,.3); }

.mc-part-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.mc-part-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mc-part-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mc-part-modal-field-wide {
  grid-column: span 3;
}
.mc-part-modal-field label {
  font-size: .7rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc-part-modal-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .9rem;
  background: #fff;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  outline: none;
  color: #1a1a2e;
  transition: .15s;
}
.mc-part-modal-field input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

.mc-part-modal-preview {
  margin-top: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #e6ecff 100%);
  border-radius: 10px;
  border: 1px solid #dbe3f7;
}
.mc-part-modal-preview-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  margin-bottom: 6px;
}
.mc-part-modal-preview-text {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .82rem;
  color: #1a1a2e;
  line-height: 1.4;
  word-break: break-word;
}

.mc-part-modal-footer {
  padding: 14px 20px;
  background: #fafbff;
  border-top: 1px solid #e3e8f4;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mc-part-modal-footer button {
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.mc-part-modal-cancel {
  background: #fff;
  color: #555;
  border-color: #cfd6e6;
}
.mc-part-modal-cancel:hover {
  background: #f4f6fb;
  border-color: #4361ee;
  color: #4361ee;
}
.mc-part-modal-save {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc-part-modal-save:hover {
  background: #3450c9;
  border-color: #3450c9;
}

@media (max-width: 640px) {
  .mc-part-modal-grid { grid-template-columns: 1fr 1fr; }
  .mc-part-modal-field-wide { grid-column: span 2; }
  .mc-part-modal-dialog { max-height: 96vh; }
}

/* ============================================================
   ИНДИКАТОР АВТОЗАГРУЗКИ
   ============================================================ */
.mc-autoload-bar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1a1a2e;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.mc-autoload-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mcSpin .7s linear infinite;
}
@keyframes mcSpin { to { transform: rotate(360deg); } }

/* ============================================================
   ПОДСВЕТКА КЛЮЧЕВЫХ ПОЛЕЙ В МОДАЛКЕ ДЕТАЛИ
   ============================================================ */
.mc-part-modal input.mc-input-highlight {
  background: linear-gradient(135deg, #eef4ff 0%, #e6edff 100%);
  border: 1.5px solid #7a97ff;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.08);
  transition: background .2s, border-color .2s, box-shadow .2s;
  font-weight: 600;
  color: #1a1a2e;
}

.mc-part-modal input.mc-input-highlight:hover {
  border-color: #4361ee;
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.14);
}

.mc-part-modal input.mc-input-highlight:focus {
  background: #fff;
  border-color: #4361ee;
  box-shadow: 0 0 0 5px rgba(67, 97, 238, 0.18);
}

.mc-part-modal input.mc-input-highlight.mc-empty {
  animation: mcHighlightPulse 2.4s ease-in-out infinite;
}

.mc-part-modal input.mc-input-highlight.mc-filled {
  animation: none;
}

@media (max-width: 640px) {
  .mc-part-modal input.mc-input-highlight {
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.1);
  }
}

/* Подзаголовки блоков в модалке */
.mc-part-modal-subtitle {
  margin: 12px 0 8px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #4361ee;
  border-bottom: 1px solid #e3e8f4;
  padding-bottom: 4px;
}
/* ============================================================
   БЛОК «ПРОВЕРКА ДАННЫХ ПО КРАТКОМУ РАСЧЁТУ»
   ============================================================ */
.mc .report-formula .rf-verify {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #dbe3f7;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(20,30,80,.05);
}
.mc .report-formula .rf-verify-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #1a3bbf;
  margin-bottom: 6px;
}
.mc .report-formula .rf-verify-hint {
  font-size: .74rem;
  color: #6a7792;
  line-height: 1.4;
  margin-bottom: 10px;
}
.mc .report-formula .rf-verify-hint code {
  background: #eef2ff;
  color: #1a3bbf;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .72rem;
}

.mc .report-formula .rf-verify-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.mc .report-formula .rf-verify-input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #cfd6e6;
  border-radius: 8px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .9rem;
  color: #1a1a2e;
  background: #fff;
  outline: none;
  transition: .15s;
}
.mc .report-formula .rf-verify-input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.mc .report-formula .rf-verify-run {
  flex: 0 0 auto;
  padding: 0 18px;
  font-size: .84rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #4361ee;
  background: #4361ee;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .report-formula .rf-verify-run:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.mc .report-formula .rf-verify-clear {
  flex: 0 0 auto;
  width: 42px;
  border-radius: 8px;
  border: 1px solid #cfd6e6;
  background: #fff;
  color: #d9342b;
  cursor: pointer;
  font-family: inherit;
  font-size: .95rem;
  transition: .15s;
}
.mc .report-formula .rf-verify-clear:hover {
  background: #ffebeb;
  border-color: #d9342b;
}

.mc .report-formula .rf-verify-actions {
  margin-top: 8px;
}
.mc .report-formula .rf-verify-fill {
  padding: 6px 12px;
  font-size: .74rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px dashed #a9baff;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .report-formula .rf-verify-fill:hover {
  background: #4361ee;
  color: #fff;
  border-style: solid;
  border-color: #4361ee;
}

/* Результат проверки */
.mc .report-formula .rf-verify-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f8f9fc;
  border: 1px solid #e3e8f4;
}

.mc .report-formula .rf-verify-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.mc .report-formula .rf-verify-status.ok {
  background: #e8f5e9;
  color: #1e6e35;
  border-left: 4px solid #1e9e4a;
}
.mc .report-formula .rf-verify-status.warn {
  background: #fff4e5;
  color: #8a5300;
  border-left: 4px solid #ffb84d;
}
.mc .report-formula .rf-verify-status.err {
  background: #ffebeb;
  color: #a02020;
  border-left: 4px solid #d9342b;
}

.mc .report-formula .rf-verify-section {
  margin-bottom: 10px;
}
.mc .report-formula .rf-verify-section:last-child { margin-bottom: 0; }
.mc .report-formula .rf-verify-section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #4361ee;
  margin-bottom: 6px;
}

.mc .report-formula .rf-verify-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 6px 10px;
  font-size: .84rem;
  border-bottom: 1px dashed #eef1f8;
  align-items: baseline;
}
.mc .report-formula .rf-verify-item:last-child { border-bottom: none; }
.mc .report-formula .rf-verify-item .label {
  color: #555;
}
.mc .report-formula .rf-verify-item .value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 700;
  color: #1a3bbf;
  white-space: nowrap;
}
.mc .report-formula .rf-verify-item.highlight {
  background: #eef2ff;
  border-radius: 6px;
  padding: 8px 10px;
  border-bottom: none;
}
.mc .report-formula .rf-verify-item.highlight .label {
  color: #1a1a2e;
  font-weight: 600;
}
.mc .report-formula .rf-verify-item.highlight .value {
  color: #1a3bbf;
  font-size: .95rem;
}

.mc .report-formula .rf-verify-formula {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff;
  border-left: 3px solid #a9baff;
  border-radius: 4px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
  color: #1a1a2e;
  line-height: 1.5;
  word-break: break-word;
}

.mc .report-formula .rf-verify-error {
  padding: 8px 12px;
  background: #ffebeb;
  border-left: 4px solid #d9342b;
  border-radius: 6px;
  font-size: .84rem;
  color: #a02020;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .mc .report-formula .rf-verify-row {
    flex-wrap: wrap;
  }
  .mc .report-formula .rf-verify-input { min-width: 100%; }
  .mc .report-formula .rf-verify-run { flex: 1; padding: 10px 14px; }
}
/* ============================================================
   ТИП ПРОКАТА В КАРТОЧКЕ ДЕТАЛИ
   ============================================================ */
.mc .mc-part-prokat {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #eef2ff;
  border-left: 4px solid #4361ee;
  border-radius: 8px;
}
.mc .mc-part-prokat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: .9rem;
}
.mc .mc-part-prokat-label {
  color: #555;
  font-weight: 500;
}
.mc .mc-part-prokat-value {
  color: #1a3bbf;
  font-weight: 700;
}
.mc .mc-part-prokat-note {
  margin-top: 4px;
  font-size: .74rem;
  color: #6a7792;
  line-height: 1.35;
}

/* ============================================================
   ТИП ПРОКАТА В МОДАЛКЕ ДЕТАЛИ
   ============================================================ */
.mc-part-modal-prokat {
  margin: 8px 0 4px;
  padding: 10px 14px;
  background: #eef2ff;
  border-left: 4px solid #4361ee;
  border-radius: 8px;
}
.mc-part-modal-prokat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: .9rem;
}
.mc-part-modal-prokat-label {
  color: #555;
  font-weight: 500;
}
.mc-part-modal-prokat-value {
  color: #1a3bbf;
  font-weight: 700;
}
.mc-part-modal-prokat-note {
  margin-top: 4px;
  font-size: .74rem;
  color: #6a7792;
  line-height: 1.35;
}

/* ============================================================
   КНОПКА «+ ДОБАВИТЬ ЗАКАЗЧИКА» РЯДОМ С ПОЛЕМ
   ============================================================ */
.mc .mc-company-add {
  flex: 0 0 auto;
  width: 42px;
  border: 1.5px solid #cfd6e6;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  color: #1e9e4a;
}
.mc .mc-company-add:hover {
  background: #1e9e4a;
  color: #fff;
  border-color: #1e9e4a;
}

/* ============================================================
   ИТОГИ ПОД СПИСКОМ ДЕТАЛЕЙ + ТПЗ
   ============================================================ */
.mc .mc-parts-totals {
  padding: 12px 16px;
  background: linear-gradient(180deg, #f8f9fc 0%, #eef2ff 100%);
  border-top: 1px solid #dbe3f7;
}
.mc .mc-parts-total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: .88rem;
  color: #555;
}
.mc .mc-parts-total-row span:last-child {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 700;
  color: #1a3bbf;
  white-space: nowrap;
}
.mc .mc-parts-total-row.highlight {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #dbe3f7;
  font-weight: 700;
  font-size: .95rem;
}
.mc .mc-parts-total-row.highlight span:first-child { color: #1a1a2e; }
.mc .mc-parts-total-row.highlight span:last-child {
  font-size: 1.1rem;
  color: #1a3bbf;
}

.mc .mc-parts-tpz {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 14px;
  background: #fff5f5;
  border: 1.5px solid #f0b4b4;
  border-left: 5px solid #d9342b;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 700;
  color: #7a1f1a;
}
.mc .mc-parts-tpz span:last-child {
  color: #d9342b;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 1.15rem;
  white-space: nowrap;
}

/* ============================================================
   КНОПКИ ВНИЗУ БЛОКА ДЕТАЛЕЙ
   ============================================================ */
.mc .mc-parts-bottom-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #d0d9ff;
  flex-wrap: wrap;
}
.mc .mc-parts-bottom-btn {
  flex: 1 1 auto;
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #d0d9ff;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc .mc-parts-bottom-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО ЗАКАЗЧИКА
   ============================================================ */
.mc-customer-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 50, .7);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mc-customer-modal.open { display: flex; }

.mc-customer-modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mc-customer-modal-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2c3e7a 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.mc-customer-modal-title {
  font-size: 1rem;
  font-weight: 700;
}
.mc-customer-modal-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  transition: .15s;
}
.mc-customer-modal-close:hover { background: rgba(255,255,255,.3); }

.mc-customer-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}
.mc-customer-modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.mc-customer-modal-field label {
  font-size: .72rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc-customer-modal-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .95rem;
  background: #fff;
  font-family: inherit;
  outline: none;
  color: #1a1a2e;
  transition: .15s;
}
.mc-customer-modal-field input:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

.mc-customer-modal-hint {
  font-size: .74rem;
  color: #6a7792;
  margin: 4px 0 10px;
}

.mc-customer-list {
  border: 1px solid #e3e8f4;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  max-height: 260px;
  overflow-y: auto;
}
.mc-customer-list-empty {
  padding: 16px;
  text-align: center;
  color: #888;
  font-size: .82rem;
}
.mc-customer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #eef1f8;
  cursor: pointer;
  font-size: .88rem;
  color: #1a1a2e;
  transition: background .15s;
}
.mc-customer-item:last-child { border-bottom: none; }
.mc-customer-item:hover { background: #f4f7ff; }
.mc-customer-item.selected { background: #eef2ff; font-weight: 700; }
.mc-customer-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mc-customer-item-actions {
  display: flex;
  gap: 6px;
}
.mc-customer-item-actions button {
  padding: 4px 10px;
  font-size: .72rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #cfd6e6;
  background: #fff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc-customer-item-actions button.danger { color: #d9342b; }
.mc-customer-item-actions button:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc-customer-item-actions button.danger:hover {
  background: #d9342b;
  border-color: #d9342b;
  color: #fff;
}

.mc-customer-modal-footer {
  padding: 14px 20px;
  background: #fafbff;
  border-top: 1px solid #e3e8f4;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.mc-customer-modal-footer button {
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.mc-customer-modal-cancel {
  background: #fff;
  color: #555;
  border-color: #cfd6e6;
}
.mc-customer-modal-cancel:hover {
  background: #f4f6fb;
  border-color: #4361ee;
  color: #4361ee;
}
.mc-customer-modal-save {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc-customer-modal-save:hover {
  background: #3450c9;
  border-color: #3450c9;
}

/* ============================================================
   КНОПКА «УДАЛИТЬ ЗАКАЗЧИКА» (рядом с полем)
   ============================================================ */
.mc .mc-company-del {
  flex: 0 0 auto;
  width: 42px;
  border: 1.5px solid #f0c0c0;
  border-radius: 8px;
  background: #fff;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  color: #d9342b;
}
.mc .mc-company-del:hover {
  background: #d9342b;
  color: #fff;
  border-color: #d9342b;
}

/* ============================================================
   НИЖНИЕ КНОПКИ БЛОКА ДЕТАЛЕЙ — 4 кнопки в 2 ряда
   ============================================================ */
.mc .mc-parts-bottom-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #d0d9ff;
  flex-wrap: wrap;
}
.mc .mc-parts-bottom-btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 140px;
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #d0d9ff;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  white-space: nowrap;
}
.mc .mc-parts-bottom-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc .mc-parts-bottom-save {
  background: #e8f5e9;
  color: #1e6e35;
  border-color: #b8e2c4;
}
.mc .mc-parts-bottom-save:hover {
  background: #1e9e4a;
  color: #fff;
  border-color: #1e9e4a;
}
.mc .mc-parts-bottom-load {
  background: #fff4e5;
  color: #8a5300;
  border-color: #ffd8a8;
}
.mc .mc-parts-bottom-load:hover {
  background: #ffb84d;
  color: #fff;
  border-color: #ffb84d;
}