/**
 * Laboratorio de transmisión — calculadoras y estudio modular
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --border: #e2e8f0;
  --muted: #64748b;
  --text: #0f172a;
  --surface-2: #f1f5f9;
  --accent-dark: #0f766e;
}

.lab-body {
  margin: 0;
  min-height: 100vh;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font-family: 'Inter', system-ui, sans-serif;
  background: linear-gradient(168deg, #f8fafc 0%, #f1f5f9 45%, #e2e8f0 100%);
  color: #0f172a;
}

.lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding: 0.85rem max(1.25rem, env(safe-area-inset-right, 0px)) 0.85rem max(1.25rem, env(safe-area-inset-left, 0px));
  padding-top: max(0.85rem, env(safe-area-inset-top, 0px));
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 20;
}

.tier-status-bar {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  padding: 0.55rem 0 0;
  margin-top: 0.15rem;
  border-top: 1px dashed var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.tier-status-bar__pill {
  font-weight: 800;
  color: var(--text);
  background: var(--surface-2);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tier-status-bar__hint {
  max-width: 36rem;
}

.tier-status-bar__links {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
}

.tier-status-bar__links a {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

.tier-status-bar__links a:hover {
  text-decoration: underline;
}

.lab-header__brand {
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.lab-header__brand span {
  color: #0d9488;
}

.lab-header__nav {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-left: 0.5rem;
  min-width: min(100%, 220px);
  font-size: 0.82rem;
  font-weight: 600;
}

.lab-header__nav-start,
.lab-header__nav-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.lab-header__nav a {
  color: #334155;
  text-decoration: none;
}

.lab-header__nav a:hover {
  color: #0d9488;
  text-decoration: underline;
}

.lab-header__nav-crumb {
  color: #64748b;
  font-weight: 700;
}

/* Acceso principal al índice del laboratorio (siempre visible a la derecha) */
.lab-header__nav-cta {
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #0f766e;
  background: #0f766e;
  color: #f8fafc !important;
  text-decoration: none !important;
  font-weight: 700;
}

.lab-header__nav-cta:hover {
  background: #0d9488;
  border-color: #0d9488;
  color: #ffffff !important;
  text-decoration: none !important;
}

/* Página actual (hub, lienzo, etc.) — contraste suave frente al CTA */
.lab-header__nav-pill {
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #0f172a !important;
  text-decoration: none !important;
  font-weight: 700;
}

.lab-header__nav-pill:hover {
  border-color: #0d9488;
  color: #0d9488 !important;
  text-decoration: none !important;
}

.lab-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem max(0.85rem, env(safe-area-inset-right, 0px)) 2rem max(0.85rem, env(safe-area-inset-left, 0px));
}

.lab-panel {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.lab-panel--accent {
  border-color: #99f6e4;
  box-shadow: 0 6px 28px rgba(13, 148, 136, 0.08);
}

.lab-panel h1,
.lab-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.lab-lead {
  margin: 0 0 0.7rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #475569;
}

.lab-start-hint {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f766e;
}

.lab-index-section {
  margin: 1.35rem 0 1.05rem;
  padding-top: 10px;
  font-size: 0.8rem !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
}

.lab-grid {
  display: grid;
  gap: 0.65rem 0.85rem;
}

@media (min-width: 560px) {
  .lab-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.lab-field--wide {
  grid-column: 1 / -1;
}

/* Filas de formulario mostradas según tipo de correa */
.belt-row--anim {
  overflow: hidden;
  max-height: 320px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease, margin 180ms ease;
}

.belt-row--hidden {
  max-height: 0 !important;
  opacity: 0 !important;
  transform: translateY(-4px);
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  pointer-events: none;
}

.belt-row--display-hidden {
  display: none !important;
}

/* Veredicto visual por velocidad lineal v (primitivo motriz) */
.lab-belt-speed-verdict-wrap {
  margin: 0 0 0.65rem;
}

.lab-belt-speed-verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.78rem;
  line-height: 1.4;
}

.lab-belt-speed-verdict__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.lab-belt-speed-verdict--optimal {
  border-color: #6ee7b7;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.lab-belt-speed-verdict--optimal .lab-belt-speed-verdict__badge {
  background: #059669;
  color: #fff;
}

.lab-belt-speed-verdict--low {
  border-color: #fcd34d;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.lab-belt-speed-verdict--low .lab-belt-speed-verdict__badge {
  background: #d97706;
  color: #fff;
}

.lab-belt-speed-verdict--critical {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.lab-belt-speed-verdict--critical .lab-belt-speed-verdict__badge {
  background: #dc2626;
  color: #fff;
}

.lab-belt-speed-verdict__text {
  flex: 1;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.lab-belt-speed-verdict__title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0f172a;
}

.lab-belt-speed-verdict__detail {
  font-weight: 600;
  color: #475569;
}

.lab-belt-speed-verdict__v {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0f766e;
  margin-left: auto;
}

.lab-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.lab-check input {
  margin-top: 0.15rem;
  width: auto;
}

.lab-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.lab-field input,
.lab-field select {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.lab-field input::placeholder {
  color: #94a3b8;
}

.lab-field input:focus,
.lab-field select:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.lab-field input:disabled,
.lab-field select:disabled {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
  cursor: not-allowed;
}

/* Cadena: transición visual entre referencia de catálogo y paso manual */
.chain-ref--disabled {
  opacity: 0.62;
  transition: opacity 180ms ease, filter 180ms ease;
  filter: grayscale(0.25);
}

.chain-pitch--active {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.chain-pitch--active input {
  border-color: #0d9488;
  background: #f0fdfa;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.1);
}

/* Eje: modo básico/avanzado */
.sh-advanced-row {
  overflow: hidden;
  max-height: 220px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 180ms ease, opacity 150ms ease, transform 150ms ease;
}

.sh-advanced-row--hidden {
  max-height: 0 !important;
  opacity: 0 !important;
  transform: translateY(-4px);
  pointer-events: none;
}

.ky-row--active {
  background: #ecfdf5 !important;
  box-shadow: inset 0 0 0 1px #6ee7b7;
  font-weight: 700;
}

.lab-field input.field-input--danger,
.lab-field select.field-input--danger {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

/* .hint y .lab-field-help se integran en "?" vía labHelpCompact.js */
.lab-field .hint {
  display: none;
}

.lab-field-help {
  display: none;
}

/* Ayuda compacta: botón "?" + capa al hover o foco */
.lab-help-hover {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: center;
  flex-shrink: 0;
  vertical-align: middle;
}

.lab-help-hover--field {
  margin-left: auto;
  align-self: center;
}

/* En paneles densos (p.ej. Lienzo Pro), abrir tooltip hacia arriba evita salir de viewport */
.tx-layout .lab-help-hover--field .lab-help-hover__tip {
  top: auto;
  bottom: calc(100% + 6px);
}

.lab-help-hover__btn {
  width: 1.125rem;
  height: 1.125rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.lab-help-hover__btn:hover,
.lab-help-hover__btn:focus-visible {
  outline: none;
  background: #0d9488;
  color: #fff;
}

.lab-help-hover__tip {
  display: none;
  position: absolute;
  z-index: 80;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  max-width: min(320px, calc(100vw - 2rem));
  padding: 0.45rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: normal;
  color: #1e293b;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  pointer-events: none;
}

.lab-help-hover--field .lab-help-hover__tip,
.lab-help-hover--hero .lab-help-hover__tip {
  left: auto;
  right: 0;
}

.lab-help-hover:hover .lab-help-hover__tip,
.lab-help-hover:focus-within .lab-help-hover__tip {
  display: block;
  pointer-events: auto;
}

.lab-help-hover__hint-line {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed #e2e8f0;
}

.lab-help-hover__body {
  font-size: 0.72rem;
  color: #334155;
}

.lab-help-hover__body :last-child {
  margin-bottom: 0;
}

.lab-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.lab-results--note {
  margin-top: 0.75rem;
}

.lab-element-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin: 0.65rem 0 0.95rem;
}

.lab-element-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfb 100%);
  border: 1px solid #d7ece8;
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.lab-element-card:hover {
  transform: translateY(-1px);
  border-color: #9fd9d1;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.14);
}

.lab-element-card__title {
  font-size: 0.69rem;
  font-weight: 800;
  color: #0f766e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed #cfe8e3;
}

.lab-element-card__kv {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.16rem 0.45rem;
  font-size: 0.73rem;
}

.lab-element-card__kv dt {
  margin: 0;
  color: #64748b;
  font-weight: 700;
}

.lab-element-card__kv dd {
  margin: 0;
  text-align: right;
  color: #0b3d38;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lab-results-details {
  margin-top: 0.55rem;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.lab-results-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.62rem 0.85rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f172a;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
  user-select: none;
}

.lab-results-details > summary::-webkit-details-marker {
  display: none;
}

.lab-results-details > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.45rem;
  color: #0f766e;
  transform: translateY(-0.02em);
}

.lab-results-details[open] > summary::before {
  content: '▾';
}

.lab-results-details:not([open]) > summary {
  border-bottom-color: transparent;
}

.lab-results-details .lab-results {
  margin-top: 0;
  padding: 0.65rem;
}

.lab-results-details .lab-element-columns {
  margin: 0;
  padding: 0.72rem;
}

.lab-metric {
  padding: 0.5rem 0.6rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.lab-metric:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.lab-metric__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.lab-metric .k {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
  min-width: 0;
}

.lab-metric .v {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

.lab-metric__si {
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
  line-height: 1.45;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.lab-metric__help {
  display: none;
}

.lab-metric--wide {
  grid-column: 1 / -1;
}

.lab-metric__text {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
  color: #1e293b;
}

/* Sustitución numérica paso a paso (cinemática) */
.calc-substitution {
  margin-top: 1rem;
  padding: 0.9rem 1.05rem;
  border-radius: 12px;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  font-size: 0.82rem;
  line-height: 1.6;
  border: 1px solid #334155;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

.calc-substitution > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.calc-substitution > summary::-webkit-details-marker {
  display: none;
}

.calc-substitution > summary::before {
  content: '▸';
  flex-shrink: 0;
  margin-top: 0.05em;
  font-size: 0.65rem;
  color: #5eead4;
  transition: transform 0.12s ease;
}

.calc-substitution[open] > summary::before {
  content: '▾';
}

.calc-substitution__inner {
  margin-top: 0.65rem;
}

.calc-substitution__title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5eead4;
}

.calc-substitution__step {
  margin: 0.35rem 0 0;
  padding-left: 0.35rem;
  border-left: 3px solid #0d9488;
}

.calc-substitution__muted {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.88em;
  opacity: 0.88;
  color: #94a3b8;
}

.calc-substitution code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.88em;
  color: #fde68a;
  font-weight: 600;
}

.lab-alerts {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lab-alert {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 600;
}

.lab-alert--info {
  background: #ecfeff;
  border: 1px solid #67e8f9;
  color: #155e75;
}

.lab-alert--warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.lab-alert--danger {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.lab-diagram-wrap {
  margin-top: 0;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(165deg, #f8fafc 0%, #fff 100%);
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
  max-width: min(100%, 520px);
  margin-inline: auto;
}

.lab-diagram-wrap--elevated {
  border-color: #94a3b8;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.lab-diagram-wrap__title {
  margin: 0;
  padding: 0.45rem 0.75rem 0;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
}

.lab-diagram-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 96px;
  max-height: min(40vh, 300px);
}

/* Rodamientos: un poco más bajos que el resto del laboratorio */
.lab-diagram-wrap--bearing svg {
  max-height: min(36vh, 260px);
}

/* Gráfico SVG dentro del mismo panel (p. ej. par motor vs resistente) */
.lab-diagram-wrap .lab-chart-wrap {
  margin: 0.35rem 0 0;
  padding: 0.35rem 0.5rem 0.5rem;
}

.lab-diagram-wrap .lab-chart-wrap svg {
  max-width: 100%;
  max-height: min(36vh, 260px);
}

.lab-diagram-caption {
  padding: 0.4rem 0.75rem 0.5rem;
  font-size: 0.68rem;
  line-height: 1.4;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.lab-btn {
  font: inherit;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  background: #0d9488;
  color: #fff;
  cursor: pointer;
  margin-top: 0.75rem;
}

.lab-btn:hover {
  filter: brightness(1.05);
}

.lab-index-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.lab-card {
  display: block;
  padding: 1.1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lab-card:hover {
  border-color: #0d9488;
  box-shadow: 0 8px 28px rgba(13, 148, 136, 0.12);
}

.lab-card--soon {
  opacity: 0.72;
  cursor: default;
  pointer-events: none;
}

.lab-card--soon:hover {
  border-color: #cbd5e1;
  box-shadow: none;
}

.lab-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: #0f172a;
}

.lab-card p {
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.45;
}

.lab-badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
  margin-bottom: 0.5rem;
}

.lab-badge--free {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.lab-badge--beta {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
}

.lab-badge--pro {
  color: #5b21b6;
  background: linear-gradient(135deg, #f5f3ff 0%, #fefce8 100%);
  border-color: rgba(139, 92, 246, 0.45);
}

.lab-pro-card {
  margin-top: 1rem;
  border: 1px solid #fbbf24;
  border-radius: 12px;
  background: linear-gradient(165deg, #fffbeb 0%, #fff7ed 100%);
  padding: 1rem 1.05rem;
}

.lab-pro-card h2 {
  margin: 0.1rem 0 0.4rem;
  font-size: 1.1rem;
}

.lab-pro-card p {
  margin: 0;
  font-size: 0.84rem;
  color: #6b4f1f;
  line-height: 1.45;
}

.lab-pro-card__cta {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  background: #92400e;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.82rem;
}

.lab-catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin: 0.75rem 0 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.lab-catalog-table th,
.lab-catalog-table td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.lab-catalog-table thead th {
  background: #f1f5f9;
  font-weight: 800;
  color: #334155;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lab-catalog-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.lab-verdict {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.5;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.lab-verdict--ok {
  border-color: #5eead4;
  background: #ecfdf5;
  color: #0f766e;
}

.lab-verdict--err {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.lab-verdict--muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.lab-small-print {
  margin: 0.5rem 0 0;
  font-size: 0.68rem;
  color: #64748b;
  line-height: 1.45;
}

.cp-ka-btn {
  border: 1px solid #99f6e4;
  background: #ecfeff;
  color: #0f766e;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  min-height: 44px;
  cursor: pointer;
}

.cp-ka-btn:hover {
  background: #ccfbf1;
}

@media (max-width: 640px) {
  .cp-ka-accordion[open] .lab-results {
    max-height: 52vh;
    overflow: auto;
  }
}

.lab-chart-wrap {
  margin: 1rem 0;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.lab-chart-wrap svg {
  display: block;
  width: 100%;
  max-width: 440px;
  max-height: min(42vh, 300px);
  height: auto;
}

/* Estudio modular: que [hidden] no quede anulado por otros estilos */
#studioApp[hidden],
#studioPaywall[hidden] {
  display: none !important;
}

.studio-schematic-panel {
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
}

.studio-schematic-svg {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  min-height: 100px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.studio-layout {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .studio-layout {
    grid-template-columns: 220px 1fr 260px;
  }

  .studio-layout--canvas {
    grid-template-columns: 240px minmax(0, 1fr) minmax(260px, 300px);
    align-items: start;
  }
}

.studio-aside-title {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.studio-intro-panel {
  border-color: #99f6e4;
  box-shadow: 0 6px 28px rgba(13, 148, 136, 0.08);
}

.studio-palette {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.studio-palette--chips {
  position: sticky;
  top: 0.75rem;
}

.studio-palette__hint {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.35;
}

.studio-palette-chips {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.studio-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 2px dashed #94a3b8;
  background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  user-select: none;
  touch-action: none;
}

.studio-chip:active {
  cursor: grabbing;
}

.studio-chip:hover {
  border-color: #0d9488;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
}

.studio-chip--gears {
  border-left: 4px solid #0d9488;
}

.studio-chip--belt {
  border-left: 4px solid #b45309;
}

.studio-chip--chain {
  border-left: 4px solid #475569;
}

.studio-chip__icon {
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0.85;
}

.studio-chip__text {
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
}

.studio-chip__sub {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 600;
}

.studio-palette__clear {
  margin-top: 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #991b1b;
  cursor: pointer;
}

.studio-palette__clear:hover {
  background: #fee2e2;
}

.studio-workbench {
  padding: 1rem 1.1rem 1.15rem;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 40%);
}

.studio-dropzone {
  position: relative;
  min-height: 112px;
  margin-bottom: 1rem;
  border-radius: 14px;
  border: 2px dashed #cbd5e1;
  background: #f1f5f9;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.studio-dropzone:focus {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}

.studio-dropzone--active {
  border-color: #0d9488;
  background: #ecfdf5;
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.25);
}

.studio-dropzone__pattern {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 14px 14px;
}

.studio-dropzone__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.25rem 1rem;
  min-height: 112px;
}

.studio-dropzone__title {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: #334155;
}

.studio-dropzone__hint {
  margin: 0;
  font-size: 0.72rem;
  color: #64748b;
  max-width: 22rem;
  line-height: 1.4;
}

.studio-dropzone--has-stages .studio-dropzone__title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f766e;
}

.studio-timeline {
  margin-bottom: 1rem;
}

.studio-timeline__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.45rem;
}

.studio-timeline__track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.studio-timeline__arrow {
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
  user-select: none;
}

.studio-timeline__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0f172a;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.studio-timeline__pill:hover {
  border-color: #0d9488;
}

.studio-timeline__pill--dragging {
  opacity: 0.55;
}

.studio-timeline__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
}

.studio-timeline__pill--belt .studio-timeline__n {
  background: #b45309;
}

.studio-timeline__pill--chain .studio-timeline__n {
  background: #475569;
}

.studio-timeline__name {
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-workbench__toolbar {
  margin-bottom: 0.85rem;
}

.studio-workbench__n0 {
  max-width: 220px;
}

.studio-n0-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.studio-n0-wrap input {
  flex: 1;
  min-width: 0;
}

.studio-n0-unit {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}

.studio-blocks-stack {
  margin-bottom: 1rem;
}

.studio-schematic-embed {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.studio-schematic-embed__title {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
}

.studio-schematic-embed__hint {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.4;
}

.studio-summary-panel {
  position: sticky;
  top: 0.75rem;
}

.studio-summary-cards {
  margin-bottom: 0.85rem;
}

.studio-empty-results {
  padding: 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.45;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
}

.studio-metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 520px) {
  .studio-metric-row {
    grid-template-columns: 1fr;
  }
}

.studio-metric-card {
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(160deg, #fff 0%, #f8fafc 100%);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.studio-metric-card--in {
  border-color: #99f6e4;
  background: linear-gradient(160deg, #ecfdf5 0%, #fff 100%);
}

.studio-metric-card--out {
  border-color: #a5b4fc;
  background: linear-gradient(160deg, #eef2ff 0%, #fff 100%);
}

.studio-metric-card--ratio {
  border-color: #fcd34d;
  background: linear-gradient(160deg, #fffbeb 0%, #fff 100%);
}

.studio-metric-card__label {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.studio-metric-card__value {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.studio-metric-card__unit {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
}

.studio-stage-flow {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.studio-stage-result {
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.studio-stage-result__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  background: linear-gradient(90deg, #f0fdfa 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.studio-stage-result__idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 8px;
  background: #0d9488;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.studio-stage-result__title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  line-height: 1.3;
}

.studio-stage-result__body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0.5rem 0.65rem 0.6rem;
  font-size: 0.72rem;
  color: #475569;
}

.studio-checks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.studio-check {
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  padding: 0.38rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.4;
}

.studio-check--ok {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #14532d;
}

.studio-check--warn {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.studio-check--err {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.studio-stage-elements {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.45rem;
  padding: 0.35rem 0.65rem 0.7rem;
}

.studio-stage-el {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  background: #f8fafc;
}

.studio-stage-el__t {
  font-size: 0.65rem;
  font-weight: 800;
  color: #475569;
  margin-bottom: 0.2rem;
}

.studio-stage-el__v {
  font-size: 0.7rem;
  line-height: 1.35;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.studio-kv strong {
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.studio-json-details {
  margin-bottom: 0.65rem;
  font-size: 0.75rem;
  color: #475569;
}

.studio-json-details summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.35rem 0;
}

.studio-json-pre {
  margin: 0.5rem 0 0;
  font-size: 0.68rem;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.65rem;
  border-radius: 8px;
  overflow: auto;
  max-height: 200px;
}

.studio-copy-btn {
  width: 100%;
}

.studio-palette button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}

.studio-palette button:hover {
  border-color: #0d9488;
  background: #f0fdfa;
}

.studio-canvas {
  min-height: 320px;
  padding: 1rem;
  background: #f1f5f9;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
}

.studio-block {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.studio-block--gears {
  border-left: 4px solid #0d9488;
}

.studio-block--belt {
  border-left: 4px solid #d97706;
}

.studio-block--chain {
  border-left: 4px solid #475569;
}

.studio-block h4 {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.studio-block button.studio-remove {
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  border: none;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 4px;
  cursor: pointer;
}

.studio-summary {
  font-size: 0.8rem;
  line-height: 1.5;
  color: #334155;
}

.studio-summary pre {
  font-size: 0.72rem;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.75rem;
  border-radius: 8px;
  overflow: auto;
  max-height: 240px;
}

/**
 * El atributo [hidden] del navegador usa display:none, pero una regla posterior
 * con display:flex|block en la misma clase lo anula y el paywall queda siempre visible.
 */
[hidden] {
  display: none !important;
}

.studio-paywall {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.studio-paywall__card {
  max-width: 400px;
  background: #fff;
  padding: 1.5rem;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

/* ——— Calculadoras: layout “foco en resultado”, iconos de entrada, feedback industrial ——— */

.lab-units-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.85rem;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.55rem;
  border-radius: 10px;
  background: linear-gradient(165deg, #f0fdfa 0%, #ecfeff 100%);
  border: 1px solid #99f6e4;
}

.lab-units-bar__title {
  flex: 1 1 100%;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #0f766e;
}

.lab-units-bar__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.lab-units-bar__lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: #475569;
}

.lab-units-bar__select {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  max-width: 11rem;
}

/* Conversor de unidades (discreto, bajo la barra de preferencias) */
.lab-unit-converter {
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.55rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.lab-unit-converter__head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.38rem;
}

.lab-unit-converter__title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-right: auto;
}

.lab-unit-converter__lbl-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.lab-unit-converter__lbl-row .lab-unit-converter__lbl {
  margin-right: auto;
}

.lab-unit-converter__grid {
  display: grid;
  gap: 0.4rem 0.5rem;
  align-items: end;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.85fr) minmax(0, 1fr) auto minmax(0, 1fr);
}

@media (max-width: 720px) {
  .lab-unit-converter__grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .lab-unit-converter__swap-wrap {
    justify-content: center;
    padding: 0.15rem 0;
  }
}

.lab-unit-converter__field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.lab-unit-converter__lbl {
  font-size: 0.6rem;
  font-weight: 700;
  color: #64748b;
}

.lab-unit-converter__mag,
.lab-unit-converter__from,
.lab-unit-converter__to {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.45rem;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  width: 100%;
  max-width: 100%;
}

.lab-unit-converter__val,
.lab-unit-converter__rpm {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.32rem 0.45rem;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  width: 100%;
}

.lab-unit-converter__swap-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.12rem;
}

.lab-unit-converter__swap {
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}

.lab-unit-converter__swap:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.lab-unit-converter__rpm-row {
  margin-top: 0.4rem;
}

.lab-unit-converter__rpm-row.is-hidden,
.lab-unit-converter__field--mag.is-hidden {
  display: none !important;
}

.lab-unit-converter__result {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px dashed #e2e8f0;
}

.lab-unit-converter__eq {
  font-size: 0.85rem;
  font-weight: 800;
  color: #94a3b8;
}

.lab-unit-converter__out {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f766e;
  letter-spacing: -0.01em;
}

.lab-purchase-suggestions {
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #bae6fd;
  background: linear-gradient(180deg, #f0f9ff 0%, #f8fafc 100%);
}

.lab-purchase-suggestions__head {
  margin-bottom: 0.4rem;
}

.lab-purchase-suggestions__title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0369a1;
}

.lab-purchase-suggestions__list {
  margin: 0;
  padding-left: 1.1rem;
  list-style: disc;
  color: #0f172a;
}

.lab-purchase-suggestions__item {
  margin: 0.35rem 0;
  font-size: 0.82rem;
}

.lab-purchase-suggestions__label {
  display: block;
  font-weight: 600;
  color: #334155;
}

.lab-purchase-suggestions__link {
  font-size: 0.78rem;
  font-weight: 700;
  color: #c2410c;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lab-purchase-suggestions__link:hover {
  color: #9a3412;
}

.lab-purchase-suggestions__disclosure {
  margin: 0.5rem 0 0;
  font-size: 0.65rem;
  line-height: 1.35;
  color: #64748b;
}

.mdr-shop-actions .mdr-shop-link--amazon {
  margin-left: 0.35rem;
  color: #c2410c;
}

.lab-calc-layout--with-diag {
  display: grid;
  gap: 0.9rem;
  grid-template-areas:
    'diagram'
    'inputs'
    'out';
}

.lab-calc-layout--with-diag .lab-calc-layout__diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (min-width: 920px) {
  .lab-calc-layout--with-diag {
    grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
    grid-template-areas:
      'diagram diagram'
      'inputs out';
    align-items: start;
  }

  .lab-calc-layout__inputs {
    grid-area: inputs;
  }

  .lab-calc-layout__out {
    grid-area: out;
  }

  .lab-calc-layout__diagram {
    grid-area: diagram;
  }
}

.lab-field__label-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.lab-field__label-text {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  line-height: 1.25;
}

.lab-field-ico {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.lab-field-ico svg {
  width: 22px;
  height: 22px;
}

.lab-field-ico--stroke {
  stroke: #0f766e;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lab-field-ico--fill {
  fill: #0f766e;
  stroke: none;
}

/* Entradas más discretas que el bloque de resultados */
.lab-calc-layout__inputs .lab-field input,
.lab-calc-layout__inputs .lab-field select {
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
}

.lab-calc-layout__inputs .lab-field input:focus,
.lab-calc-layout__inputs .lab-field select:focus {
  color: #0f172a;
}

.lab-result-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.6rem 0.85rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  border-radius: 12px;
  background: linear-gradient(145deg, #0f172a 0%, #134e4a 55%, #0f172a 100%);
  color: #f8fafc;
  border: 1px solid #334155;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.25);
}

.lab-result-hero__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
}

.lab-result-hero__head .lab-help-hover--hero {
  margin-left: auto;
  flex-shrink: 0;
}

.lab-result-hero__head .lab-help-hover__btn {
  background: rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.lab-result-hero__head .lab-help-hover__btn:hover,
.lab-result-hero__head .lab-help-hover__btn:focus-visible {
  background: #f8fafc;
  color: #0f172a;
}

.lab-result-hero__label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  line-height: 1.25;
  min-width: 0;
}

.lab-result-hero__value-line {
  margin-top: 0.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.35rem;
}

.lab-result-hero__value {
  font-size: clamp(1.45rem, 3.5vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: #fff;
}

.lab-result-hero__hint {
  display: none;
}

.lab-motor-ruler {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem 0.65rem;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.lab-motor-ruler__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.55rem;
}

.lab-motor-ruler__title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
}

.lab-motor-ruler__brands {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
}

.lab-motor-ruler__track {
  position: relative;
  height: 52px;
  margin: 0.25rem 0 0.15rem;
  border-radius: 6px;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #e2e8f0;
}

.lab-motor-ruler__bar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 14px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #cbd5e1 0%, #94a3b8 100%);
}

.lab-motor-ruler__tick {
  position: absolute;
  bottom: 20px;
  width: 0;
  height: 10px;
  border-left: 1px solid #64748b;
  transform: translateX(-50%);
  opacity: 0.65;
}

.lab-motor-ruler__tick--major {
  height: 14px;
  border-left-width: 2px;
  opacity: 1;
}

.lab-motor-ruler__tick-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 4px);
  font-size: 0.58rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lab-motor-ruler__needle {
  position: absolute;
  bottom: 8px;
  left: 0;
  height: 36px;
  width: 0;
  transform: translateX(-50%);
  border-left: 3px solid #ea580c;
  z-index: 2;
}

.lab-motor-ruler__needle-cap {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -4px);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: #ea580c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

.lab-motor-ruler__cap {
  margin: 1.35rem 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.45;
  color: #64748b;
}

.lab-results-wrap {
  position: relative;
  min-height: 3rem;
}

.lab-results-wrap .lab-results {
  margin-top: 0;
}

.lab-results-wrap--computing .lab-results {
  opacity: 0.35;
  filter: grayscale(0.15);
  transition: opacity 0.12s ease;
}

.lab-results-computing {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 3;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.72);
}

.lab-results-wrap--computing .lab-results-computing {
  opacity: 1;
}

.lab-results-computing__label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.lab-gear-spin {
  width: 40px;
  height: 40px;
  animation: lab-gear-rotate 1.1s linear infinite;
}

.lab-results-wrap--pulse .lab-results {
  animation: lab-results-pulse 0.55s ease;
}

@keyframes lab-gear-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes lab-results-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.35);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(13, 148, 136, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lab-gear-spin {
    animation: none;
  }

  .lab-results-wrap--pulse .lab-results {
    animation: none;
  }
}

/* Métricas secundarias más pequeñas que el héroe */
.lab-calc-layout__out .lab-metric .v {
  font-size: 0.92rem;
  font-weight: 600;
}

.lab-calc-layout__out .lab-metric .k {
  font-size: 0.64rem;
}

.lab-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.lab-alert__icon {
  flex-shrink: 0;
  display: flex;
  margin-top: 0.08rem;
}

.lab-alert__body {
  flex: 1;
  min-width: 0;
}

.lab-alert__list {
  margin: 0.4rem 0 0 1rem;
  padding: 0;
}

.lab-alert__list li + li {
  margin-top: 0.2rem;
}

.lab-alert__glyph {
  display: block;
}

.lab-alert--info {
  border-left: 4px solid #0891b2;
  padding-left: 0.65rem;
}

.lab-alert--warn {
  border-left: 4px solid #ca8a04;
  padding-left: 0.65rem;
}

.lab-alert--danger {
  border-left: 4px solid #b91c1c;
  padding-left: 0.65rem;
}

.lab-alert--ok {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-left: 4px solid #059669;
  color: #064e3b;
  padding-left: 0.65rem;
}

.lab-alert--ok .lab-alert__glyph {
  stroke: #047857;
}

.lab-alert--info .lab-alert__glyph {
  stroke: #0e7490;
}

.lab-alert--warn .lab-alert__glyph {
  stroke: #a16207;
}

.lab-alert--danger .lab-alert__glyph {
  stroke: #991b1b;
}

/* --- Lienzo técnico Pro (transmission-canvas) --- */
.lab-main--wide {
  max-width: min(100%, 1680px);
}

.tx-intro {
  margin-bottom: 0.5rem;
}

.tx-intro__lead {
  margin-bottom: 0.35rem;
}

.tx-workspace-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
}

.tx-tab {
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  cursor: pointer;
}

.tx-tab:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.tx-tab--active {
  background: #fff;
  border-color: #0d9488;
  color: #0f766e;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.tx-motor-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
}

.tx-motor-strip .lab-field {
  margin-bottom: 0;
  min-width: 120px;
}

.tx-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(260px, 300px);
  gap: 1rem;
  align-items: start;
}

.tx-layout--canvas-focus {
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr) minmax(240px, 280px);
}

.tx-sidebar {
  align-self: start;
  min-width: 0;
  overflow: visible;
}

.tx-sidebar .studio-aside-title,
.tx-canvas-panel .studio-aside-title,
.tx-hud .studio-aside-title {
  letter-spacing: 0.01em;
}

@media (max-width: 1100px) {
  .tx-layout,
  .tx-layout--canvas-focus {
    grid-template-columns: 1fr;
  }
}

.tx-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.tx-toolbar__row--wrap {
  margin-top: 0.35rem;
}

.tx-run-summary {
  margin-top: 0.45rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #334155;
}

.tx-run-summary strong {
  color: #0f172a;
}

.tx-btn--secondary {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #94a3b8;
}

.tx-btn--ghost {
  background: #fff;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.tx-btn--active {
  box-shadow: inset 0 0 0 2px #0d9488;
  border-color: #0d9488;
}

.tx-hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 0.85rem 0;
}

.tx-subtitle {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
}

.tx-muted {
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.tx-small {
  font-size: 0.72rem;
}

.tx-pick-hint {
  font-size: 0.72rem;
  color: #334155;
  line-height: 1.4;
  margin: 0.5rem 0 0;
  padding: 0.45rem 0.5rem;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.tx-canvas-panel {
  min-height: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: #d7e3f0;
}

.tx-canvas-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.35rem;
}

.tx-zoom-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tx-zoom-btn {
  font: inherit;
  font-weight: 800;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #94a3b8;
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
  line-height: 1;
}

.tx-zoom-btn:hover {
  background: #e2e8f0;
}

.tx-zoom-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  min-width: 3.2rem;
  text-align: center;
}

.tx-zoom-fit {
  font-size: 0.72rem !important;
  padding: 0.35rem 0.65rem !important;
}

.tx-canvas-hint {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  color: #64748b;
  line-height: 1.4;
}

.tx-svg-wrap {
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #f8fafc 0%, #eef5fb 100%);
  overflow: hidden;
  min-height: 72vh;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tx-svg-wrap:focus-visible {
  box-shadow: 0 0 0 2px #0d9488;
}

.tx-svg {
  display: block;
  width: 100%;
  height: 72vh;
  min-height: 520px;
  max-height: 900px;
}

.tx-hud .studio-aside-title {
  margin-top: 0;
}

.tx-formula-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.74rem;
  line-height: 1.5;
  color: #334155;
}

.tx-formulas {
  max-height: 42vh;
  overflow: auto;
}

.tx-formulas-details {
  margin: 0.2rem 0 0.8rem;
  border: 1px solid #dbe5ef;
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
}

.tx-formulas-details > summary {
  cursor: pointer;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.tx-formulas-details > summary::-webkit-details-marker {
  display: none;
}

.tx-formulas-details > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.38rem;
  color: #0f766e;
}

.tx-formulas-details[open] > summary::before {
  content: '▾';
}

.tx-formulas-details:not([open]) > summary {
  border-bottom-color: transparent;
}

.tx-formulas-details .tx-formulas {
  padding: 0.55rem 0.65rem 0.65rem;
  max-height: 36vh;
}

@media (max-width: 900px) {
  .lab-help-hover__tip {
    max-width: min(280px, calc(100vw - 1rem));
  }
  .tx-layout .lab-help-hover--field .lab-help-hover__tip {
    right: 0;
    left: auto;
    bottom: calc(100% + 8px);
  }
}

.tx-verdict-strip {
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.74rem;
  line-height: 1.45;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.tx-verdict-strip--ok {
  border-color: #6ee7b7;
  background: #ecfdf5;
  color: #14532d;
}

.tx-verdict-strip--warn {
  border-color: #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

.tx-verdict-strip--err {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.tx-verdict-line {
  margin: 0.25rem 0 0;
}

.tx-verdict-line:first-child {
  margin-top: 0;
}

.tx-checks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

.tx-check {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.38rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.4;
}

.tx-check--ok {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #14532d;
}

.tx-check--warn {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.tx-check--err {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.tx-element-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.5rem;
}

.tx-element-card {
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 0.5rem 0.6rem;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.tx-element-card__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 0.3rem;
}

.tx-element-card__badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.08rem 0.42rem;
  background: #dcfce7;
  color: #166534;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tx-element-card__kv {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.12rem 0.35rem;
  font-size: 0.68rem;
}

.tx-element-card__kv dt {
  color: #64748b;
  font-weight: 700;
}

.tx-element-card__kv dd {
  margin: 0;
  text-align: right;
  color: #0f172a;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tx-props-grid {
  margin-top: 0.15rem;
}

.tx-props-grid .lab-field > label {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

/* Panel izquierdo del lienzo: evitar recortes con formularios detallados */
.tx-sidebar .lab-grid--2,
.tx-sidebar .tx-props-grid {
  grid-template-columns: 1fr;
}

.tx-sidebar .lab-field input,
.tx-sidebar .lab-field select {
  width: 100%;
  min-width: 0;
}

/* Tooltips en barra izquierda del lienzo: compactos para no recortar */
.tx-sidebar .lab-help-hover--field .lab-help-hover__tip {
  left: auto;
  right: 0;
  max-width: min(220px, calc(100vw - 1rem));
}

/* Fallback robusto: en barra izquierda del lienzo, mostrar ayuda en bloque dentro del flujo */
.tx-sidebar .lab-help-hover {
  flex-wrap: wrap;
}

.tx-sidebar .lab-help-hover__tip {
  position: static;
  top: auto;
  right: auto;
  left: auto;
  bottom: auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin-top: 0.28rem;
  pointer-events: auto;
}

.tx-element-card--motor {
  border-color: #86efac;
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.12);
}

.tx-element-card--muted {
  opacity: 0.78;
}

.tx-legend {
  font-weight: 700;
  padding: 0.05rem 0.25rem;
  border-radius: 4px;
}

.tx-legend--ok {
  background: #d1fae5;
  color: #065f46;
}

.tx-legend--warn {
  background: #ffedd5;
  color: #9a3412;
}

.tx-legend--err {
  background: #fee2e2;
  color: #991b1b;
}

.tx-sidebar,
.tx-hud,
.tx-canvas-panel {
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.tx-props-head {
  margin-bottom: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-weight: 700;
}

.tx-segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}

.tx-segmented button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 10px;
  padding: 0.4rem 0.45rem;
  font-weight: 700;
  cursor: pointer;
}

.tx-segmented button.is-active {
  background: #0ea5a4;
  border-color: #0f766e;
  color: #fff;
}

.tx-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tx-chip {
  border: 1px solid #bae6fd;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.tx-chip.is-active {
  background: #0ea5a4;
  border-color: #0f766e;
  color: #fff;
}

.tx-switch {
  display: inline-flex;
  align-items: center;
  margin-top: 0.2rem;
}

.tx-switch input {
  display: none;
}

.tx-switch__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease;
}

.tx-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.tx-switch input:checked + .tx-switch__track {
  background: #10b981;
}

.tx-switch input:checked + .tx-switch__track::after {
  transform: translateX(20px);
}

.tx-mini-diagram {
  width: 100%;
  height: 36px;
  margin-top: 0.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.tx-node-menu {
  position: fixed;
  z-index: 1200;
  display: flex;
  gap: 0.35rem;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 999px;
  padding: 0.35rem;
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.4);
}

.tx-node-menu__btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f8fafc;
  cursor: pointer;
}

.tx-node-menu__btn--danger {
  background: #7f1d1d;
  border-color: #991b1b;
}

.tx-badge-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.tx-state-badge {
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
}

.tx-state-badge--ok {
  background: #dcfce7;
  color: #166534;
}

.tx-state-badge--warn {
  background: #fef3c7;
  color: #92400e;
}

.tx-state-badge--err {
  background: #fee2e2;
  color: #991b1b;
}

.tx-cross-glow {
  filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.8));
}

@media (prefers-color-scheme: dark) {
  .tx-sidebar,
  .tx-hud,
  .tx-canvas-panel {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.55);
  }
  .tx-props-head {
    background: linear-gradient(180deg, #0b2548, #153c73);
    border-color: #1d4ed8;
    color: #dbeafe;
  }
  .tx-segmented button,
  .tx-chip,
  .tx-mini-diagram {
    background: #111827;
    border-color: #334155;
    color: #cbd5e1;
  }
  .tx-muted,
  .tx-canvas-hint,
  .tx-small-print {
    color: #94a3b8;
  }
}

@media (prefers-contrast: more) {
  .lab-alert--info,
  .lab-alert--warn,
  .lab-alert--danger,
  .lab-alert--ok {
    border-width: 2px;
    border-left-width: 6px;
  }

  .lab-result-hero {
    border-width: 2px;
  }
}

/* ——— Smart Dashboard (IA Advisor + presupuesto demo) ——— */
.lab-body--mdr-dash {
  padding-right: min(22rem, 92vw);
}

.lab-body--mdr-dash--collapsed {
  padding-right: 3.25rem;
}

.mdr-smart-dash {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(22rem, 92vw);
  height: 100vh;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 48%, #0f172a 100%);
  color: #e2e8f0;
  box-shadow: -8px 0 28px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  font-size: 0.78rem;
  transition: width 0.22s ease, transform 0.22s ease;
}

.mdr-smart-dash--collapsed {
  width: 3.25rem;
}

.mdr-smart-dash--collapsed .mdr-smart-dash__body,
.mdr-smart-dash--collapsed .mdr-smart-dash__title-wrap {
  display: none;
}

.mdr-smart-dash__chrome {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.55rem 0.5rem 0.45rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.65);
}

.mdr-smart-dash__collapse {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  cursor: pointer;
  font-size: 0.65rem;
  line-height: 1;
}

.mdr-smart-dash__collapse:hover {
  border-color: #2dd4bf;
}

.mdr-smart-dash__chev {
  display: block;
  transform: rotate(0deg);
}

.mdr-smart-dash--collapsed .mdr-smart-dash__chev {
  transform: rotate(180deg);
}

.mdr-smart-dash__title-wrap {
  min-width: 0;
}

.mdr-smart-dash__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #f8fafc;
}

.mdr-smart-dash__sub {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.35;
}

.mdr-smart-dash__body {
  flex: 1;
  overflow: auto;
  padding: 0.65rem 0.65rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mdr-smart-dash__budget {
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  background: rgba(15, 118, 110, 0.22);
  border: 1px solid rgba(45, 212, 191, 0.35);
}

.mdr-smart-dash__budget-k {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #99f6e4;
  font-weight: 700;
}

.mdr-smart-dash__budget-v {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: #f0fdfa;
  margin-top: 0.15rem;
}

.mdr-smart-dash__budget-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  color: #94a3b8;
}

.mdr-smart-dash__toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #cbd5e1;
}

.mdr-smart-dash__toggle input {
  margin-top: 0.12rem;
  accent-color: #14b8a6;
}

.mdr-smart-dash__meters {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mdr-dash-meter__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.68rem;
  color: #cbd5e1;
  margin-bottom: 0.2rem;
}

.mdr-dash-meter__val {
  font-weight: 800;
  color: #5eead4;
}

.mdr-dash-meter__track {
  height: 6px;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.85);
  overflow: hidden;
}

.mdr-dash-meter__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.mdr-smart-dash__section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  font-weight: 800;
}

.mdr-smart-dash__insights {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mdr-insight {
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.55);
}

.mdr-insight h4 {
  margin: 0 0 0.25rem;
  font-size: 0.74rem;
  font-weight: 800;
  color: #f1f5f9;
}

.mdr-insight p {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.45;
  color: #cbd5e1;
}

.mdr-insight__norm {
  margin-top: 0.35rem !important;
  font-size: 0.62rem !important;
  color: #64748b !important;
  font-style: italic;
}

.mdr-insight--tip {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(120, 53, 15, 0.2);
}

.mdr-insight--warn {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(127, 29, 29, 0.22);
}

.mdr-smart-dash__shop {
  overflow: auto;
  max-height: 38vh;
}

.mdr-shop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
}

.mdr-shop-table th,
.mdr-shop-table td {
  padding: 0.3rem 0.25rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.9);
  vertical-align: top;
}

.mdr-shop-table th {
  text-align: left;
  color: #94a3b8;
  font-weight: 700;
}

.mdr-shop-table .num {
  text-align: right;
  white-space: nowrap;
}

.mdr-shop-note {
  display: block;
  font-size: 0.6rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.mdr-shop-link {
  color: #5eead4;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.mdr-shop-link:hover {
  text-decoration: underline;
}

.mdr-smart-dash__muted {
  margin: 0;
  font-size: 0.68rem;
  color: #64748b;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .lab-body--mdr-dash {
    padding-right: 0;
  }

  .mdr-smart-dash {
    width: 100vw;
    height: 42vh;
    top: auto;
    bottom: 0;
    border-radius: 12px 12px 0 0;
  }

  .mdr-smart-dash--collapsed {
    width: 100vw;
    height: 2.75rem;
  }
}

/* ISO 286: tabla de recomendaciones por aplicacion */
.lab-iso-rec-details {
  margin-bottom: 0.65rem;
}

.lab-iso-rec-details .lab-iso-rec-wrap {
  padding: 0.45rem 0.5rem 0.55rem;
  overflow-x: visible;
}

.lab-iso-rec-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.68rem;
  line-height: 1.32;
}

.lab-iso-rec-table th,
.lab-iso-rec-table td {
  border: 1px solid #e2e8f0;
  padding: 0.28rem 0.35rem;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.lab-iso-rec-table th {
  background: #f1f5f9;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.58rem;
  color: #475569;
}

.lab-iso-rec-table__col-fit {
  width: 26%;
}

.lab-iso-rec-table__col-use {
  width: auto;
}

.lab-iso-rec-table__col-act {
  width: 2.25rem;
  text-align: center;
  vertical-align: middle;
  padding-left: 0.2rem;
  padding-right: 0.2rem;
}

.lab-iso-rec-table__code {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0f172a;
}

.lab-iso-rec-table__meta {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.58rem;
  color: #64748b;
  line-height: 1.25;
}

.lab-iso-rec-table__title {
  display: block;
  font-weight: 600;
  color: #0f172a;
}

.lab-iso-rec-table__example {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.6rem;
  color: #0f766e;
  line-height: 1.32;
}

.lab-iso-rec-table__example-prefix {
  font-weight: 800;
  color: #0d9488;
  margin-right: 0.15rem;
}

.lab-iso-rec-table__note {
  display: block;
  margin-top: 0.16rem;
  font-size: 0.6rem;
  color: #64748b;
  line-height: 1.3;
}

.lab-iso-rec-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.lab-iso-rec-table__btn.lab-btn {
  min-width: 0;
  width: 100%;
  max-width: 2rem;
  margin: 0 auto;
  padding: 0.18rem 0.12rem;
  font-size: 0.85rem;
  line-height: 1;
  font-weight: 800;
}

/* Pie de donacion (laboratorio gratuito) */
.lab-donate {
  margin: 2.25rem auto 0;
  max-width: 40rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid #c8e6e1;
  border-radius: 12px;
  background: linear-gradient(165deg, #f0fdfa 0%, #ecfdf5 45%, #f8fafc 100%);
  box-shadow: 0 1px 0 rgba(15, 118, 110, 0.06);
}

.lab-donate__inner {
  text-align: center;
}

.lab-donate__kicker {
  margin: 0 0 0.35rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0f766e;
}

.lab-donate__text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #334155;
}

.lab-donate__text a {
  color: #0d9488;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lab-donate__text a:hover {
  color: #0f766e;
}

.lab-donate__actions {
  margin: 0.75rem 0 0;
}

.lab-donate__btn.lab-btn {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  font-size: 0.76rem;
  font-weight: 800;
  background: #0f766e;
  color: #fff;
  border: none;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

.lab-donate__btn.lab-btn:hover {
  background: #0d9488;
  color: #fff;
}

/* Memoria formulas + montaje PDF (laboratorio fluidos) */
.lab-fluid-formulas {
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.lab-fluid-formulas > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--border);
}

.lab-fluid-formulas > summary::-webkit-details-marker {
  display: none;
}

.lab-fluid-formulas[open] > summary {
  border-bottom: 1px solid var(--border);
}

.lab-fluid-formulas__body {
  padding: 0.65rem 0.8rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #334155;
}

.lab-fluid-formulas__lead {
  margin: 0 0 0.45rem;
  font-weight: 700;
  color: var(--text);
}

.lab-fluid-formulas__sub {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.lab-fluid-formulas__list {
  margin: 0;
  padding-left: 1.15rem;
}

.lab-fluid-formulas__list li {
  margin-bottom: 0.35rem;
}

.premium-pdf-mount {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}

/* --- Hub list pages (machines / fluids) --- */
.lab-body--hub {
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(13, 148, 136, 0.08), transparent 55%),
    linear-gradient(168deg, #f8fafc 0%, #f1f5f9 50%, #e8edf2 100%);
}

.lab-panel--hub {
  max-width: 1080px;
  margin-inline: auto;
  padding: 1.35rem 1.25rem 2rem;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.96) 100%);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.07);
}

.lab-hub-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #0f766e;
}

.lab-panel--hub h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  letter-spacing: -0.03em;
}

.lab-lead--hub {
  max-width: 44rem;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 1.35rem;
}

.lab-index-section--hub {
  margin-top: 1.5rem;
  margin-bottom: 1.1rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: #64748b;
}

.lab-index-grid--hub {
  gap: 1.15rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.lab-card--hub {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.2rem 1.2rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  overflow: hidden;
}

.lab-card--hub::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #0d9488, #14b8a6, #2dd4bf);
  opacity: 0;
  transition: opacity 0.2s ease;
}

a.lab-card--hub:hover {
  transform: translateY(-4px);
  border-color: rgba(13, 148, 136, 0.45);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.11);
}

a.lab-card--hub:hover::before {
  opacity: 1;
}

a.lab-card--hub:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 3px;
}

.lab-card--hub .lab-badge {
  margin-top: 0.1rem;
}

.lab-card--hub h3 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.lab-card--hub p {
  font-size: 0.84rem;
  line-height: 1.5;
  color: #475569;
}

.lab-card--hub__icon {
  font-size: 1.85rem;
  line-height: 1;
  margin-bottom: 0.15rem;
  filter: grayscale(0.08);
}

.lab-card--hub__icon--muted {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.lab-card--hub--soon {
  cursor: default;
  opacity: 0.88;
  background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 100%);
  border-style: dashed;
}

.lab-card--hub--soon::before {
  display: none;
}
