.m42-f2-parameter-workbench,
.m42-f2-template-workbench {
  display: grid;
  gap: 12px;
}

.m42-f2-parameter-workbench [hidden],
.m42-f2-template-workbench [hidden] {
  display: none !important;
}

.m42-f2-segmented,
.m42-f2-domain-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.m42-f2-segmented .btn,
.m42-f2-domain-tabs .btn {
  min-height: 40px;
}

.m42-f2-segmented .btn.active,
.m42-f2-domain-tabs .btn.active {
  border-color: #2563eb;
  background: #eaf2ff;
  color: #123b78;
  box-shadow: inset 0 0 0 1px #2563eb;
}

.m42-f2-current-param {
  display: grid;
  gap: 10px;
  border: 1px solid #9bc0f7;
  border-radius: 10px;
  background: #f7fbff;
  padding: 12px;
}

.m42-f2-current-param > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.m42-f2-current-param dl,
.m42-f2-template-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.m42-f2-current-param dl div,
.m42-f2-template-facts div {
  min-width: 0;
}

.m42-f2-current-param dt,
.m42-f2-template-facts dt {
  color: var(--muted);
  font-size: 12px;
}

.m42-f2-current-param dd,
.m42-f2-template-facts dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.m42-f2-param-core {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.m42-f2-param-core > span {
  display: grid;
  gap: 3px;
  border-radius: 7px;
  background: #fff;
  padding: 8px;
  overflow-wrap: anywhere;
}

.m42-f2-param-core strong {
  color: var(--muted);
  font-size: 12px;
}

.m42-f2-param-search {
  display: grid;
  gap: 5px;
  margin: 8px 0;
}

.m42-f2-param-search span {
  color: var(--muted);
  font-size: 12px;
}

.m42-f2-param-search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
}

.m42-f2-param-card.is-current {
  border-color: #67a0ee;
  background: #f7fbff;
}

.m42-f2-modal-footer {
  position: sticky;
  z-index: 4;
  bottom: -1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px -2px -2px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  padding: 12px 2px 2px;
  backdrop-filter: blur(7px);
}

.m42-f2-footer-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.template-filter-grid {
  grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(120px, .75fr));
}

.m42-f2-runnable-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 8px;
  cursor: pointer;
}

.m42-f2-domain-group {
  display: grid;
  gap: 8px;
}

.m42-f2-domain-group > h4 {
  position: sticky;
  z-index: 2;
  top: 0;
  margin: 0;
  border-left: 4px solid #2563eb;
  background: #eef5ff;
  padding: 9px 10px;
  color: #153f7b;
}

.m42-f2-template-group {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdff;
  overflow: clip;
}

.m42-f2-template-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
}

.m42-f2-template-group > summary small {
  color: var(--muted);
  font-weight: 400;
}

.m42-f2-template-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 10px;
}

.template-customer-card {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 11px;
}

.template-customer-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.template-customer-card > header strong,
.template-customer-card > p {
  overflow-wrap: anywhere;
}

.template-customer-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.template-customer-card.incompatible {
  background: #f8fafc;
}

/* The electrical catalog remains readable when selection is disabled. */
body.ui-design-system-v1 [data-template-catalog-group="electrical-base"] .template-customer-card.incompatible {
  opacity: 1;
  color: #243d49;
}

[data-template-catalog-group="electrical-base"] .template-eligibility-reason {
  color: #243d49;
  font-size: 13px;
}

.m42-f2-template-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid #7ba7e8;
  border-radius: 7px;
  background: #f5f9ff;
  color: #123b78;
  cursor: pointer;
  font-weight: 700;
}

.m42-f2-template-pick:has(input:checked) {
  border-color: #2563eb;
  background: #dfeeff;
  box-shadow: inset 0 0 0 1px #2563eb;
}

.m42-f2-advanced-audit {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdff;
}

.m42-f2-advanced-audit > summary {
  min-height: 44px;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 700;
}

.m42-f2-advanced-audit > [data-advanced-audit-body] {
  border-top: 1px solid var(--line);
  padding: 12px;
}

body.ui-design-system-v1[data-page="TPL"][data-ui-mode="customer"] .content > .panel[data-m42-f2-template-workbench][aria-label]:not([hidden]):not([aria-hidden="true"]) {
  display: block !important;
}

body.ui-design-system-v1[data-page="TPL"][data-ui-mode="customer"] .content > [data-template-maintenance-v2],
body.ui-design-system-v1[data-page="TPL"][data-ui-mode="customer"] .content > [data-m40-operation-console],
body.ui-design-system-v1[data-page="TPL"][data-ui-mode="customer"] .content > [data-m41-fanin] {
  display: none !important;
}

.m42-f2-customer-version {
  display: grid;
  gap: 3px;
}

.m42-f2-customer-version small {
  color: var(--muted);
}

.m42-f2-segmented .btn:focus-visible,
.m42-f2-domain-tabs .btn:focus-visible,
.m42-f2-template-group > summary:focus-visible,
.m42-f2-template-pick:focus-within,
.m42-f2-param-search input:focus-visible,
.template-customer-card .btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 2px;
}

@media (max-width: 920px) {
  .template-filter-grid,
  .m42-f2-template-card-grid {
    grid-template-columns: 1fr;
  }

  .m42-f2-modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .m42-f2-modal-footer .row-actions {
    justify-content: stretch;
  }

  .m42-f2-modal-footer .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 680px) {
  .m42-f2-current-param dl,
  .m42-f2-param-core,
  .m42-f2-template-facts {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m42-f2-parameter-workbench *,
  .m42-f2-template-workbench * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
