
/* Фиксация размеров SVG-иконок верстака (защита от некомпилированных JIT utility) */
svg.w-3\.5, .interactive svg.w-3\.5 { width: 14px; height: 14px; }
svg.w-4, .interactive svg.w-4 { width: 16px; height: 16px; }
svg.w-5, .interactive svg.w-5 { width: 20px; height: 20px; }
svg.w-6, .interactive svg.w-6 { width: 24px; height: 24px; }
svg.w-8, .interactive svg.w-8 { width: 32px; height: 32px; }
    /* Smooth Anchor Scrolling with Offset */
    html {
      scroll-behavior: smooth;
      scroll-padding-top: 5rem;
    }
    .meter-bar {
      height: 10px;
      border-radius: 5px;
      background: var(--color-paper-subtle, #f5f2eb);
      border: 1px solid var(--color-paper-border);
      overflow: hidden;
      position: relative;
    }
    .meter-fill {
      height: 100%;
      border-radius: 4px;
      transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.45s ease, box-shadow 0.45s ease;
      box-shadow: 0 0 8px rgba(235, 82, 17, 0.35);
    }
    html.dark .meter-fill {
      box-shadow: 0 0 12px rgba(249, 115, 22, 0.45);
    }

    /* Тактильный тепловой импульс цифр температуры */
    @keyframes temp-heat-pulse {
      0% {
        transform: scale(0.97);
        filter: brightness(1.2);
        color: var(--color-accent);
      }
      50% {
        transform: scale(1.03);
        filter: brightness(1.1);
      }
      100% {
        transform: scale(1);
        filter: brightness(1);
      }
    }
    .temp-heat-pulse {
      display: inline-block;
      animation: temp-heat-pulse 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .badge-danger {
      background-color: var(--color-danger-bg) !important;
      color: var(--color-danger) !important;
      border: 1px solid var(--color-danger-border) !important;
    }

    /* Фоновая сетка миллиметровки */
    .workbench-section {
      background-color: var(--color-paper-subtle);
      background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
      background-size: 18px 18px;
      padding: 32px 24px 28px;
      border-radius: 12px;
      border: 1px solid var(--color-paper-border);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
    }
    html.dark .workbench-section {
      background-color: #15181e;
      background-image: radial-gradient(#202530 1px, transparent 1px);
      border-color: #272d3b;
      box-shadow: none;
    }

    .workbench-container {
      max-width: 1200px;
      margin: 0 auto;
    }

    .cards-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 20px;
      max-width: 1200px;
      margin: 0 auto;
    }

    /* РљР°СЂС‚РѕС‡РєР° РІ СЃС‚РёР»Рµ СЂРµС„РµСЂРµРЅСЃР° */
    .tech-card {
      background: var(--color-paper);
      border: 1px solid var(--color-paper-border);
      border-radius: 10px;
      padding: 20px;
      display: flex;
      flex-direction: column;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
      transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
      min-width: 0;
      overflow-wrap: break-word;
    }
    .tech-card:hover {
      transform: translateY(-3px);
      border-color: var(--color-ink);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }
    html.dark .tech-card {
      background: var(--color-card);
      border-color: #2b3240;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    }
    html.dark .tech-card:hover {
      border-color: var(--color-paper-subtle);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }

    /* РЁР°РїРєР° РєР°СЂС‚РѕС‡РєРё */
    .card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--color-paper-subtle);
      padding-bottom: 10px;
      margin-bottom: 14px;
    }
    html.dark .card-header {
      border-bottom-color: #272d3b;
    }
    .card-title-group {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .card-title {
      font-weight: 700;
      font-size: 15px;
      color: var(--color-ink);
      letter-spacing: -0.01em;
      font-family: var(--font-sans);
    }
    html.dark .card-title {
      color: var(--color-ink);
    }

    /* Чертёжный бейдж FIG. X.X (Лабораторный штамп) */
    .fig-badge {
      font-family: var(--font-mono);
      font-size: 10px;
      font-weight: 600;
      color: var(--color-ink-muted);
      background: var(--color-paper-subtle);
      border: 1px solid var(--color-paper-border);
      border-radius: 3px;
      padding: 2px 7px;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    }
    html.dark .fig-badge {
      background: #1c2230;
      border-color: #2e384d;
      color: var(--color-ink-muted);
    }

    /* Блок схемы с угловыми чертёжными метками */
    .card-diagram {
      background: var(--color-paper);
      border: 1px solid var(--color-paper-border);
      border-radius: 6px;
      padding: 10px;
      text-align: center;
      margin-bottom: 14px;
      min-height: 180px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      position: relative;
    }
    .card-diagram::before,
    .card-diagram::after {
      content: "";
      position: absolute;
      width: 7px;
      height: 7px;
      border-color: var(--color-ink-muted);
      opacity: 0.35;
      pointer-events: none;
    }
    .card-diagram::before {
      top: 6px;
      left: 6px;
      border-top: 1.5px solid currentColor;
      border-left: 1.5px solid currentColor;
    }
    .card-diagram::after {
      bottom: 6px;
      right: 6px;
      border-bottom: 1.5px solid currentColor;
      border-right: 1.5px solid currentColor;
    }
    html.dark .card-diagram {
      background: var(--color-paper);
      border-color: #272d3b;
    }
    .card-diagram img {
      max-width: 100%;
      max-height: 170px;
      height: auto;
      object-fit: contain;
    }

    /* Р’С‹РїР°РґР°СЋС‰РёРµ СЃРїРёСЃРєРё Рё РёРЅС„Рѕ-С‡РёРїС‹ РІРЅСѓС‚СЂРё РєР°СЂС‚РѕС‡РєРё */
    .card-quick-inputs {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 6px;
      margin-bottom: 14px;
      background: var(--color-paper-subtle);
      padding: 8px 12px;
      border-radius: 6px;
      border: 1px solid var(--color-paper-border);
      min-height: 56px;
    }
    html.dark .card-quick-inputs {
      background: #161922;
      border-color: #272d3b;
    }
    .input-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 11px;
      font-family: var(--font-mono);
      gap: 8px;
    }
    .input-row label, .input-row .row-label {
      color: var(--color-ink-faint);
      font-weight: 600;
      white-space: nowrap;
    }
    html.dark .input-row label, html.dark .input-row .row-label {
      color: #94a3b8;
    }
    .input-row select {
      font-size: 11px;
      padding: 2px 6px;
      border: 1px solid var(--color-paper-border-dark);
      border-radius: 4px;
      background: var(--color-paper);
      color: var(--color-ink);
      font-family: var(--font-mono);
      max-width: 62%;
      cursor: pointer;
    }
    html.dark .input-row select {
      background: #1e293b;
      border-color: #334155;
      color: var(--color-ink);
    }

    /* РўРµРєСЃС‚РѕРІС‹Р№ Р±Р»РѕРє */
    .card-info {
      margin-bottom: 16px;
    }
    .card-info h3 {
      font-size: 13.5px;
      font-weight: 700;
      letter-spacing: 0.02em;
      text-transform: uppercase;
      margin: 0 0 6px 0;
      color: var(--color-ink);
      font-family: var(--font-sans);
    }
    html.dark .card-info h3 {
      color: var(--color-ink);
    }
    .card-info p {
      font-size: 12.5px;
      line-height: 1.5;
      color: var(--color-ink-muted);
      margin: 0;
      font-family: var(--font-sans);
    }
    html.dark .card-info p {
      color: var(--color-ink-muted);
    }

    /* Р¤СѓС‚РµСЂ Рё СЃРѕР»РёРґРЅР°СЏ С‡РµСЂРЅР°СЏ РєРЅРѕРїРєР° РєР°Рє РІ СЂРµС„РµСЂРµРЅСЃРµ */
    .card-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-top: 1px solid var(--color-paper-subtle);
      padding-top: 14px;
      margin-top: auto;
    }
    html.dark .card-footer {
      border-top-color: #272d3b;
    }
    .spec-tag {
      font-family: var(--font-mono);
      font-size: 11px;
      font-weight: 700;
      background: var(--color-paper-subtle);
      color: var(--color-ink-muted);
      padding: 3px 8px;
      border-radius: 4px;
      border: 1px solid var(--color-paper-border);
      letter-spacing: 0.03em;
    }
    html.dark .spec-tag {
      background: #1e293b;
      border-color: #334155;
      color: var(--color-ink-muted);
    }
    .card-btn {
      font-size: 11.5px;
      font-weight: 700;
      font-family: var(--font-mono);
      background: var(--color-paper);
      color: var(--color-ink);
      padding: 6px 12px;
      border-radius: 4px;
      border: 1px solid var(--color-paper-border-dark);
      text-decoration: none;
      transition: border-color 0.15s ease, color 0.15s ease;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .card-btn:hover {
      border-color: var(--color-ink);
      color: var(--color-ink);
    }
    html.dark .card-btn {
      background: #1e293b;
      color: var(--color-ink);
      border-color: #334155;
    }
    html.dark .card-btn:hover {
      border-color: var(--color-accent);
      color: var(--color-accent);
    }
    .icon-thermo, .icon-tools, .icon-search {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 18px;
      height: 18px;
      color: var(--color-ink);
    }
    html.dark .icon-thermo, html.dark .icon-tools, html.dark .icon-search {
      color: var(--color-ink);
    }

    /* РђРґР°РїС‚РёРІ РґР»СЏ РїР»Р°РЅС€РµС‚РѕРІ Рё С‚РµР»РµС„РѕРЅРѕРІ */
    @media (max-width: 900px) {
      .cards-grid {
        grid-template-columns: 1fr;
      }
    }

/* Адаптив и доступность */
@media(min-width:1024px){
  #calc-workbench-grid-inner { grid-template-columns: 58% 40% !important; display: grid !important; }
}

.input-row select {
  font-size: 12px;
  padding: 6px 8px;
  min-height: 36px;
}

@media (max-width: 640px) {
  .input-row select,
  .input-row input,
  .card-btn,
  .preset-btn,
  .batch-btn {
    min-height: 44px;
    font-size: 13px;
  }
}

.interactive :is(a, button, input, select, textarea):focus-visible,
.card-btn:focus-visible,
.input-base:focus-visible,
.interactive select:focus-visible {
  outline: 2px dashed var(--color-ink);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Quick Task Selector button active contrast state (WCAG AA/AAA) */
.quick-task-btn.bg-accent {
  background-color: var(--color-accent) !important;
  color: #1a1a1a !important;
  border-color: #1a1a1a !important;
  font-weight: 700 !important;
}

html.dark .quick-task-btn.bg-accent {
  background-color: var(--color-accent) !important;
  color: #141414 !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

/* ───────────────────────────────────────────────────────────────────────────
   ИНЖЕНЕРНЫЙ НАВИГАТОР ВЕРСТАКА (STICKY TOC RAIL)
   ─────────────────────────────────────────────────────────────────────────── */

/* Десктопный плавающий индекс (>= 1280px) */
.workbench-toc-rail {
  display: none;
  position: fixed;
  right: max(16px, calc((100vw - 1200px) / 2 - 180px));
  top: 130px;
  width: 165px;
  background: var(--color-paper);
  border: 1px solid var(--color-paper-border-dark);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  z-index: 35;
  font-family: var(--font-mono);
}

@media (min-width: 1340px) {
  .workbench-toc-rail {
    display: block;
  }
}

html.dark .workbench-toc-rail {
  background: #181c24;
  border-color: #2b3240;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.workbench-toc-header {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px dashed var(--color-paper-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workbench-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.workbench-toc-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--color-ink-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.workbench-toc-link:hover {
  color: var(--color-ink);
  background: var(--color-paper-subtle);
  border-left-color: var(--color-ink-faint);
}

.workbench-toc-link.active {
  color: var(--color-ink);
  font-weight: 700;
  background: var(--color-paper-subtle);
  border-left-color: var(--color-accent);
}

html.dark .workbench-toc-link.active {
  color: #fff;
  border-left-color: var(--color-accent);
}

.workbench-toc-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--color-paper-border);
  font-size: 11px;
  color: var(--color-ink-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.workbench-toc-top:hover {
  color: var(--color-accent);
}

/* Мобильный и планшетный горизонтальный Sticky-бар */
.workbench-subnav-mobile {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 12px;
  margin: -8px -12px 16px;
  position: sticky;
  top: 56px;
  background: var(--color-paper);
  border-bottom: 1px solid var(--color-paper-border);
  z-index: 30;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.workbench-subnav-mobile::-webkit-scrollbar {
  display: none;
}

@media (min-width: 1340px) {
  .workbench-subnav-mobile {
    display: none;
  }
}

.workbench-subnav-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  border: 1px solid var(--color-paper-border);
  background: var(--color-paper-subtle);
  color: var(--color-ink-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.workbench-subnav-chip:hover,
.workbench-subnav-chip.active {
  border-color: var(--color-accent);
  color: var(--color-ink);
  font-weight: 700;
  background: var(--color-paper);
}

/* Встроенный термо-индикатор и тактильная шкала нагрева */
.meter-bar {
  height: 8px;
  width: 100%;
  background-color: var(--color-paper-subtle, #ede8df);
  border: 1px solid var(--color-paper-border, #d8d3c5);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
html.dark .meter-bar {
  background-color: #171b22;
  border-color: #2b3240;
}

.meter-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.4s ease;
  will-change: width;
}

@keyframes temp-heat-pulse {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.temp-heat-pulse {
  animation: temp-heat-pulse 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-block;
  transform-origin: left center;
}

/* Стили печати для бланка технологической карты */
@media print {
  header, footer, nav,
  .workbench-toc-rail, .workbench-subnav-mobile,
  #mobile-bar, #search-modal, #theme-toggle,
  .bottom-nav-mobile, .no-print {
    display: none !important;
  }
  
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt !important;
  }
  
  .card-tool {
    border: 1px solid #222 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 16px !important;
    padding: 16px !important;
    background: #fff !important;
  }

  .sketch-border, .sketch-pill-yellow, .sketch-pill-gray {
    border: 1px solid #333 !important;
    background: #f5f5f5 !important;
    color: #000 !important;
  }
}

/* Режим Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *, *::before, *::after {
    animation-iteration-count: 1 !important;
  }
  .meter-fill {
    transition: none !important;
  }
  .temp-heat-pulse {
    animation: none !important;
  }
}

/* Закрепление первой колонки марки сплава при горизонтальном скролле */
#solder-table-grid th:first-child,
#solder-table-grid td:first-child {
  position: sticky;
  left: 0;
  background: var(--color-paper, #ffffff);
  z-index: 2;
  box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.08);
}

#solder-table-grid th:first-child {
  background: var(--color-paper-subtle, #f5f2eb);
  z-index: 3;
}

html.dark #solder-table-grid td:first-child {
  background: #15181e;
  box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.4);
}

html.dark #solder-table-grid th:first-child {
  background: #1c212a;
}
