.mt-workbench {
  position: relative;
  display: grid;
  grid-template-columns: 1.22fr 1fr;
  gap: 28px;
  align-items: stretch;
}
@media (max-width: 980px) {
  .mt-workbench {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
.mt-bottom-grid {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1.22fr 1fr;
  gap: 28px;
  margin-top: 24px;
  align-items: stretch;
}
@media (max-width: 980px) {
  .mt-bottom-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
.mt-hero-canvas-bg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  top: -150px;
  bottom: -110px;
  pointer-events: none;
  z-index: 1;
}
.mouse3d-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}
.mt-panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.04);
}
.mt-arena {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
  overflow: visible;
  min-height: 460px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
}
.mt-arena:focus,
.mt-arena.is-pressed {
  outline: none;
  border: none;
  box-shadow: none;
}
.mt-3d-stage {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  position: relative;
  min-height: 450px;
}
.mouse3d-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 450px;
  touch-action: manipulation;
}
.mt-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.mt-loading.is-done {
  opacity: 0;
}
.mt-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: mt-spin 0.8s linear infinite;
}
@keyframes mt-spin {
  to { transform: rotate(360deg); }
}
.mt-hud-controls {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 4;
}
.mt-hud-zoom {
  display: flex;
  gap: 6px;
}
.mt-hud-zoom .mt-mini-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.32);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.mt-color-bar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.32);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.mt-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  border: 1.5px solid rgba(15, 23, 42, 0.18);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.mt-swatch:hover {
  transform: scale(1.12);
}
.mt-swatch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb;
}
.mt-swatch.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb;
}
.mt-swatch-white {
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
}
.mt-swatch-black {
  background: linear-gradient(135deg, #334155 0%, #0f172a 100%);
}
.mt-swatch-pink {
  background: linear-gradient(135deg, #fbcfe8 0%, #f472b6 100%);
}
.mt-mini-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-family: inherit;
}
.mt-mini-btn:hover {
  background: #ffffff;
  border-color: #94a3b8;
}

/* Sensor & Raw Cursor Trail Card (Hero Right) */
.mt-trail-card {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mt-trail-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mt-trail-ico {
  width: 18px;
  height: 18px;
  color: #2563eb;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mt-trail-ico circle {
  fill: currentColor;
  stroke: none;
}
.mt-trail-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  flex: 1;
}
.mt-trail-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.mt-trail-badge.is-active {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}
.mt-trail-badge.is-ok {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}
.mt-trail-badge.is-warn {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.mt-trail-paper {
  position: relative;
  flex: 1;
  min-height: 330px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mt-trail-card.is-drawing .mt-trail-paper {
  border-color: #3b82f6;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
}
.mt-trail-cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
}
.mt-trail-guide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
.mt-trail-card.is-drawing .mt-trail-guide,
.mt-trail-card.has-ink .mt-trail-guide {
  opacity: 0;
  visibility: hidden;
}
.mt-trail-guide .g8 {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.6;
  stroke-dasharray: 5 5;
}
.mt-trail-guide .st0 {
  fill: #2563eb;
  stroke: #ffffff;
  stroke-width: 2;
}
.mt-trail-guide .ar {
  fill: none;
  stroke: #64748b;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mt-trail-guide .cap {
  fill: #64748b;
  font-size: 12.5px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.mt-trail-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.mt-trail-stats {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.mt-trail-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.mt-trail-stat b {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.mt-trail-stat b.is-warn {
  color: #dc2626;
}
.mt-trail-clr {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.mt-trail-clr:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}
.mt-trail-clr[hidden] {
  display: none;
}
.mt-trail-clr svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Page presets (inner tool pages open this same tool focused on one test) */
.mt-preset-clear {
  grid-column: 1 / -1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.mt-preset-clear:hover {
  border-color: #94a3b8;
  color: #0f172a;
}
.mt-preset-clear[hidden] {
  display: none;
}
.mt-metric-box.is-preset-focus {
  background: #0f172a;
  border-color: #0f172a;
}
.mt-metric-box.is-preset-focus span {
  color: #94a3b8;
}
.mt-metric-box.is-preset-focus strong {
  color: #93c5fd;
  font-size: 30px;
  line-height: 1.15;
}
.mt-preset-cps .mt-metrics-row {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 600px) {
  .mt-preset-cps .mt-metrics-row {
    grid-template-columns: 1fr;
  }
}

.mt-telemetry {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mt-counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 520px) {
  .mt-counters {
    grid-template-columns: repeat(2, 1fr);
  }
}
.mt-stat {
  background: rgba(248, 250, 252, 0.88);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease, transform 0.06s ease;
}
.mt-stat.is-selected {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.16);
}
.mt-stat.active {
  background: #dbeafe;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.24);
  transform: translateY(1px);
}
.mt-stat.chatter {
  border-color: #ef4444;
  background: #fef2f2;
}
.mt-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mt-stat-val {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.25;
  margin-top: 4px;
}
.mt-stat-sub {
  font-size: 11px;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  margin-top: 2px;
}
.mt-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mt-metric-box {
  background: rgba(248, 250, 252, 0.88);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}
.mt-metric-box span {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mt-metric-box strong {
  display: block;
  font-size: 16px;
  color: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  margin-top: 2px;
}
.mt-chatter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: rgba(248, 250, 252, 0.88);
}
.mt-chatter-bar.is-healthy {
  border-color: #a7f3d0;
  background: #ecfdf5;
}
.mt-chatter-bar.is-alert {
  border-color: #fecaca;
  background: #fef2f2;
}
.mt-chatter-status {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.mt-chatter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}
.mt-chatter-controls input[type="checkbox"] {
  accent-color: #2563eb;
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.mt-dd {
  position: relative;
  display: inline-block;
  width: 186px;
}
.mt-dd-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px 0 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
}
.mt-dd-trigger:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.mt-dd-trigger:focus,
.mt-dd-trigger:focus-visible,
.mt-dd.is-open .mt-dd-trigger {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
  background: #ffffff;
}
.mt-dd-arrow {
  width: 14px;
  height: 14px;
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.18s ease, color 0.18s ease;
}
.mt-dd.is-open .mt-dd-arrow {
  transform: rotate(180deg);
  color: #2563eb;
}
.mt-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  padding: 5px;
  border-radius: 11px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top center;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}
.mt-dd.is-open .mt-dd-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.mt-dd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease;
}
.mt-dd-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.mt-dd-item:focus-visible {
  outline: none;
  background: #f1f5f9;
}
.mt-dd-item.is-selected {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}
.mt-dd-item-main {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.mt-dd-ms {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
}
.mt-dd-tag {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}
.mt-dd-item.is-selected .mt-dd-tag {
  color: #3b82f6;
}
.mt-dd-check {
  width: 14px;
  height: 14px;
  opacity: 0;
  color: #2563eb;
  flex-shrink: 0;
}
.mt-dd-item.is-selected .mt-dd-check {
  opacity: 1;
}
.mt-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}
.mt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.mt-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.mt-btn-primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.mt-btn-primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}
.mt-log-wrap {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.04);
}
.mt-log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px;
  background: rgba(248, 250, 252, 0.92);
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.mt-log-head span:last-child {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.mt-log-list {
  flex: 1;
  max-height: 360px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  padding: 6px 0;
}
.mt-log-row {
  display: grid;
  grid-template-columns: 76px 130px 90px 1fr;
  gap: 8px;
  padding: 5px 18px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.mt-log-row:last-child {
  border-bottom: none;
}
.mt-log-row.is-warn {
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 600;
}
.mt-log-empty {
  padding: 36px 20px;
  text-align: center;
  color: #94a3b8;
  line-height: 1.6;
}
@media (max-width: 600px) {
  .mt-log-row {
    grid-template-columns: 64px 100px 1fr;
  }
  .mt-log-row .mt-log-ev {
    display: none;
  }
}