/* ============================================================
   СТИЛИ ДЛЯ СТРАНИЦЫ КЛИЕНТОВ
   ============================================================ */

* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 20px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: #1a1a2e;
  min-height: 100vh;
  line-height: 1.45;
}
.cl-root { max-width: 1200px; margin: 0 auto; }

/* Шапка */
.cl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2c3e7a 100%);
  color: #fff;
  border-radius: 14px 14px 0 0;
  flex-wrap: wrap;
}
.cl-header h1 { margin: 0 0 4px; font-size: 1.4rem; }
.cl-sub { font-size: .85rem; opacity: .8; }
.cl-header-right { display: flex; gap: 8px; flex-wrap: wrap; }
.cl-nav-link {
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  text-decoration: none;
  transition: .15s;
}
.cl-nav-link:hover { background: #4361ee; border-color: #4361ee; }

/* Тулбар */
.cl-toolbar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e3e8f4;
  flex-wrap: wrap;
  align-items: center;
}
.cl-search-wrap { flex: 1 1 320px; position: relative; }
.cl-search {
  width: 100%;
  padding: 11px 40px 11px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .92rem;
  font-family: inherit;
  outline: none;
  transition: .15s;
}
.cl-search:focus { border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67,97,238,.12); }
.cl-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 6px;
}
.cl-search-clear:hover { background: #f4f6fb; color: #d9342b; }
.cl-sort {
  padding: 11px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .9rem;
  background: #fff;
  outline: none;
  font-family: inherit;
  cursor: pointer;
}
.cl-sort:focus { border-color: #4361ee; }
.cl-btn {
  padding: 11px 16px;
  font-size: .86rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cfd6e6;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  white-space: nowrap;
}
.cl-btn:hover { border-color: #4361ee; color: #4361ee; }
.cl-btn.primary { background: #4361ee; color: #fff; border-color: #4361ee; }
.cl-btn.primary:hover { background: #3450c9; border-color: #3450c9; color: #fff; }
.cl-btn.danger { color: #d9342b; border-color: #f0c0c0; }
.cl-btn.danger:hover { background: #ffebeb; border-color: #d9342b; }

/* Список */
.cl-list { background: #fff; border-radius: 0 0 14px 14px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.06); }
.cl-empty {
  padding: 60px 20px;
  text-align: center;
  color: #888;
  font-size: .95rem;
}
.cl-empty-icon { font-size: 3rem; margin-bottom: 10px; }

.cl-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid #eef1f8;
  cursor: pointer;
  transition: background .15s;
}
.cl-item:last-child { border-bottom: none; }
.cl-item:hover { background: #f4f7ff; }
.cl-item-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 2px;
}
.cl-item-meta {
  font-size: .78rem;
  color: #6a7792;
}
.cl-item-meta span { margin-right: 12px; }
.cl-item-sum {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a3bbf;
  white-space: nowrap;
}
.cl-item-actions { display: flex; gap: 6px; }
.cl-item-actions button {
  padding: 6px 12px;
  font-size: .74rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #cfd6e6;
  background: #fff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
}
.cl-item-actions button.danger { color: #d9342b; border-color: #f0c0c0; }
.cl-item-actions button:hover { background: #4361ee; color: #fff; border-color: #4361ee; }
.cl-item-actions button.danger:hover { background: #d9342b; border-color: #d9342b; color: #fff; }

/* Пагинация */
.cl-pager {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  background: #fafbff;
  border-top: 1px solid #e3e8f4;
}
.cl-pager button {
  min-width: 36px;
  padding: 8px 12px;
  border: 1px solid #cfd6e6;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
}
.cl-pager button.active { background: #4361ee; color: #fff; border-color: #4361ee; }
.cl-pager button:disabled { opacity: .5; cursor: not-allowed; }

/* Модалка */
.cl-modal {
  position: fixed;
  inset: 0;
  background: rgba(15,20,50,.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}
.cl-modal.open { display: flex; }
.cl-modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  background: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.cl-modal-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2c3e7a 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cl-modal-title { font-weight: 700; font-size: 1rem; }
.cl-modal-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}
.cl-modal-close:hover { background: rgba(255,255,255,.3); }
.cl-modal-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.cl-modal-footer {
  padding: 14px 20px;
  background: #fafbff;
  border-top: 1px solid #e3e8f4;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.cl-modal-footer-right { display: flex; gap: 10px; }

.cl-form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.cl-form-row label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #777;
  letter-spacing: .3px;
}
.cl-form-row input,
.cl-form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .92rem;
  font-family: inherit;
  outline: none;
  transition: .15s;
}
.cl-form-row input:focus,
.cl-form-row textarea:focus { border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67,97,238,.1); }
.cl-form-row textarea { resize: vertical; min-height: 60px; }

.cl-form-parts-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 8px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #4361ee;
}
.cl-parts-count {
  background: #4361ee;
  color: #fff;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: .75rem;
}
.cl-form-parts {
  border: 1px solid #e3e8f4;
  border-radius: 8px;
  background: #fff;
  max-height: 320px;
  overflow-y: auto;
}
.cl-form-parts-empty { padding: 20px; text-align: center; color: #888; font-size: .85rem; }

.cl-part-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef1f8;
  align-items: center;
  font-size: .86rem;
}
.cl-part-row:last-child { border-bottom: none; }
.cl-part-name { font-weight: 600; color: #1a1a2e; }
.cl-part-meta { font-size: .74rem; color: #6a7792; }
.cl-part-sum {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 700;
  color: #1a3bbf;
  white-space: nowrap;
}
.cl-part-del {
  width: 26px; height: 26px;
  border: 1px solid #f0c0c0;
  background: #fff;
  color: #d9342b;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
}
.cl-part-del:hover { background: #ffebeb; }

/* ============================================================
   ОБЩИЕ СТИЛИ ДЛЯ МОДАЛОК
   ============================================================ */
.cl-modal-body .mc { margin: 0; padding: 0; box-shadow: none; max-width: 100%; }
.cl-modal-body .mc h2 { display: none; }
.cl-modal-body .mc .section { background: transparent; padding: 0; border: none; margin-bottom: 14px; }
.cl-modal-body .mc .section-title { color: #4361ee; }
.cl-modal-dialog { max-width: 1000px; }

/* ============================================================
   ПОЛЯ КЛИЕНТА
   ============================================================ */
.cl-client-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 10px;
  margin-bottom: 14px;
}
.cl-client-fields .cl-cf-wide { grid-column: span 2; }
.cl-client-fields > div { display: flex; flex-direction: column; gap: 4px; }
.cl-client-fields label {
  font-size: .72rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.cl-client-fields input {
  padding: 9px 11px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: .15s;
}
.cl-client-fields input:focus { border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67,97,238,.1); }

/* ============================================================
   БЛОК ЗАЯВОК
   ============================================================ */
.cl-orders-block {
  margin-top: 14px;
  border: 1px solid #dbe3f7;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.cl-orders-header {
  padding: 10px 14px;
  background: linear-gradient(180deg, #eef2ff 0%, #e6ecff 100%);
  border-bottom: 2px solid #4361ee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-orders-header-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cl-orders-count {
  background: #4361ee;
  color: #fff;
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 10px;
}
.cl-orders-add-btn {
  padding: 7px 14px;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.cl-orders-add-btn:hover { background: #3450c9; }
.cl-orders-body { padding: 10px 14px; }

.cl-order-card {
  margin-bottom: 12px;
  border: 1.5px solid #dbe3f7;
  border-radius: 10px;
  background: #fafbff;
  overflow: hidden;
  transition: .15s;
}
.cl-order-card:last-child { margin-bottom: 0; }
.cl-order-card.open { border-color: #4361ee; background: #fff; box-shadow: 0 4px 16px rgba(67,97,238,.1); }

.cl-order-head {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  background: linear-gradient(180deg,#f8faff 0%,#f2f5ff 100%);
  transition: .15s;
}
.cl-order-card.open .cl-order-head { background: linear-gradient(180deg,#eef2ff 0%,#e6ecff 100%); border-bottom: 1px solid #dbe3f7; }
.cl-order-head:hover { background: linear-gradient(180deg,#eef2ff 0%,#e6ecff 100%); }

.cl-order-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #4361ee;
  color: #fff;
  font-weight: 700;
  font-size: .78rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cl-order-info { flex: 1 1 auto; min-width: 0; }
.cl-order-title-text {
  font-size: .95rem;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.cl-order-meta {
  font-size: .74rem;
  color: #777;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.cl-order-meta b { color: #1a3bbf; font-weight: 700; }
.cl-order-sum {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #1a3bbf;
  font-size: 1rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.cl-order-chevron {
  padding: 6px 12px;
  border: 1px solid #d0d9ff;
  border-radius: 6px;
  background: #f4f7ff;
  color: #4361ee;
  font-weight: 700;
  font-size: .74rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: .15s;
}
.cl-order-chevron:hover { background: #4361ee; color: #fff; border-color: #4361ee; }
.cl-order-del {
  padding: 6px 10px;
  border: 1px solid #f0b4b4;
  border-radius: 6px;
  background: #ffebeb;
  color: #a02020;
  font-weight: 700;
  font-size: .8rem;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: .15s;
}
.cl-order-del:hover { background: #d9342b; color: #fff; border-color: #d9342b; }

.cl-order-body {
  padding: 14px;
  border-top: 1px dashed #dbe3f7;
  background: #fff;
}
.cl-order-title-edit {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.cl-order-title-edit label {
  font-size: .72rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
  flex-shrink: 0;
}
.cl-order-title-edit input {
  flex: 1 1 auto;
  padding: 9px 11px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: .15s;
  font-weight: 700;
  color: #1a1a2e;
}
.cl-order-title-edit input:focus { border-color: #4361ee; box-shadow: 0 0 0 3px rgba(67,97,238,.1); }

.cl-orders-empty {
  padding: 24px 14px;
  text-align: center;
  color: #888;
  font-size: .85rem;
  background: #f8faff;
  border: 1px dashed #cfd9f5;
  border-radius: 8px;
  margin-bottom: 12px;
}
.cl-orders-empty-icon { font-size: 2rem; margin-bottom: 8px; }

/* ============================================================
   СПИСОК ДЕТАЛЕЙ ВНУТРИ ЗАЯВКИ
   ============================================================ */
.mc-parts-list-wrap {
  background: #fff;
  border: 1px solid #dbe3f7;
  border-radius: 10px;
  overflow: hidden;
}

.mc-parts-list-header {
  padding: 10px 14px;
  background: linear-gradient(180deg, #f8faff 0%, #eef2ff 100%);
  border-bottom: 1px solid #dbe3f7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mc-parts-list-title {
  font-size: .82rem;
  font-weight: 700;
  color: #1a3bbf;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc-parts-list-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mc-parts-list-count {
  background: #4361ee;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
}
.mc-parts-toggle-btn {
  padding: 5px 12px;
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid #d0d9ff;
  border-radius: 6px;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc-parts-toggle-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

.mc-parts-list {
  padding: 10px 12px;
  background: #fafbff;
}
.mc-parts-list.collapsed { display: none; }

.mc-parts-empty {
  padding: 22px 14px;
  text-align: center;
  color: #888;
  font-size: .84rem;
  background: #fff;
  border: 1px dashed #d0d9ff;
  border-radius: 8px;
  line-height: 1.5;
}

.mc-part-card {
  background: #fff;
  border: 1px solid #dbe3f7;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: .15s;
}
.mc-part-card:last-child { margin-bottom: 0; }
.mc-part-card.open {
  border-color: #4361ee;
  box-shadow: 0 4px 14px rgba(67,97,238,.08);
}

.mc-part-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: #fff;
  cursor: pointer;
  transition: background .15s;
}
.mc-part-head:hover { background: #f8faff; }
.mc-part-card.open .mc-part-head {
  background: linear-gradient(180deg, #eef2ff 0%, #e6ecff 100%);
  border-bottom: 1px solid #dbe3f7;
}

.mc-part-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #4361ee;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .74rem;
  font-weight: 700;
}

.mc-part-line {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .86rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}
.mc-part-line-name {
  font-weight: 700;
  color: #1a1a2e;
}
.mc-part-line-meta {
  color: #666;
  font-size: .82rem;
}
.mc-part-line-price {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #1a3bbf;
  white-space: nowrap;
}
.mc-part-line-bend {
  display: inline-block;
  padding: 1px 6px;
  background: #fff4e5;
  border-radius: 4px;
  color: #8a5300;
  font-size: .72rem;
  font-weight: 700;
}
.mc-part-line-formula {
  color: #888;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-part-chevron {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: .74rem;
  font-weight: 700;
  border: 1px solid #d0d9ff;
  border-radius: 6px;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  white-space: nowrap;
}
.mc-part-chevron:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

.mc-part-body {
  padding: 14px;
  background: #fff;
  border-top: 1px dashed #e3e8f4;
}

.mc-part-prokat {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #f4f7ff;
  border-left: 3px solid #4361ee;
  border-radius: 6px;
  font-size: .82rem;
}
.mc-part-prokat-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.mc-part-prokat-label { color: #666; }
.mc-part-prokat-value { color: #1a3bbf; font-weight: 700; }
.mc-part-prokat-note { color: #888; font-size: .76rem; }

.mc-part-chain {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #f8faff;
  border: 1px solid #dbe3f7;
  border-radius: 8px;
}
.mc-part-chain-label {
  font-size: .74rem;
  font-weight: 700;
  color: #1a3bbf;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 8px;
}
.mc-part-chain-table {
  overflow-x: auto;
  margin-bottom: 10px;
}
.mc-part-chain-tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
}
.mc-part-chain-tbl th {
  padding: 6px 4px;
  background: #eef2ff;
  color: #1a3bbf;
  font-weight: 700;
  font-size: .68rem;
  text-align: center;
  border: 1px solid #dbe3f7;
  white-space: nowrap;
}
.mc-part-chain-tbl th .unit {
  display: block;
  font-size: .62rem;
  font-weight: 500;
  color: #7a89b3;
  text-transform: none;
}
.mc-part-chain-tbl td {
  padding: 8px 4px;
  text-align: center;
  border: 1px solid #eef1f8;
  background: #fff;
  white-space: nowrap;
}
.mc-part-chain-tbl td.op {
  background: #f8f9fc;
  color: #a0a8be;
  font-weight: 700;
}
.mc-part-chain-tbl td.hl {
  background: linear-gradient(135deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
  font-weight: 800;
}
.mc-part-chain-tbl th.hl-head {
  background: linear-gradient(180deg, #dbe7ff 0%, #c7d8ff 100%);
  color: #1a3bbf;
}

.mc-part-chain-copy,
.mc-part-short-copy {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 8px;
}
.mc-part-chain-text,
.mc-part-short-text {
  flex: 1 1 auto;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #dbe3f7;
  border-radius: 6px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .78rem;
  color: #1a1a2e;
  word-break: break-word;
  line-height: 1.5;
}
.mc-part-chain-btn,
.mc-part-short-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #d0d9ff;
  border-radius: 6px;
  background: #f4f7ff;
  color: #4361ee;
  font-size: .82rem;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc-part-chain-btn:hover,
.mc-part-short-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.mc-part-chain-btn.copied,
.mc-part-short-btn.copied {
  background: #1e9e4a;
  color: #fff;
  border-color: #1e9e4a;
}
.mc-part-short-label {
  font-size: .74rem;
  font-weight: 700;
  color: #1a3bbf;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin: 8px 0 4px;
}

.mc-part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.mc-part-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mc-part-field label {
  font-size: .72rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mc-part-field input {
  padding: 8px 11px;
  border: 1.5px solid #e0e0e0;
  border-radius: 7px;
  font-size: .86rem;
  font-family: inherit;
  outline: none;
  background: #fff;
}
.mc-part-field input[readonly] {
  background: #f8faff;
  color: #1a3bbf;
  font-weight: 700;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  cursor: default;
}

.mc-part-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed #e3e8f4;
}
.mc-part-actions button {
  flex: 1 1 calc(33% - 6px);
  min-width: 130px;
  padding: 9px 14px;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.mc-part-apply { background: #f4f7ff; color: #4361ee; border-color: #d0d9ff; }
.mc-part-apply:hover { background: #4361ee; color: #fff; border-color: #4361ee; }
.mc-part-print { background: #fff4e5; color: #8a5300; border-color: #ffd8a8; }
.mc-part-print:hover { background: #ffb84d; color: #fff; border-color: #ffb84d; }
.mc-part-delete { background: #ffebeb; color: #a02020; border-color: #f0b4b4; }
.mc-part-delete:hover { background: #d9342b; color: #fff; border-color: #d9342b; }

.mc-parts-totals {
  padding: 10px 14px;
  background: #f8faff;
  border-top: 1px solid #dbe3f7;
  border-bottom: 1px solid #dbe3f7;
}
.mc-parts-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
  font-size: .88rem;
}
.mc-parts-total-row > span:first-child { color: #555; }
.mc-parts-total-row > span:last-child {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
}
.mc-parts-total-row.highlight {
  padding: 10px 0;
  margin-top: 4px;
  border-top: 2px solid #4361ee;
  font-size: 1rem;
  font-weight: 800;
}
.mc-parts-total-row.highlight > span:first-child { color: #1a1a2e; }
.mc-parts-total-row.highlight > span:last-child { font-size: 1.15rem; color: #1a3bbf; }
.mc-parts-tpz {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  background: #fff4e5;
  border: 1.5px solid #ffd8a8;
  border-left: 4px solid #ffb84d;
  border-radius: 6px;
  font-size: .88rem;
  color: #8a5300;
}
.mc-parts-tpz > span:last-child {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #8a5300;
  white-space: nowrap;
}

.mc-parts-add-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 12px;
  padding: 11px 16px;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: .15s;
}
.mc-parts-add-btn:hover { background: #3450c9; }

/* ============================================================
   БЛОК «МИН. 1 КГ» — пояснение в заявке
   ============================================================ */
.mc-min-weight-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #ffebeb;
  border: 1.5px solid #f0b4b4;
  border-left: 4px solid #d9342b;
  border-radius: 8px;
  font-size: .85rem;
  color: #7a1f1a;
  line-height: 1.45;
}
.mc-min-weight-icon {
  flex: 0 0 auto;
  font-size: 1.15rem;
  line-height: 1.2;
}
.mc-min-weight-text { flex: 1 1 auto; }
.mc-min-weight-text b { color: #a02020; }

/* ============================================================
   КНОПКИ ВНИЗУ МОДАЛКИ
   ============================================================ */
.cl-table-actions {
  display: flex;
  gap: 8px;
  padding: 12px 0 0;
  border-top: 1px dashed #e3e8f4;
  margin-top: 14px;
  flex-wrap: wrap;
}
.cl-table-actions button {
  flex: 1 1 calc(25% - 6px);
  min-width: 150px;
  padding: 11px 14px;
  font-size: .84rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
  white-space: nowrap;
}
.cl-table-actions .cl-tb-download { background: #f4f7ff; color: #4361ee; border-color: #d0d9ff; }
.cl-table-actions .cl-tb-download:hover { background: #4361ee; color: #fff; border-color: #4361ee; }
.cl-table-actions .cl-tb-save { background: #e8f5e9; color: #1e6e35; border-color: #b8e2c4; }
.cl-table-actions .cl-tb-save:hover { background: #1e9e4a; color: #fff; border-color: #1e9e4a; }
.cl-table-actions .cl-tb-load { background: #fff4e5; color: #8a5300; border-color: #ffd8a8; }
.cl-table-actions .cl-tb-load:hover { background: #ffb84d; color: #fff; border-color: #ffb84d; }
.cl-table-actions .cl-tb-preview { background: #f4f7ff; color: #4361ee; border-color: #d0d9ff; }
.cl-table-actions .cl-tb-preview:hover { background: #4361ee; color: #fff; border-color: #4361ee; }

/* ============================================================
   ДОПОЛНИТЕЛЬНЫЕ БЛОКИ
   ============================================================ */
.cl-extra-block {
  margin-top: 14px;
  border: 1px solid #dbe3f7;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.cl-extra-block-header {
  padding: 10px 14px;
  background: linear-gradient(180deg, #eef2ff 0%, #e6ecff 100%);
  border-bottom: 2px solid #4361ee;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cl-extra-block-header .cl-extra-count {
  background: #4361ee;
  color: #fff;
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 10px;
}
.cl-extra-block-body { padding: 10px 14px; }

.cl-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #eef1f8;
  font-size: .92rem;
  flex-wrap: wrap;
}
.cl-title-row:last-child { border-bottom: none; }
.cl-title-row-text {
  color: #1a1a2e;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .88rem;
  flex: 1 1 auto;
  min-width: 0;
}
.cl-title-row-tpz {
  background: #fff4e5;
  color: #8a5300;
  border: 1px solid #ffd8a8;
  font-size: .7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
  letter-spacing: .3px;
  white-space: nowrap;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
}
.cl-title-row-sum {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #1a3bbf;
  font-size: 1rem;
  white-space: nowrap;
}
.cl-extra-empty {
  padding: 14px;
  text-align: center;
  color: #888;
  font-size: .82rem;
}

.cl-drawing-group {
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #fafbff;
  border-left: 3px solid #4361ee;
  border-radius: 6px;
}
.cl-drawing-group:last-child { margin-bottom: 0; }
.cl-drawing-group-header {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .92rem;
  font-weight: 800;
  color: #1a3bbf;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #dbe3f7;
}
.cl-drawing-part-item {
  margin-bottom: 10px;
  padding-left: 6px;
}
.cl-drawing-part-item:last-child { margin-bottom: 0; }
.cl-drawing-part-name {
  font-size: .86rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 3px;
}
.cl-drawing-prices {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .82rem;
  color: #8a5300;
  font-weight: 700;
  margin-bottom: 3px;
  padding: 2px 8px;
  background: #fff9ef;
  border-left: 2px solid #ffb84d;
  border-radius: 3px;
  display: inline-block;
  letter-spacing: .3px;
}
.cl-drawing-bend-line {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .8rem;
  color: #8a5300;
  font-weight: 700;
  margin-bottom: 3px;
  padding: 2px 8px;
  background: #fff4e5;
  border-left: 2px solid #ffb84d;
  border-radius: 3px;
  display: inline-block;
}
.cl-drawing-line-1,
.cl-drawing-line-2 {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .86rem;
  line-height: 1.5;
}
.cl-drawing-line-1 { color: #1a1a2e; }
.cl-drawing-line-2 { color: #1a3bbf; font-weight: 700; }

/* ============================================================
   СВОДКА ПО МЕТАЛЛУ
   ============================================================ */
.cl-metal-summary-block {
  margin-top: 14px;
  border: 1.5px solid #dbe3f7;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.cl-metal-summary-header {
  padding: 9px 14px;
  background: linear-gradient(180deg, #eef2ff 0%, #dbe7ff 100%);
  border-bottom: 2px solid #4361ee;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cl-metal-summary-header .cl-ms-count {
  background: #4361ee;
  color: #fff;
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 10px;
}
.cl-metal-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .82rem;
}
.cl-metal-summary-table th {
  padding: 8px 10px;
  background: #f4f7ff;
  color: #1a3bbf;
  font-weight: 700;
  font-size: .72rem;
  text-align: left;
  border-bottom: 1px solid #dbe3f7;
  letter-spacing: .3px;
}
.cl-metal-summary-table th.num { text-align: right; }
.cl-metal-summary-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f8;
  color: #1a1a2e;
}
.cl-metal-summary-table td.num {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}
.cl-metal-summary-table tr:last-child td { border-bottom: none; }
.cl-metal-summary-table tr.total-row td {
  background: #eaf0ff;
  color: #1a3bbf;
  font-weight: 800;
  border-top: 2px solid #4361ee;
  padding: 10px;
  font-size: .9rem;
}
.cl-metal-summary-table .col-grade { width: 40%; }
.cl-metal-summary-table .col-qty { width: 15%; }
.cl-metal-summary-table .col-mass { width: 20%; }
.cl-metal-summary-table .col-cost { width: 25%; }

/* ============================================================
   ЧЕРТЁЖ ДЕТАЛИ
   ============================================================ */
.cl-part-drawing {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fafbff;
  border: 1px solid #dbe3f7;
  border-radius: 8px;
}
.cl-part-drawing-label {
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  margin-bottom: 10px;
}
.cl-part-drawing-empty {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cl-part-drawing-upload {
  padding: 9px 18px;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.cl-part-drawing-upload:hover { background: #3450c9; }
.cl-part-drawing-upload:disabled { opacity: .6; cursor: wait; }
.cl-part-drawing-hint {
  font-size: .75rem;
  color: #888;
}
.cl-part-drawing-preview {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.cl-part-drawing-preview img {
  max-width: 260px;
  max-height: 180px;
  border: 1px solid #dbe3f7;
  border-radius: 6px;
  cursor: zoom-in;
  background: #fff;
  object-fit: contain;
  transition: .15s;
  box-shadow: 0 2px 8px rgba(20,30,80,.06);
}
.cl-part-drawing-preview img:hover {
  box-shadow: 0 6px 18px rgba(20,30,80,.15);
  transform: translateY(-2px);
}
.cl-part-drawing-pdf {
  width: 140px;
  height: 130px;
  border: 1px dashed #b8c9ff;
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: #1a3bbf;
  font-size: .78rem;
  font-weight: 700;
  transition: .15s;
}
.cl-part-drawing-pdf:hover {
  background: #f4f7ff;
  border-style: solid;
}
.cl-part-drawing-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-width: 160px;
}
.cl-part-drawing-name {
  font-size: .78rem;
  color: #555;
  font-weight: 600;
  word-break: break-all;
  max-width: 240px;
  line-height: 1.3;
}
.cl-part-drawing-actions button {
  padding: 7px 14px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #d0d9ff;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  white-space: nowrap;
}
.cl-part-drawing-actions button:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.cl-part-drawing-actions button.danger {
  background: #ffebeb;
  color: #a02020;
  border-color: #f0b4b4;
}
.cl-part-drawing-actions button.danger:hover {
  background: #d9342b;
  color: #fff;
  border-color: #d9342b;
}

.cl-part-drawing-icon {
  display: inline-block;
  margin-left: 4px;
  padding: 0 3px;
  font-size: 1.05em;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s, filter .15s;
  vertical-align: middle;
  user-select: none;
}
.cl-part-drawing-icon:hover {
  transform: scale(1.35) rotate(-8deg);
  filter: drop-shadow(0 2px 4px rgba(67,97,238,.4));
}

/* ============================================================
   ПЛАВАЮЩЕЕ ПРЕВЬЮ ЧЕРТЕЖА
   ============================================================ */
.cl-drawing-hover {
  position: fixed;
  z-index: 99999;
  background: #fff;
  border: 3px solid #4361ee;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(20,30,80,.42);
  padding: 14px;
  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition: opacity .18s ease, transform .18s ease;
  max-width: min(960px, 94vw);
  max-height: min(720px, 88vh);
  display: none;
  pointer-events: none;
  cursor: default;
}
.cl-drawing-hover.show {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  cursor: zoom-in;
}
.cl-drawing-hover img {
  display: block;
  max-width: min(920px, 90vw);
  max-height: min(640px, 76vh);
  width: auto;
  height: auto;
  border-radius: 10px;
  background: #f8f9fc;
  object-fit: contain;
}
.cl-drawing-hover-pdf {
  width: 480px;
  max-width: 90vw;
  height: 340px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #1a3bbf;
  font-weight: 800;
  font-size: 1.3rem;
  background: #f4f7ff;
  border-radius: 10px;
}
.cl-drawing-hover-pdf .big-icon { font-size: 4.5rem; line-height: 1; }
.cl-drawing-hover-name {
  font-size: .92rem;
  color: #333;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e3e8f4;
  text-align: center;
  max-width: min(920px, 90vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.cl-drawing-hover-hint {
  position: absolute;
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: #4361ee;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  padding: 5px 16px;
  border-radius: 14px;
  white-space: nowrap;
  letter-spacing: .3px;
  box-shadow: 0 6px 16px rgba(67,97,238,.35);
  pointer-events: none;
}

/* ============================================================
   БЛОК ПРОВЕРКИ РЕНТАБЕЛЬНОСТИ
   ============================================================ */
.cl-profit-block {
  margin-top: 14px;
  border: 2px solid #dbe3f7;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.cl-profit-block.ok { border-color: #b8e2c4; }
.cl-profit-block.warn { border-color: #ffd8a8; }
.cl-profit-block.bad { border-color: #f0b4b4; }
.cl-profit-header {
  padding: 10px 14px;
  background: linear-gradient(180deg, #eef2ff 0%, #e6ecff 100%);
  border-bottom: 2px solid #4361ee;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cl-profit-block.ok .cl-profit-header { background: linear-gradient(180deg,#e8f5e9,#d9efdf); border-bottom-color: #1e9e4a; color: #1e6e35; }
.cl-profit-block.warn .cl-profit-header { background: linear-gradient(180deg,#fff8ec,#ffefd5); border-bottom-color: #ffb84d; color: #8a5300; }
.cl-profit-block.bad .cl-profit-header { background: linear-gradient(180deg,#ffebeb,#ffdede); border-bottom-color: #d9342b; color: #a02020; }
.cl-profit-status {
  font-size: .72rem;
  padding: 3px 10px;
  border-radius: 10px;
  background: #4361ee;
  color: #fff;
  font-weight: 700;
}
.cl-profit-block.ok .cl-profit-status { background: #1e9e4a; }
.cl-profit-block.warn .cl-profit-status { background: #ffb84d; }
.cl-profit-block.bad .cl-profit-status { background: #d9342b; }
.cl-profit-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.cl-profit-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: .9rem;
  padding: 4px 0;
  border-bottom: 1px dashed #eef1f8;
}
.cl-profit-row:last-child { border-bottom: none; }
.cl-profit-row .label { color: #555; }
.cl-profit-row .value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
}
.cl-profit-row.highlight {
  background: #f4f7ff;
  margin: 6px -14px;
  padding: 8px 14px;
  border-bottom: none;
  border-top: 1px solid #dbe3f7;
  border-bottom: 1px solid #dbe3f7;
  font-size: .95rem;
  font-weight: 700;
}
.cl-profit-row.highlight .value { font-size: 1.05rem; color: #1a3bbf; }
.cl-profit-row.positive .value { color: #1e6e35; }
.cl-profit-row.negative .value { color: #d9342b; }
.cl-profit-hint {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: .85rem;
  line-height: 1.5;
  background: #fff4e5;
  border-left: 4px solid #ffb84d;
  color: #6b4200;
}
.cl-profit-block.bad .cl-profit-hint { background: #ffebeb; border-left-color: #d9342b; color: #7a1f1a; }
.cl-profit-hint b { color: #1a3bbf; }
.cl-profit-hint code {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .88em;
}

/* --- Разбивка по металлу в блоке рентабельности --- */
.cl-profit-metal-breakdown {
  padding: 4px 0 8px;
  margin-bottom: 6px;
  border-bottom: 1px dashed #eef1f8;
}
.cl-profit-metal-group {
  padding: 4px 0;
  border-bottom: 1px dotted #eef1f8;
}
.cl-profit-metal-group:last-child {
  border-bottom: none;
}
.cl-profit-metal-group .cl-profit-row {
  padding: 2px 0;
  border-bottom: none;
}
.cl-profit-metal-group .cl-profit-row.sub {
  padding-left: 14px;
  font-size: .82rem;
}
.cl-profit-metal-group .cl-profit-row.sub .label {
  color: #7a89b3;
}
.cl-profit-metal-group .cl-profit-row.sub .value {
  color: #1a3bbf;
  font-weight: 700;
}

/* ============================================================
   СВОДКА ПО КЛИЕНТУ
   ============================================================ */
.cl-client-summary {
  margin-top: 14px;
  padding: 14px;
  background: linear-gradient(135deg, #eaf0ff 0%, #dde7ff 100%);
  border: 2px solid #4361ee;
  border-radius: 10px;
}
.cl-client-summary-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  margin-bottom: 8px;
}
.cl-client-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
  font-size: .92rem;
}
.cl-client-summary-row .label { color: #555; }
.cl-client-summary-row .value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 700;
  color: #1a1a2e;
  white-space: nowrap;
}
.cl-client-summary-row.highlight {
  border-top: 2px solid #4361ee;
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}
.cl-client-summary-row.highlight .value { font-size: 1.3rem; color: #1a3bbf; }

/* ============================================================
   ПЕРЕКЛЮЧАТЕЛЬ ОКРУГЛЕНИЯ
   ============================================================ */
.cl-round-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1.5px solid #d0d9ff;
  border-radius: 8px;
  background: #f4f7ff;
  font-size: .84rem;
  font-weight: 600;
  color: #4361ee;
  cursor: pointer;
  user-select: none;
  transition: .15s;
  white-space: nowrap;
}
.cl-round-toggle:hover {
  background: #e6ecff;
  border-color: #4361ee;
}
.cl-round-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4361ee;
  cursor: pointer;
  margin: 0;
}
.cl-round-toggle input[type="checkbox"]:checked + span {
  color: #1a3bbf;
}

.cl-round-toggle-modal {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 16px;
  background: #f0f5ff;
  border: 1.5px solid #d0d9ff;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  color: #1a3bbf;
  cursor: pointer;
  transition: .15s;
  width: 100%;
  box-sizing: border-box;
  white-space: normal;
}
.cl-round-toggle-modal:hover {
  background: #e6ecff;
  border-color: #4361ee;
}
.cl-round-toggle-modal input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #4361ee;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}
.cl-round-toggle-modal span {
  user-select: none;
}

/* ============================================================
   НАСЛЕДОВАНИЕ ОТ ПРЕДЫДУЩЕЙ ДЕТАЛИ
   ============================================================ */
.cl-inherit-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #fff9ef;
  border: 1.5px solid #ffd8a8;
  border-left: 4px solid #ffb84d;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  color: #6b4200;
  cursor: pointer;
  user-select: none;
}
.cl-inherit-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #ffb84d;
  cursor: pointer;
  margin: 0;
}

/* ============================================================
   ЧЕКБОКС ОКРУГЛЕНИЯ МАССЫ
   ============================================================ */
.mc-round-weight-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  background: #f0f5ff;
  border: 1.5px solid #d0d9ff;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 600;
  color: #1a3bbf;
  cursor: pointer;
  user-select: none;
}
.mc-round-weight-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4361ee;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}
.mc-round-weight-row .label-text {
  line-height: 1.3;
}

/* ============================================================
   АДАПТИВНОСТЬ (базовая)
   ============================================================ */
@media (max-width: 780px) {
  .cl-client-fields { grid-template-columns: 1fr 1fr; }
  .cl-client-fields .cl-cf-wide { grid-column: span 2; }
}
@media (max-width: 640px) {
  body { padding: 10px; }
  .cl-header { padding: 16px; }
  .cl-toolbar { padding: 12px; }
  .cl-search-wrap { flex: 1 1 100%; }
  .cl-btn { flex: 1 1 auto; }
  .cl-item { grid-template-columns: 1fr; gap: 8px; }
  .cl-item-actions { justify-content: flex-end; }
  .cl-client-fields { grid-template-columns: 1fr; }
  .cl-client-fields .cl-cf-wide { grid-column: span 1; }
  .cl-table-actions button { flex: 1 1 100%; }
  .cl-part-drawing-preview img { max-width: 100%; }
  .cl-part-drawing-actions { min-width: 0; }
  .cl-drawing-hover { max-width: 96vw; max-height: 84vh; padding: 10px; }
  .cl-drawing-hover img { max-width: 92vw; max-height: 70vh; }
  .cl-drawing-hover-pdf { width: 90vw; height: 60vh; }
  .cl-order-head { flex-wrap: wrap; }
  .mc-part-head { flex-wrap: wrap; }
  .mc-part-line-formula { display: none; }
  .mc-part-actions button { flex: 1 1 100%; min-width: 0; }
  .mc-part-chain-text,
  .mc-part-short-text { font-size: .72rem; }
  .cl-metal-summary-table { font-size: .72rem; }
}

/* ============================================================
   СТИЛИ ДЛЯ МОДАЛКИ РЕДАКТИРОВАНИЯ ДЕТАЛИ (mc-part-modal)
   ============================================================ */
.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,
.mc-part-modal-field select {
  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,
.mc-part-modal-field select:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.mc-part-modal-field input[readonly] {
  background: #f4f6fb;
  color: #555;
}

.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-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-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; }
}

/* ============================================================
   СТИЛИ ДЛЯ МОДАЛКИ ПРЕДПРОСМОТРА XLSX (clXlsxModal)
   ============================================================ */
.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; }
}

/* ============================================================
   СТАТУСЫ ЗАЯВОК
   ============================================================ */
.cl-order-status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: .15s;
  border: 1.5px solid;
  position: relative;
}
.cl-order-status:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
}

/* На уточнении — жёлтый */
.cl-order-status.status-clarification {
  background: #fff8e5;
  color: #8a5300;
  border-color: #ffd88a;
}
.cl-order-status.status-clarification:hover {
  background: #ffedbf;
}

/* На просчёте — сиреневый */
.cl-order-status.status-calculation {
  background: #f3e5f5;
  color: #6a1b9a;
  border-color: #ce93d8;
}
.cl-order-status.status-calculation:hover {
  background: #e1bee7;
}

/* Счёт отправлен — голубой */
.cl-order-status.status-invoice_sent {
  background: #e5f0ff;
  color: #1a4d8f;
  border-color: #8ab8ff;
}
.cl-order-status.status-invoice_sent:hover {
  background: #c9e0ff;
}

/* Оплачено/В работе — зелёный */
.cl-order-status.status-in_work {
  background: #e8f5e9;
  color: #1e6e35;
  border-color: #a8dbb5;
}
.cl-order-status.status-in_work:hover {
  background: #d0ebd6;
}

/* Выполнено — серый */
.cl-order-status.status-done {
  background: #f0f2f7;
  color: #4a5568;
  border-color: #c0c8d8;
}
.cl-order-status.status-done:hover {
  background: #e2e6ee;
}

/* Восклицательный знак — напоминание */
.cl-order-status.has-reminder {
  animation: clStatusPulse 2s ease-in-out infinite;
}
.cl-order-status .cl-status-reminder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d9342b;
  color: #fff;
  font-size: .7rem;
  font-weight: 900;
  margin-left: 2px;
  animation: clReminderShake 1.5s ease-in-out infinite;
}

@keyframes clStatusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,52,43,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(217,52,43,.1); }
}

@keyframes clReminderShake {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-12deg); }
  75%      { transform: rotate(12deg); }
}

/* Выпадающее меню выбора статуса */
.cl-status-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: #fff;
  border: 1.5px solid #dbe3f7;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20,30,80,.18);
  overflow: hidden;
  min-width: 200px;
  display: none;
}
.cl-status-menu.open { display: block; }
.cl-status-menu button {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: #fff;
  color: #1a1a2e;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: .12s;
  border-bottom: 1px solid #eef1f8;
}
.cl-status-menu button:last-child { border-bottom: none; }
.cl-status-menu button:hover {
  background: #f4f7ff;
  color: #4361ee;
}
.cl-status-menu button.active {
  background: #eef2ff;
  color: #1a3bbf;
}
.cl-status-menu button.active::after {
  content: '✓';
  float: right;
  color: #1e9e4a;
  font-weight: 800;
}

/* Кнопки «Позвонить / Написать» */
.cl-status-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 10px;
  background: #fff5f5;
  border: 1.5px solid #f0b4b4;
  border-left: 4px solid #d9342b;
  border-radius: 6px;
  flex-wrap: wrap;
}
.cl-status-actions-label {
  flex: 1 1 100%;
  font-size: .74rem;
  font-weight: 700;
  color: #a02020;
  margin-bottom: 2px;
}
.cl-status-actions a,
.cl-status-actions button {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 7px 12px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
.cl-status-actions .cl-action-call {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.cl-status-actions .cl-action-call:hover {
  background: #3450c9;
  border-color: #3450c9;
}
.cl-status-actions .cl-action-write {
  background: #fff;
  color: #4361ee;
  border-color: #4361ee;
}
.cl-status-actions .cl-action-write:hover {
  background: #4361ee;
  color: #fff;
}

@media (max-width: 780px) {
  .cl-order-head { flex-wrap: wrap; }
  .cl-order-status { order: -1; }
}

/* ============================================================
   СТАТУСЫ НА КАРТОЧКЕ КЛИЕНТА (стартовая страница)
   ============================================================ */

.cl-item {
  grid-template-columns: 1fr auto auto auto !important;
}

.cl-item-status-wrap {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Сумма с подписью работы / материала */
.cl-item-sum-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}
.cl-item-sum-sub {
  font-size: .72rem;
  color: #6a7792;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  white-space: nowrap;
}
.cl-item-sum-sub .cl-sum-label {
  color: #9aa4bd;
  font-weight: 500;
}

/* Основная плашка статуса клиента */
.cl-client-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  border: 1.5px solid;
  transition: .15s;
  cursor: pointer;
  user-select: none;
}
.cl-client-status:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,.12);
}

.cl-client-status.status-clarification {
  background: #fff8e5;
  color: #8a5300;
  border-color: #ffd88a;
}
.cl-client-status.status-clarification:hover {
  background: #ffedbf;
}
.cl-client-status.status-calculation {
  background: #f3e5f5;
  color: #6a1b9a;
  border-color: #ce93d8;
}
.cl-client-status.status-calculation:hover {
  background: #e1bee7;
}
.cl-client-status.status-invoice_sent {
  background: #e5f0ff;
  color: #1a4d8f;
  border-color: #8ab8ff;
}
.cl-client-status.status-invoice_sent:hover {
  background: #c9e0ff;
}
.cl-client-status.status-in_work {
  background: #e8f5e9;
  color: #1e6e35;
  border-color: #a8dbb5;
}
.cl-client-status.status-in_work:hover {
  background: #d0ebd6;
}
.cl-client-status.status-done {
  background: #f0f2f7;
  color: #4a5568;
  border-color: #c0c8d8;
}
.cl-client-status.status-done:hover {
  background: #e2e6ee;
}
.cl-client-status-empty {
  background: #f4f6fb;
  color: #999;
  border-color: #dde2ec;
  font-weight: 500;
  cursor: default;
}
.cl-client-status-empty:hover {
  transform: none;
  box-shadow: none;
}

/* Бейдж «+N» — сколько ещё заявок с другими статусами */
.cl-client-status-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  background: #eef2ff;
  color: #1a3bbf;
  border: 1.5px solid #c7d3f0;
  font-size: .7rem;
  font-weight: 800;
  cursor: help;
  white-space: nowrap;
}
.cl-client-status-more:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

/* Меню статуса на карточке клиента */
.cl-client-status-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 100;
  min-width: 220px;
}

/* ============================================================
   МОБИЛЬНАЯ ПАНЕЛЬ ДЕЙСТВИЙ (FAB)
   ============================================================ */
.cl-mobile-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  transition: transform .25s ease, opacity .25s ease;
}
.cl-mobile-fab.cl-fab-hidden { opacity: 0; pointer-events: none; transform: translateY(80px); }
.cl-mobile-fab.cl-fab-scrolling { transform: translateY(60px); opacity: .55; }
.cl-mobile-fab.cl-fab-scrolling .cl-fab-main { box-shadow: 0 4px 12px rgba(0,0,0,.18); }

.cl-fab-main {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #4361ee 0%, #2c3e7a 100%);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(67,97,238,.45);
  transition: transform .2s ease, box-shadow .2s ease, background .2s;
  font-family: inherit;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cl-fab-main:active { transform: scale(.94); }
.cl-mobile-fab.open .cl-fab-main {
  transform: rotate(45deg);
  background: linear-gradient(135deg, #d9342b 0%, #a02020 100%);
  box-shadow: 0 8px 24px rgba(217,52,43,.45);
}

.cl-fab-menu {
  display: none;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.cl-fab-menu.open { display: flex; }

.cl-fab-btn {
  padding: 10px 16px;
  border-radius: 24px;
  border: 1px solid #d0d9ff;
  background: #fff;
  color: #1a1a2e;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 20px rgba(20,30,80,.15);
  white-space: nowrap;
  transition: .15s;
  animation: clFabIn .2s ease both;
}
.cl-fab-btn:hover,
.cl-fab-btn:active {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

@keyframes clFabIn {
  from { opacity: 0; transform: translateY(8px) scale(.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   РАСШИРЕННАЯ МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 780px) {
  /* Показываем FAB */
  .cl-mobile-fab { display: flex; }

  /* Основные отступы */
  body { padding: 0; }
  .cl-root { padding: 0; }

  /* Шапка */
  .cl-header {
    padding: 14px 16px;
    border-radius: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .cl-header h1 { font-size: 1.15rem; }
  .cl-header-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .cl-nav-link {
    text-align: center;
    padding: 8px 10px;
    font-size: .78rem;
  }

  /* Тулбар */
  .cl-toolbar {
    padding: 12px;
    gap: 8px;
    border-radius: 0;
    flex-direction: column;
    align-items: stretch;
  }
  .cl-search-wrap { flex: 1 1 100%; width: 100%; }
  .cl-search { font-size: 16px; /* предотвращает зум на iOS */ }
  .cl-sort,
  .cl-btn {
    width: 100%;
    padding: 12px 14px;
    font-size: .9rem;
  }

  /* Список клиентов */
  .cl-list { border-radius: 0; }
  .cl-item {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "info"
      "status"
      "sum"
      "actions";
    padding: 14px 16px;
    gap: 10px;
  }
  .cl-item > div:first-child { grid-area: info; }
  .cl-item-status-wrap { grid-area: status; justify-content: flex-start; flex-wrap: wrap; }
  .cl-item-sum-wrap { grid-area: sum; align-items: flex-start; text-align: left; }
  .cl-item-sum { font-size: 1.15rem; }
  .cl-item-actions {
    grid-area: actions;
    justify-content: flex-end;
    gap: 8px;
  }
  .cl-item-actions button {
    padding: 8px 14px;
    font-size: .82rem;
  }

  /* Пагинация */
  .cl-pager { padding: 12px 8px; flex-wrap: wrap; }
  .cl-pager button { min-width: 40px; padding: 10px 12px; font-size: .85rem; }

  /* Модалка клиента */
  .cl-modal { padding: 0; align-items: stretch; }
  .cl-modal-dialog {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .cl-modal-header { padding: 14px 16px; }
  .cl-modal-body { padding: 14px 16px; }
  .cl-modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .cl-modal-footer-right {
    width: 100%;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .cl-modal-footer .cl-btn { width: 100%; padding: 12px 14px; }

  /* Поля клиента */
  .cl-client-fields { grid-template-columns: 1fr; }
  .cl-client-fields .cl-cf-wide { grid-column: span 1; }

  /* Действия с таблицей */
  .cl-table-actions {
    flex-direction: column;
    gap: 8px;
  }
  .cl-table-actions button {
    flex: 1 1 auto;
    width: 100%;
    padding: 12px 14px;
    min-width: 0;
  }

  /* Заявки */
  .cl-orders-header {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .cl-orders-add-btn {
    width: 100%;
    padding: 10px 14px;
  }
  .cl-orders-body { padding: 8px 10px; }
  .cl-order-head {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .cl-order-info { flex: 1 1 100%; }
  .cl-order-status { order: -1; }
  .cl-order-sum { font-size: .95rem; }
  .cl-order-chevron,
  .cl-order-del {
    flex: 1 1 auto;
    padding: 8px 10px;
  }

  /* Детали */
  .mc-parts-list-header { padding: 8px 12px; }
  .mc-part-head {
    grid-template-columns: 22px 1fr auto;
    padding: 10px 12px;
    gap: 6px;
  }
  .mc-part-line { font-size: .8rem; }
  .mc-part-line-formula { display: none; }
  .mc-part-line-price { font-size: .82rem; }
  .mc-part-chevron { padding: 4px 8px; font-size: .72rem; }

  /* Модалка детали */
  .mc-part-modal { padding: 0; align-items: stretch; }
  .mc-part-modal-dialog {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .mc-part-modal-body { padding: 14px 16px; }
  .mc-part-modal-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mc-part-modal-field-wide { grid-column: span 2; }
  .mc-part-modal-field input,
  .mc-part-modal-field select { font-size: 16px; /* без зума на iOS */ }
  .mc-part-modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
  }
  .mc-part-modal-footer button { width: 100%; padding: 12px 14px; }

  /* XLSX-модалка */
  .mc-xlsx-modal-header { padding: 10px 14px; flex-direction: column; align-items: stretch; gap: 8px; }
  .mc-xlsx-modal-actions { width: 100%; flex-direction: column; gap: 6px; }
  .mc-xlsx-modal-actions button { width: 100%; padding: 10px 14px; }
  .mc-xlsx-modal-body { padding: 10px; }

  /* Плавающее превью чертежа */
  .cl-drawing-hover { max-width: 96vw; max-height: 84vh; padding: 10px; }
  .cl-drawing-hover img { max-width: 92vw; max-height: 70vh; }
  .cl-drawing-hover-pdf { width: 90vw; height: 60vh; }

  /* Сводка по клиенту */
  .cl-client-summary { padding: 12px; }

  /* Сводки по металлу/работе */
  .cl-metal-summary-table { font-size: .72rem; }
  .cl-metal-summary-table th,
  .cl-metal-summary-table td { padding: 6px 7px; }

  /* Цепочка расчёта */
  .mc-part-chain-tbl { font-size: .7rem; min-width: 680px; }
  .mc-part-chain-tbl th { font-size: .58rem; }
  .mc-part-chain-tbl th .unit { font-size: .52rem; }
  .mc-part-chain-tbl td { font-size: .74rem; }
  .mc-part-chain-tbl td.hl { font-size: .85rem; }
  .mc-part-chain-text,
  .mc-part-short-text { font-size: .72rem; padding: 7px 9px; }
  .mc-part-chain-btn,
  .mc-part-short-btn { width: 36px; min-width: 36px; font-size: .95rem; }

  /* Действия детали */
  .mc-part-actions { gap: 6px; }
  .mc-part-actions button { flex: 1 1 100%; min-width: 0; padding: 10px 12px; font-size: .82rem; }

  /* Чертежи заявки */
  .cl-order-drawings-header {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .cl-order-drawings-add-btn { width: 100%; padding: 10px 14px; }
  .cl-order-drawings-body { padding: 10px; }
  .cl-order-drawings-dropzone { padding: 14px 12px; font-size: .78rem; }
  .cl-order-drawings-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Профит-блок */
  .cl-profit-body { padding: 10px 12px; }
  .cl-profit-row { font-size: .82rem; }
  .cl-profit-row.highlight { margin: 6px -12px; padding: 8px 12px; font-size: .88rem; }
  .cl-profit-row.highlight .value { font-size: .95rem; }
}

/* ============================================================
   БЛОК ЧЕРТЕЖЕЙ ЗАЯВКИ (галерея)
   ============================================================ */
.cl-order-drawings-block {
  margin-top: 14px;
  border: 1px solid #dbe3f7;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.cl-order-drawings-header {
  padding: 10px 14px;
  background: linear-gradient(180deg, #eef2ff 0%, #e6ecff 100%);
  border-bottom: 2px solid #4361ee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-order-drawings-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
}
.cl-order-drawings-count {
  background: #4361ee;
  color: #fff;
  font-size: .72rem;
  padding: 2px 10px;
  border-radius: 10px;
}
.cl-order-drawings-add-btn {
  padding: 7px 14px;
  background: #4361ee;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.cl-order-drawings-add-btn:hover { background: #3450c9; }
.cl-order-drawings-body { padding: 12px 14px; }
.cl-order-drawings-dropzone {
  padding: 16px 14px;
  margin-bottom: 12px;
  background: #f8faff;
  border: 2px dashed #b8c9ff;
  border-radius: 8px;
  text-align: center;
  color: #6a7792;
  font-size: .82rem;
  cursor: pointer;
  transition: .15s;
}
.cl-order-drawings-dropzone:hover,
.cl-order-drawings-dropzone.dragover {
  background: #eef2ff;
  border-color: #4361ee;
  color: #1a3bbf;
}
.cl-order-drawings-empty {
  padding: 14px;
  text-align: center;
  color: #888;
  font-size: .82rem;
}
.cl-order-drawings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.cl-order-drawing-item {
  background: #fff;
  border: 1px solid #dbe3f7;
  border-radius: 8px;
  overflow: hidden;
  transition: .15s;
}
.cl-order-drawing-item:hover {
  border-color: #4361ee;
  box-shadow: 0 4px 14px rgba(67,97,238,.12);
}
.cl-order-drawing-preview {
  height: 120px;
  background: #f4f7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  overflow: hidden;
}
.cl-order-drawing-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.cl-order-drawing-preview.pdf {
  background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
  color: #6a1b9a;
  font-weight: 700;
  font-size: .8rem;
  flex-direction: column;
  gap: 4px;
}
.cl-order-drawing-preview.pdf .big-icon { font-size: 2rem; }
.cl-order-drawing-info {
  padding: 8px 10px;
}
.cl-order-drawing-name {
  font-size: .78rem;
  font-weight: 600;
  color: #1a1a2e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.cl-order-drawing-meta {
  font-size: .7rem;
  color: #888;
  margin-bottom: 6px;
}
.cl-order-drawing-actions {
  display: flex;
  gap: 4px;
}
.cl-order-drawing-actions button {
  flex: 1 1 auto;
  padding: 5px 8px;
  font-size: .72rem;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid #d0d9ff;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.cl-order-drawing-actions button:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.cl-order-drawing-actions button.danger {
  background: #ffebeb;
  color: #a02020;
  border-color: #f0b4b4;
}
.cl-order-drawing-actions button.danger:hover {
  background: #d9342b;
  color: #fff;
  border-color: #d9342b;
}
.cl-order-drawings-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 6px;
  background: #f4f7ff;
  color: #4361ee;
  border: 1px solid #d0d9ff;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.cl-order-drawings-badge:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.cl-order-drawings-badge.empty {
  opacity: .5;
}
.cl-order-drawings-badge.empty:hover {
  opacity: 1;
}

/* ============================================================
   ОЧЕНЬ УЗКИЕ ЭКРАНЫ (< 480px)
   ============================================================ */
@media (max-width: 480px) {
  .cl-header h1 { font-size: 1.05rem; }
  .cl-sub { font-size: .72rem; }
  .cl-nav-link { font-size: .72rem; padding: 7px 8px; }

  .cl-item { padding: 12px 14px; }
  .cl-item-name { font-size: .92rem; }
  .cl-item-meta { font-size: .72rem; }

  .cl-fab-main { width: 52px; height: 52px; font-size: 1.4rem; }
  .cl-fab-btn { font-size: .78rem; padding: 9px 14px; }

  .mc-part-modal-grid { grid-template-columns: 1fr; }
  .mc-part-modal-field-wide { grid-column: span 1; }

  .cl-order-drawings-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   ГОРИЗОНТАЛЬНАЯ ОРИЕНТАЦИЯ НА ТЕЛЕФОНЕ
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .cl-modal-dialog,
  .mc-part-modal-dialog {
    max-height: 100vh;
    height: 100vh;
  }
  .cl-modal-body,
  .mc-part-modal-body {
    padding: 10px 14px;
  }
}

/* ============================================================
   ИКОНКА КАЛЬКУЛЯТОРА ВОЗЛЕ ПОЛЯ
   ============================================================ */
.mc-input-with-icon {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.mc-input-with-icon input {
  flex: 1 1 auto;
  min-width: 0;
}
.mc-calc-icon-btn {
  flex: 0 0 auto;
  width: 38px;
  border: 1.5px solid #d0d9ff;
  border-radius: 8px;
  background: #f4f7ff;
  color: #4361ee;
  font-size: 1.05rem;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.mc-calc-icon-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(67,97,238,.25);
}
.mc-calc-icon-btn:active { transform: translateY(0); }

/* ============================================================
   МОДАЛКА КАЛЬКУЛЯТОРА ДЛИНЫ РЕЗА
   (перетаскиваемая, компактная, единый список строк)
   ============================================================ */
.cut-calc-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  display: none;
}
.cut-calc-modal.open {
  display: block;
  pointer-events: auto;
}

.cut-calc-dialog {
  position: fixed;
  width: 340px;
  max-width: 96vw;
  max-height: 82vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 15px 40px rgba(15,20,50,.45), 0 0 0 1px rgba(67,97,238,.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  left: 16px;
  top: 80px;
}

/* Шапка — за неё тащим */
.cut-calc-header {
  padding: 8px 12px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2c3e7a 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}
.cut-calc-title {
  font-size: .82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cut-calc-close {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: none;
  background: rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: .15s;
}
.cut-calc-close:hover { background: rgba(255,255,255,.3); }

/* Панель «Добавить элемент» */
.cut-calc-toolbar {
  padding: 6px 8px;
  background: #f4f7ff;
  border-bottom: 1px solid #e3e8f4;
  flex-shrink: 0;
}
.cut-calc-add-big {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1.5px dashed #a9baff;
  background: #fff;
  color: #1a3bbf;
  border-radius: 6px;
  font-family: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: .15s;
}
.cut-calc-add-big:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
  border-style: solid;
}
.cut-calc-add-big .plus { font-size: 1rem; font-weight: 800; }
.cut-calc-add-big .lbl  { font-size: .74rem; }

/* Выпадающее меню типов (создаётся в JS, привязано к body) */
.cut-calc-menu {
  position: fixed;
  z-index: 100001;
  background: #fff;
  border: 1.5px solid #dbe3f7;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(20,30,80,.22);
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  animation: cutCalcMenuIn .12s ease-out;
}
.cut-calc-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: none;
  background: #fff;
  color: #1a1a2e;
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  text-align: left;
  border-radius: 5px;
  cursor: pointer;
  transition: .12s;
}
.cut-calc-menu button:hover {
  background: #eef2ff;
  color: #1a3bbf;
}
.cut-calc-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #4361ee;
  color: #fff;
  font-size: .7rem;
  flex-shrink: 0;
}

@keyframes cutCalcMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Тело со списком */
.cut-calc-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 8px;
  background: #f8faff;
}
.cut-calc-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Строка элемента */
.cut-calc-row {
  background: #fff;
  border: 1px solid #e3e8f4;
  border-radius: 6px;
  overflow: hidden;
  transition: .15s;
}
.cut-calc-row.open { border-color: #4361ee; }

.cut-calc-row-head {
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  background: #fff;
  user-select: none;
  transition: background .15s;
}
.cut-calc-row-head:hover { background: #f4f7ff; }
.cut-calc-row.open .cut-calc-row-head {
  background: linear-gradient(180deg, #eef2ff 0%, #e6ecff 100%);
  border-bottom: 1px solid #dbe3f7;
}
.cut-calc-num {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #4361ee;
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cut-calc-summary {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cut-calc-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #eef2ff;
  color: #4361ee;
  font-size: .68rem;
  flex-shrink: 0;
}
.cut-calc-summary-name { font-weight: 700; }
.cut-calc-summary-meta { color: #6a7792; font-size: .66rem; }
.cut-calc-summary-res {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #1a3bbf;
  margin-left: auto;
  font-size: .72rem;
}
.cut-calc-toggle {
  flex-shrink: 0;
  padding: 1px 6px;
  font-size: .6rem;
  font-weight: 700;
  border: 1px solid #d0d9ff;
  border-radius: 4px;
  background: #f4f7ff;
  color: #4361ee;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}
.cut-calc-toggle:hover { background: #4361ee; color: #fff; border-color: #4361ee; }
.cut-calc-del {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #f0c0c0;
  background: #fff;
  color: #d9342b;
  cursor: pointer;
  font-family: inherit;
  font-size: .68rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .15s;
}
.cut-calc-del:hover { background: #d9342b; color: #fff; border-color: #d9342b; }

.cut-calc-row-body {
  display: none;
  padding: 6px;
  background: #fff;
  border-top: 1px dashed #e3e8f4;
}
.cut-calc-row.open .cut-calc-row-body { display: block; }

.cut-calc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.cut-calc-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cut-calc-field-wide { grid-column: 1 / -1; }
.cut-calc-field label {
  font-size: .58rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #777;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cut-calc-field input,
.cut-calc-field select {
  width: 100%;
  padding: 4px 6px;
  border: 1.5px solid #e0e0e0;
  border-radius: 5px;
  font-size: .74rem;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  outline: none;
  background: #fff;
  color: #1a1a2e;
  transition: .15s;
}
.cut-calc-field select { font-family: inherit; }
.cut-calc-field input:focus,
.cut-calc-field select:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 2px rgba(67,97,238,.12);
}

.cut-calc-row-res {
  margin-top: 5px;
  padding: 4px 6px;
  background: linear-gradient(135deg, #eaf0ff 0%, #dde7ff 100%);
  border-left: 3px solid #4361ee;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: .7rem;
}
.cut-calc-row-res .label { color: #555; }
.cut-calc-row-res .value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #1a3bbf;
  white-space: nowrap;
}

.cut-calc-empty {
  padding: 10px 8px;
  text-align: center;
  color: #888;
  font-size: .7rem;
  background: #fff;
  border: 1px dashed #cfd9f5;
  border-radius: 6px;
  line-height: 1.4;
}

/* Футер */
.cut-calc-footer {
  padding: 8px 10px;
  background: #fff;
  border-top: 1px solid #e3e8f4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cut-calc-total {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cut-calc-total-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #777;
}
.cut-calc-total-value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .9rem;
  font-weight: 800;
  color: #1a3bbf;
  white-space: nowrap;
}
.cut-calc-footer-actions {
  display: flex;
  gap: 5px;
}
.cut-calc-btn {
  padding: 6px 10px;
  font-size: .74rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
  white-space: nowrap;
}
.cut-calc-btn-clear {
  background: #fff;
  color: #d9342b;
  border-color: #f0c0c0;
}
.cut-calc-btn-clear:hover { background: #d9342b; color: #fff; border-color: #d9342b; }
.cut-calc-btn-apply {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.cut-calc-btn-apply:hover { background: #3450c9; border-color: #3450c9; }

/* Мобильный адаптив */
@media (max-width: 780px) {
  .cut-calc-dialog {
    width: 94vw;
    max-height: 80vh;
    left: 3vw !important;
    top: 60px !important;
  }
}

/* ============================================================
   МОДАЛКА РАСКЛАДКИ ЗАГОТОВОК (NESTING)
   ============================================================ */
.nesting-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 50, .7);
  z-index: 100001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.nesting-modal.open { display: flex; }

.nesting-modal-dialog {
  width: 100%;
  max-width: 560px;
  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;
}
.nesting-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;
}
.nesting-modal-title {
  font-size: 1rem;
  font-weight: 700;
}
.nesting-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;
}
.nesting-modal-close:hover { background: rgba(255,255,255,.3); }

.nesting-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}

.nesting-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.nesting-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nesting-field label {
  font-size: .7rem;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.nesting-field input,
.nesting-field select {
  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;
}
.nesting-field input:focus,
.nesting-field select:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}
.nesting-field input[readonly] {
  background: #f4f6fb;
  color: #555;
}
.nesting-field select { font-family: inherit; }

.nesting-gap-auto {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 600;
  color: #4361ee;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.nesting-gap-auto input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #4361ee;
  margin: 0;
  cursor: pointer;
}

.nesting-gap-hint {
  padding: 8px 12px;
  background: #eef2ff;
  border-left: 3px solid #4361ee;
  border-radius: 6px;
  font-size: .76rem;
  color: #1a3bbf;
  margin-bottom: 14px;
  line-height: 1.4;
}

.nesting-result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  background: linear-gradient(135deg, #eaf0ff 0%, #dde7ff 100%);
  border: 1.5px solid #4361ee;
  border-radius: 10px;
}
.nesting-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #dbe3f7;
}
.nesting-result-item .label {
  font-size: .66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #7a89b3;
}
.nesting-result-item .value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: .95rem;
  font-weight: 800;
  color: #1a3bbf;
  white-space: nowrap;
}

.nesting-schema {
  padding: 14px;
  background: #f8faff;
  border: 1px solid #dbe3f7;
  border-radius: 10px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.nesting-schema-empty {
  color: #888;
  font-size: .82rem;
}
.nesting-schema-grid {
  display: grid;
  gap: 2px;
  justify-content: center;
}
.nesting-schema-cell {
  background: linear-gradient(135deg, #dbe7ff 0%, #c7d8ff 100%);
  border: 1px solid #4361ee;
  border-radius: 2px;
}
.nesting-schema-caption {
  font-size: .78rem;
  color: #1a3bbf;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
}

.nesting-modal-footer {
  padding: 14px 20px;
  background: #fafbff;
  border-top: 1px solid #e3e8f4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.nesting-footer-right {
  display: flex;
  gap: 10px;
}
.nesting-btn {
  padding: 10px 18px;
  font-size: .86rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  border: 1px solid;
}
.nesting-btn-clear {
  background: #ffebeb;
  color: #a02020;
  border-color: #f0b4b4;
}
.nesting-btn-clear:hover {
  background: #d9342b;
  color: #fff;
  border-color: #d9342b;
}
.nesting-btn-cancel {
  background: #fff;
  color: #555;
  border-color: #cfd6e6;
}
.nesting-btn-cancel:hover {
  background: #f4f6fb;
  border-color: #4361ee;
  color: #4361ee;
}
.nesting-btn-save {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}
.nesting-btn-save:hover {
  background: #3450c9;
  border-color: #3450c9;
}

/* Кнопка «Открыть раскладку» в модалке детали */
.mc-part-modal-nesting-btn {
  width: 100%;
  padding: 11px 16px;
  background: linear-gradient(135deg, #eef2ff 0%, #dbe7ff 100%);
  color: #1a3bbf;
  border: 1.5px solid #b8c9ff;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mc-part-modal-nesting-btn:hover {
  background: #4361ee;
  color: #fff;
  border-color: #4361ee;
}

@media (max-width: 640px) {
  .nesting-modal { padding: 0; align-items: stretch; }
  .nesting-modal-dialog {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .nesting-row { grid-template-columns: 1fr; }
  .nesting-modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .nesting-footer-right {
    width: 100%;
    flex-direction: column-reverse;
  }
  .nesting-btn { width: 100%; padding: 12px 14px; }
}

/* ============================================================
   БЛОК «ГАБАРИТЫ ЗАЯВКИ (BOUNDING BOX)»
   ============================================================ */
.cl-bbox-block {
  margin-top: 14px;
  border: 1.5px solid #dbe3f7;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.cl-bbox-header {
  padding: 9px 14px;
  background: linear-gradient(180deg, #eef2ff 0%, #dbe7ff 100%);
  border-bottom: 2px solid #4361ee;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.cl-bbox-count {
  background: #4361ee;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
}
.cl-bbox-body {
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cl-bbox-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 10px;
  background: #f8faff;
  border-radius: 6px;
  border-left: 3px solid #b8c9ff;
}
.cl-bbox-row.highlight {
  background: linear-gradient(135deg, #eaf0ff 0%, #dde7ff 100%);
  border-left-color: #4361ee;
  border: 1.5px solid #4361ee;
  padding: 8px 10px;
}
.cl-bbox-row.highlight .cl-bbox-label {
  color: #1a1a2e;
  font-weight: 700;
}
.cl-bbox-row.highlight .cl-bbox-value {
  color: #1a3bbf;
  font-size: 1.05rem;
}
.cl-bbox-label {
  font-size: .78rem;
  color: #555;
  font-weight: 500;
}
.cl-bbox-value {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #1a1a2e;
  font-size: .95rem;
  white-space: nowrap;
}
.cl-bbox-hint {
  font-size: .7rem;
  color: #7a89b3;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  margin: -2px 0 4px 12px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .cl-bbox-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .cl-bbox-value { font-size: .9rem; }
  .cl-bbox-row.highlight .cl-bbox-value { font-size: 1rem; }
}

/* ============================================================
   БЛОК «📄 ЛИСТЫ ЗАЯВКИ»
   ============================================================ */
.cl-sheets-block {
  margin-top: 14px;
  border: 1.5px solid #dbe3f7;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.cl-sheets-header {
  padding: 9px 14px;
  background: linear-gradient(180deg, #eef2ff 0%, #dbe7ff 100%);
  border-bottom: 2px solid #4361ee;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1a3bbf;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-sheets-total {
  background: #4361ee;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 10px;
  white-space: nowrap;
}
.cl-sheets-body {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-group {
  border: 1px solid #dbe3f7;
  border-radius: 8px;
  background: #f8faff;
  overflow: hidden;
}
.sheet-group-header {
  padding: 8px 12px;
  background: linear-gradient(180deg, #f4f7ff 0%, #e8efff 100%);
  border-bottom: 1px solid #dbe3f7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sheet-group-title {
  font-size: .82rem;
  color: #1a1a2e;
}
.sheet-group-title b { color: #1a3bbf; }
.sheet-group-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sheet-badge {
  background: #eef2ff;
  color: #1a3bbf;
  border: 1px solid #b8c9ff;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.sheet-badge-sheets {
  background: #e0ecff;
}
.sheet-badge-mass {
  background: #e8f5e9;
  color: #1e6e35;
  border-color: #b8e2c4;
}

.sheet-group-body {
  padding: 10px 12px 12px;
}
.sheet-group-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.sheet-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #dbe3f7;
}
.sheet-stat .lbl {
  font-size: .64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #7a89b3;
}
.sheet-stat .val {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 800;
  color: #1a3bbf;
  font-size: .9rem;
  white-space: nowrap;
}

.sheet-svg-wrap {
  padding: 10px;
  background: #fff;
  border: 1px solid #dbe3f7;
  border-radius: 8px;
  text-align: center;
  overflow-x: auto;
}
.sheet-svg {
  display: block;
  margin: 0 auto 8px;
  background: #fff;
  border-radius: 3px;
  max-width: 100%;
  height: auto;
}
.sheet-svg-caption {
  font-size: .72rem;
  color: #555;
  line-height: 1.5;
  text-align: center;
}
.sheet-svg-caption b {
  color: #1a3bbf;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
}
.sheet-svg-empty {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: .82rem;
}

@media (max-width: 640px) {
  .sheet-group-header { flex-direction: column; align-items: flex-start; }
  .sheet-group-stats { grid-template-columns: 1fr 1fr; }
  .sheet-svg { max-width: 100%; }
}