:root {
      --bg: #0f172a;
      --panel: #111827;
      --card: #ffffff;
      --muted: #64748b;
      --line: #e2e8f0;
      --accent: #2563eb;
      --accent-2: #1d4ed8;
      --ok: #0f766e;
    }
    html, body { height:auto; min-height:0; }
    * { box-sizing: border-box; }
    body { margin:0; font-family: Inter, Arial, sans-serif; background:#f8fafc; color:#0f172a; }
    .hero { background: linear-gradient(135deg, var(--bg), #1e293b); color:#fff; padding:32px 20px; }
    .hero h1 { margin:0 0 10px; font-size:32px; }
    .hero p { margin:0; max-width:960px; color:#cbd5e1; line-height:1.5; }
    .wrap { max-width: 1400px; margin: 0 auto; padding: 24px 20px 48px; }
    .card { background:var(--card); border:1px solid var(--line); border-radius:18px; box-shadow:0 10px 30px rgba(15,23,42,.06); padding:20px; }
    .grid { display:grid; gap:16px; }
    .form-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    label { display:block; font-size:13px; color:var(--muted); margin-bottom:6px; font-weight:600; }
    select, input, button { width:100%; border-radius:12px; border:1px solid #cbd5e1; padding:12px 14px; font-size:14px; background:#fff; }
    select:focus, input:focus { outline:2px solid #bfdbfe; border-color:#60a5fa; }
    button { cursor:pointer; background:var(--accent); color:#fff; border:none; font-weight:700; }
    button:hover { background:var(--accent-2); }
    .btn-secondary { background:#e2e8f0; color:#0f172a; }
    .btn-secondary:hover { background:#cbd5e1; }
    .section-title { margin:0 0 14px; font-size:20px; }
    .muted { color:var(--muted); }
    .stack { display:grid; gap:18px; }
    .two { display:grid; grid-template-columns: 1fr 1fr; gap:18px; }
    .result-head { display:flex; gap:12px; flex-wrap:wrap; align-items:center; justify-content:space-between; margin-bottom:12px; }
    .pill { display:inline-flex; align-items:center; gap:6px; padding:8px 12px; border-radius:999px; background:#eff6ff; color:#1d4ed8; font-weight:700; }
    table { width:100%; border-collapse:collapse; }
    th, td { text-align:left; padding:10px 12px; border-bottom:1px solid var(--line); vertical-align:top; }
    th { background:#f8fafc; font-size:13px; }
    .empty { padding:18px; border:1px dashed #cbd5e1; border-radius:14px; color:var(--muted); background:#f8fafc; }
    .toolbar { display:flex; gap:10px; flex-wrap:wrap; }
    .toolbar button { width:auto; min-width:220px; }
    .compare-table td:nth-child(2), .compare-table td:nth-child(3) { font-weight:600; }
    .diff { color:#b91c1c; }
    .same { color:#0f766e; }
    .actions { display:flex; gap:12px; margin-top:18px; flex-wrap:wrap; }
    .actions > * { flex:1 1 260px; min-width:220px; }
    .btn-link { display:inline-flex; align-items:center; justify-content:center; text-decoration:none; border-radius:12px; padding:12px 14px; font-size:14px; font-weight:700; background:var(--accent); color:#fff; border:0; }
    .btn-link:hover { background:var(--accent-2); }
    .modal-backdrop { position:fixed; inset:0; background:rgba(15,23,42,.58); display:none; align-items:center; justify-content:center; padding:24px; z-index:9999; }
    .modal-backdrop.show { display:flex; }
    .modal { width:min(760px, 100%); max-height:min(90vh, 900px); overflow:auto; background:#fff; border-radius:20px; box-shadow:0 24px 80px rgba(15,23,42,.35); padding:22px; position:relative; }
    .modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:12px; }
    .modal-close { width:auto; min-width:120px; }
    .check-row { display:flex; gap:12px; align-items:flex-start; line-height:1.45; }
    .check-row input { width:auto; margin-top:2px; }
    .note { padding:14px 16px; border-radius:14px; background:#eff6ff; color:#1e3a8a; line-height:1.5; border:1px solid #bfdbfe; }
    .success { padding:14px 16px; border-radius:14px; background:#ecfdf5; color:#065f46; border:1px solid #a7f3d0; }
    .drawing-box { margin-top:18px; border:1px solid var(--line); border-radius:16px; padding:18px; background:#fff; }
    .drawing-box img { display:block; max-width:100%; max-height:360px; object-fit:contain; margin:0 auto; }

    .result-separator { height:1px; background:var(--line); margin:0; }
    .subtable-block { padding:16px 0 0; }
    .subtable-title { padding:0 20px 12px; font-size:14px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
    .hidden { display:none !important; }
    @media (max-width: 980px) { .two { grid-template-columns:1fr; } }


.drawing-svg-container{background:#fff;border:1px solid #d9e0ea;border-radius:12px;padding:8px;overflow:auto}.drawing-svg-container svg{display:block;max-width:100%;height:auto}
.type01-template-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}
.type01-template-image {
  display: block;
  max-width: 100%;
  height: auto;
}
.type01-dim,
.type01-spec {
  position: absolute;
  color: #7ec3ff;
  font-weight: 700;
  text-shadow: 0 0 4px rgba(0,0,0,.95), 0 0 10px rgba(0,0,0,.95);
  font-family: Arial, sans-serif;
}
.type01-dim { font-size: clamp(16px, 1.8vw, 26px); }
.type01-spec {
  left: 24%;
  bottom: 2.5%;
  transform: translateX(-10%);
  font-size: clamp(14px, 1.4vw, 22px);
  color: #ffd36e;
  background: rgba(0,0,0,.55);
  padding: 4px 8px;
  border-radius: 8px;
}
.dim-D {
  left: 3%;
  top: 74%;
  transform: rotate(-90deg);
}
.dim-D1 {
  left: 11%;
  top: 55%;
  transform: rotate(-90deg);
}
.dim-dv {
  right: 6.5%;
  top: 52%;
  transform: rotate(-90deg);
}
.dim-d0 {
  right: 9.5%;
  top: 8%;
  transform: rotate(-90deg);
}
.dim-c1 {
  right: 8%;
  top: 39%;
  transform: rotate(-90deg);
}
.dim-b {
  left: 67%;
  bottom: 3.5%;
}
.dim-nxd0 {
  right: 2%;
  top: 3.5%;
}


/* Compact tables for better readability */
.card table {
  table-layout: fixed;
}
.table-compact th,
.table-compact td,
.compare-table th,
.compare-table td {
  padding: 7px 10px;
  font-size: 20px;
  line-height: 1.32;
}
.table-compact thead th,
.compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #2563eb;
  color: #ffffff;
  font-size: 21px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.table-compact tbody tr:nth-child(even),
.compare-table tbody tr:nth-child(even) {
  background: #fbfdff;
}
.table-compact td:first-child,
.compare-table td:first-child {
  width: 44%;
  color: #0f172a;
  font-weight: 600;
}
.table-compact td:last-child {
  width: 56%;
  font-weight: 600;
  color: #111827;
}
.compare-table td:nth-child(2),
.compare-table td:nth-child(3) {
  width: 19%;
  font-weight: 700;
}
.compare-table td:last-child,
.compare-table th:last-child {
  width: 18%;
}
.subtable-block {
  padding: 10px 0 0;
}
.subtable-title {
  margin: 0 0 8px;
  padding: 10px 16px;
  font-size: 21px;
  font-weight: 800;
  color: #ffffff;
  background: #2563eb;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-radius: 10px 10px 0 0;
}
.result-separator {
  margin-top: 2px;
}
@media (max-width: 820px) {
  .table-compact th,
  .table-compact td,
  .compare-table th,
  .compare-table td {
    padding: 6px 8px;
    font-size: 18px;
  }
  .table-compact thead th,
  .compare-table thead th,
  .subtable-title {
    font-size: 19px;
  }
}


.actions-compact {
  align-items: stretch;
}
.actions-compact > * {
  flex: 0 1 260px;
  min-width: 190px;
}
.action-btn {
  min-height: 44px;
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 10px;
}
.modal-wide {
  width: min(980px, 100%);
}
.application-sheet {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 16px;
}
.application-sheet img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
}
@media (max-width: 820px) {
  .actions-compact > * {
    flex: 1 1 100%;
    min-width: 0;
  }
}


textarea { width:100%; border-radius:12px; border:1px solid #cbd5e1; padding:12px 14px; font-size:14px; background:#fff; font-family:inherit; }
textarea:focus { outline:2px solid #bfdbfe; border-color:#60a5fa; }
.application-modal-shell { max-height:min(92vh, 1000px); }
.application-form-head { margin-bottom: 10px; padding: 14px 16px; border:1px solid var(--line); border-radius:16px; background:linear-gradient(180deg,#f8fbff,#ffffff); }
.application-badge { display:inline-block; padding:6px 10px; border-radius:999px; background:#111111; color:#fff; font-size:12px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; margin-bottom:8px; }
.application-form-title { font-size:24px; font-weight:800; color:#0f172a; }
.application-form-subtitle { margin-top:4px; color:var(--muted); }
.application-grid { display:grid; gap:14px; }
.application-grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.application-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.application-section { border:1px solid var(--line); border-radius:14px; padding:14px; background:#fff; }
.choice-grid { display:grid; gap:10px; }
.choice-grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.choice-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.choice-grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.choice-grid-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.option-card { display:flex; gap:10px; align-items:flex-start; padding:12px; border:1px solid #cbd5e1; border-radius:12px; background:#fff; cursor:pointer; min-height:74px; }
.option-card input { width:auto; margin-top:3px; }
.option-card b { display:block; font-size:15px; color:#111827; }
.option-card small { display:block; margin-top:3px; font-size:12px; line-height:1.35; color:#64748b; }
.option-card.compact { min-height:54px; }
.option-card.wide { grid-column: span 2; }
.checkbox-grid { display:grid; gap:10px; grid-template-columns: repeat(3, minmax(0,1fr)); }
.check-chip { display:flex; align-items:center; gap:8px; border:1px solid #cbd5e1; border-radius:12px; padding:10px 12px; background:#fff; font-weight:600; }
.check-chip input { width:auto; }
.stack-tight { gap:10px; }
@media (max-width: 980px) {
  .application-grid-2, .application-grid-3, .choice-grid-4, .choice-grid-5, .checkbox-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .application-grid-2, .application-grid-3, .choice-grid-2, .choice-grid-3, .choice-grid-4, .choice-grid-5, .checkbox-grid { grid-template-columns: 1fr; }
  .option-card.wide { grid-column: span 1; }
}

.option-card span { display:flex; flex-direction:column; justify-content:flex-start; align-items:flex-start; gap:4px; width:100%; }
.option-card small { min-height: 34px; }
.choice-grid-4 .option-card { align-items:flex-start; min-height: 112px; }
.choice-grid-4 .option-card b { line-height: 1; }
.choice-grid-4 .option-card small { line-height: 1.25; }


/* Compact layout for Appendix B form */
.application-columns { display:grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap:14px; align-items:start; }
.application-column { display:grid; gap:14px; align-content:start; }
.choice-grid-tight { gap:8px; }
.application-section { overflow:hidden; }
.application-note-section { align-self:start; }
.option-card {
  display:grid;
  grid-template-columns: 18px 1fr;
  gap:10px;
  align-items:start;
  padding:10px 12px;
}
.option-card input {
  margin:2px 0 0;
  align-self:start;
}
.option-card span {
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  text-align:center;
  gap:4px;
  width:100%;
  min-width:0;
}
.option-card b {
  display:block;
  margin:0;
  line-height:1.1;
  text-align:center;
}
.option-card small {
  margin:0;
  min-height:0;
  line-height:1.2;
  text-align:center;
  text-wrap:balance;
}
.option-card-centered { min-height:44px; }
.face-grid .option-card,
.option-card-face {
  min-height:92px;
}
.option-card-face b { font-size:22px; }
.option-card-face small { font-size:12px; }
@media (max-width: 980px) {
  .application-columns { grid-template-columns:1fr; }
}
@media (max-width: 820px) {
  .face-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}


.batch-toolbar {
  padding: 14px 16px 4px;
}
.batch-qty-wrap {
  width: min(280px, 100%);
}
.batch-qty-wrap label {
  margin-bottom: 8px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}
.batch-note {
  padding: 10px 16px 2px;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}
.party-block {
  padding-top: 8px;
}


.batch-table-wrap {
  margin: 0 16px 10px;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: 12px;
  overflow: hidden;
}
.batch-table-wrap .subtable-title {
  background: #0284c7;
}
.batch-table-wrap .table-compact {
  background: transparent;
}
.batch-table-wrap .table-compact thead th {
  background: #0ea5e9;
}
.batch-table-wrap .table-compact tbody td {
  background: rgba(255,255,255,0.42);
}
.batch-table-wrap .table-compact tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.68);
}
.batch-qty-input {
  width: min(220px, 100%);
}
.batch-qty-input input {
  width: 100%;
}
.batch-qty-error {
  margin-top: 6px;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.35;
}

/* Collapsible sections */
.collapsible-block {
  border-top: 1px solid var(--line);
}
.collapsible-block:first-child {
  border-top: 0;
}
.collapsible-block > summary {
  list-style: none;
}
.collapsible-block > summary::-webkit-details-marker {
  display: none;
}
.collapsible-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 12px 16px;
  background: #2563eb;
  color: #ffffff;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.collapsible-summary::after {
  content: "▾";
  font-size: 18px;
  line-height: 1;
  transition: transform .18s ease;
}
.collapsible-block:not([open]) .collapsible-summary::after {
  transform: rotate(-90deg);
}
.collapsible-content {
  padding: 0;
}
.collapsible-content .subtable-block,
.collapsible-content .party-block {
  padding-top: 0;
}
.collapsible-content .subtable-title {
  display: none;
}
.collapsible-content .drawing-box {
  padding: 16px;
}
@media (max-width: 820px) {
  .collapsible-summary {
    font-size: 19px;
    padding: 10px 14px;
  }
}


.batch-toolbar-inside {
  padding: 14px 16px 8px;
}


/* Make batch fastener block full width like other tables */
.batch-table-wrap,
.batch-table-wrap .table-compact,
#singleBatchResult,
#singleBatchResult .collapsible-block,
#singleBatchResult .collapsible-content,
#singleBatchResult .party-block {
  width: 100%;
  max-width: 100%;
}

#singleBatchResult .party-block {
  display: block;
}

#singleBatchResult .table-compact {
  table-layout: fixed;
}


/* Force "Крепёж на партию" block to use full content width */
#singleBatchResult {
  width: 100%;
}

#singleBatchResult > * {
  width: 100%;
}

#singleBatchResult .collapsible-block,
#singleBatchResult .collapsible-content,
#singleBatchResult .party-block,
#singleBatchResult .batch-table-wrap,
#singleBatchResult table {
  width: 100%;
  max-width: 100%;
}

#singleBatchResult .batch-toolbar,
#singleBatchResult .batch-toolbar-inside {
  display: block;
  width: 100%;
  padding: 14px 16px 8px;
}

#singleBatchResult .batch-qty-wrap,
#singleBatchResult .batch-qty-input {
  width: 100%;
  max-width: none;
}

#singleBatchResult .batch-qty-input input,
#singleBatchResult .batch-qty-input label,
#singleBatchResult .batch-qty-error {
  width: 100%;
}

#singleBatchResult .table-compact {
  table-layout: fixed;
}


/* Remove extra left and bottom whitespace in the batch block */
#singleBatchResult .batch-table-wrap {
  margin: 0;
}

#singleBatchResult .party-block {
  padding-top: 0;
}

#singleBatchResult .batch-note {
  padding: 10px 16px 0;
  margin: 0;
}


.floating-collapse-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9998;
  width: auto;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.floating-collapse-btn:hover {
  background: var(--accent-2);
}

@media (max-width: 820px) {
  .floating-collapse-btn {
    right: 12px;
    bottom: 12px;
    min-width: 120px;
    padding: 11px 14px;
  }
}


.hp-field { display:none !important; visibility:hidden !important; pointer-events:none !important; position:absolute !important; left:-9999px !important; width:1px !important; height:1px !important; opacity:0 !important; }
